mirror of https://github.com/rails/rails
Test using sprockets 3
This commit is contained in:
parent
6b53283051
commit
a8225eeec2
2
Gemfile
2
Gemfile
|
@ -17,6 +17,8 @@ gem 'turbolinks'
|
||||||
gem 'arel', github: 'rails/arel', branch: 'master'
|
gem 'arel', github: 'rails/arel', branch: 'master'
|
||||||
gem 'mail', github: 'mikel/mail'
|
gem 'mail', github: 'mikel/mail'
|
||||||
|
|
||||||
|
gem 'sprockets', '~> 3.0.0.rc.1'
|
||||||
|
|
||||||
# require: false so bcrypt is loaded only when has_secure_password is used.
|
# require: false so bcrypt is loaded only when has_secure_password is used.
|
||||||
# This is to avoid ActiveModel (and by extension the entire framework)
|
# This is to avoid ActiveModel (and by extension the entire framework)
|
||||||
# being dependent on a binary library.
|
# being dependent on a binary library.
|
||||||
|
|
|
@ -125,7 +125,6 @@ GEM
|
||||||
execjs (2.3.0)
|
execjs (2.3.0)
|
||||||
globalid (0.3.3)
|
globalid (0.3.3)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
hike (1.2.3)
|
|
||||||
hitimes (1.2.2)
|
hitimes (1.2.2)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
json (1.8.2)
|
json (1.8.2)
|
||||||
|
@ -142,7 +141,7 @@ GEM
|
||||||
mocha (0.14.0)
|
mocha (0.14.0)
|
||||||
metaclass (~> 0.0.1)
|
metaclass (~> 0.0.1)
|
||||||
mono_logger (1.1.0)
|
mono_logger (1.1.0)
|
||||||
multi_json (1.10.1)
|
multi_json (1.11.0)
|
||||||
mustache (1.0.0)
|
mustache (1.0.0)
|
||||||
mysql (2.9.1)
|
mysql (2.9.1)
|
||||||
mysql2 (0.3.18)
|
mysql2 (0.3.18)
|
||||||
|
@ -211,11 +210,8 @@ GEM
|
||||||
serverengine
|
serverengine
|
||||||
thor
|
thor
|
||||||
thread
|
thread
|
||||||
sprockets (2.12.3)
|
sprockets (3.0.0.rc.1)
|
||||||
hike (~> 1.2)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
|
||||||
sprockets-rails (2.2.4)
|
sprockets-rails (2.2.4)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
|
@ -285,6 +281,7 @@ DEPENDENCIES
|
||||||
sequel
|
sequel
|
||||||
sidekiq
|
sidekiq
|
||||||
sneakers (= 0.1.1.pre)
|
sneakers (= 0.1.1.pre)
|
||||||
|
sprockets (~> 3.0.0.rc.1)
|
||||||
sqlite3 (~> 1.3.6)
|
sqlite3 (~> 1.3.6)
|
||||||
stackprof
|
stackprof
|
||||||
sucker_punch
|
sucker_punch
|
||||||
|
|
|
@ -57,8 +57,8 @@ module ApplicationTests
|
||||||
class ::PostsController < ActionController::Base ; end
|
class ::PostsController < ActionController::Base ; end
|
||||||
|
|
||||||
get '/posts?debug_assets=true'
|
get '/posts?debug_assets=true'
|
||||||
assert_match(/<script src="\/assets\/application-([0-z]+)\.js\?body=1"><\/script>/, last_response.body)
|
assert_match(/<script src="\/assets\/application(\.self)?-([0-z]+)\.js\?body=1"><\/script>/, last_response.body)
|
||||||
assert_match(/<script src="\/assets\/xmlhr-([0-z]+)\.js\?body=1"><\/script>/, last_response.body)
|
assert_match(/<script src="\/assets\/xmlhr(\.self)?-([0-z]+)\.js\?body=1"><\/script>/, last_response.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -204,7 +204,7 @@ module ApplicationTests
|
||||||
app_file "app/assets/javascripts/application.js", "alert();"
|
app_file "app/assets/javascripts/application.js", "alert();"
|
||||||
|
|
||||||
precompile!
|
precompile!
|
||||||
manifest = Dir["#{app_path}/public/assets/manifest-*.json"].first
|
manifest = Dir["#{app_path}/public/assets/.sprockets-manifest-*.json"].first
|
||||||
|
|
||||||
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
||||||
assert_match(/application-([0-z]+)\.js/, assets["assets"]["application.js"])
|
assert_match(/application-([0-z]+)\.js/, assets["assets"]["application.js"])
|
||||||
|
@ -217,7 +217,7 @@ module ApplicationTests
|
||||||
|
|
||||||
precompile!
|
precompile!
|
||||||
|
|
||||||
manifest = Dir["#{app_path}/public/x/manifest-*.json"].first
|
manifest = Dir["#{app_path}/public/x/.sprockets-manifest-*.json"].first
|
||||||
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
||||||
assert_match(/application-([0-z]+)\.js/, assets["assets"]["application.js"])
|
assert_match(/application-([0-z]+)\.js/, assets["assets"]["application.js"])
|
||||||
end
|
end
|
||||||
|
@ -229,7 +229,7 @@ module ApplicationTests
|
||||||
ENV["RAILS_ENV"] = "production"
|
ENV["RAILS_ENV"] = "production"
|
||||||
precompile!
|
precompile!
|
||||||
|
|
||||||
manifest = Dir["#{app_path}/public/assets/manifest-*.json"].first
|
manifest = Dir["#{app_path}/public/assets/.sprockets-manifest-*.json"].first
|
||||||
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
||||||
asset_path = assets["assets"]["application.js"]
|
asset_path = assets["assets"]["application.js"]
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ module ApplicationTests
|
||||||
ENV["RAILS_ENV"] = "production"
|
ENV["RAILS_ENV"] = "production"
|
||||||
precompile!
|
precompile!
|
||||||
|
|
||||||
manifest = Dir["#{app_path}/public/assets/manifest-*.json"].first
|
manifest = Dir["#{app_path}/public/assets/.sprockets-manifest-*.json"].first
|
||||||
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
||||||
asset_path = assets["assets"]["application.css"]
|
asset_path = assets["assets"]["application.css"]
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ module ApplicationTests
|
||||||
|
|
||||||
precompile!
|
precompile!
|
||||||
|
|
||||||
manifest = Dir["#{app_path}/public/assets/manifest-*.json"].first
|
manifest = Dir["#{app_path}/public/assets/.sprockets-manifest-*.json"].first
|
||||||
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
assets = ActiveSupport::JSON.decode(File.read(manifest))
|
||||||
assert asset_path = assets["assets"].find { |(k, _)| k && k =~ /.png/ }[1]
|
assert asset_path = assets["assets"].find { |(k, _)| k && k =~ /.png/ }[1]
|
||||||
|
|
||||||
|
@ -437,9 +437,9 @@ module ApplicationTests
|
||||||
class ::PostsController < ActionController::Base; end
|
class ::PostsController < ActionController::Base; end
|
||||||
|
|
||||||
get '/posts', {}, {'HTTPS'=>'off'}
|
get '/posts', {}, {'HTTPS'=>'off'}
|
||||||
assert_match('src="http://example.com/assets/application.js', last_response.body)
|
assert_match('src="http://example.com/assets/application.self.js', last_response.body)
|
||||||
get '/posts', {}, {'HTTPS'=>'on'}
|
get '/posts', {}, {'HTTPS'=>'on'}
|
||||||
assert_match('src="https://example.com/assets/application.js', last_response.body)
|
assert_match('src="https://example.com/assets/application.self.js', last_response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "asset urls should be protocol-relative if no request is in scope" do
|
test "asset urls should be protocol-relative if no request is in scope" do
|
||||||
|
|
|
@ -1155,10 +1155,10 @@ YAML
|
||||||
assert_equal "App's bar partial", last_response.body.strip
|
assert_equal "App's bar partial", last_response.body.strip
|
||||||
|
|
||||||
get("/assets/foo.js")
|
get("/assets/foo.js")
|
||||||
assert_equal "// Bukkit's foo js\n;", last_response.body.strip
|
assert_equal "// Bukkit's foo js", last_response.body.strip
|
||||||
|
|
||||||
get("/assets/bar.js")
|
get("/assets/bar.js")
|
||||||
assert_equal "// App's bar js\n;", last_response.body.strip
|
assert_equal "// App's bar js", last_response.body.strip
|
||||||
|
|
||||||
# ensure that railties are not added twice
|
# ensure that railties are not added twice
|
||||||
railties = Rails.application.send(:ordered_railties).map(&:class)
|
railties = Rails.application.send(:ordered_railties).map(&:class)
|
||||||
|
|
Loading…
Reference in New Issue