diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/action_mailer_basics.textile | 4 | ||||
-rw-r--r-- | railties/guides/source/testing.textile | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/actions.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile | 3 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_case.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/model/templates/fixtures.yml | 2 | ||||
-rw-r--r-- | railties/test/application/asset_debugging_test.rb | 8 | ||||
-rw-r--r-- | railties/test/application/assets_test.rb | 18 | ||||
-rw-r--r-- | railties/test/application/rake_test.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/plugin_new_generator_test.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/shared_generator_tests.rb | 4 | ||||
-rw-r--r-- | railties/test/railties/engine_test.rb | 2 | ||||
-rw-r--r-- | railties/test/railties/shared_tests.rb | 10 |
13 files changed, 39 insertions, 36 deletions
diff --git a/railties/guides/source/action_mailer_basics.textile b/railties/guides/source/action_mailer_basics.textile index 351a4498b1..67761645fa 100644 --- a/railties/guides/source/action_mailer_basics.textile +++ b/railties/guides/source/action_mailer_basics.textile @@ -514,8 +514,8 @@ class UserMailerTest < ActionMailer::TestCase # Test the body of the sent email contains what we expect it to assert_equal [user.email], email.to assert_equal "Welcome to My Awesome Site", email.subject - assert_match /<h1>Welcome to example.com, #{user.name}<\/h1>/, email.encoded - assert_match /Welcome to example.com, #{user.name}/, email.encoded + assert_match(/<h1>Welcome to example.com, #{user.name}<\/h1>/, email.encoded) + assert_match(/Welcome to example.com, #{user.name}/, email.encoded) end end </ruby> diff --git a/railties/guides/source/testing.textile b/railties/guides/source/testing.textile index cc55d1f756..caa0d91a83 100644 --- a/railties/guides/source/testing.textile +++ b/railties/guides/source/testing.textile @@ -931,7 +931,7 @@ class UserControllerTest < ActionController::TestCase assert_equal "You have been invited by me@example.com", invite_email.subject assert_equal 'friend@example.com', invite_email.to[0] - assert_match /Hi friend@example.com/, invite_email.body + assert_match(/Hi friend@example.com/, invite_email.body) end end </ruby> diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index a7462f39ba..c43a99e85c 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -119,8 +119,8 @@ module Rails if commands.is_a?(Symbol) run "git #{commands}" else - commands.each do |command, options| - run "git #{command} #{options}" + commands.each do |cmd, options| + run "git #{cmd} #{options}" end end end diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index c83e7ddf80..910cd16950 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -10,6 +10,9 @@ source 'http://rubygems.org' <%= assets_gemfile_entry %> <%= javascript_gemfile_entry %> +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + # Use unicorn as the web server # gem 'unicorn' diff --git a/railties/lib/rails/generators/test_case.rb b/railties/lib/rails/generators/test_case.rb index ee85b70bb5..7319fb79f6 100644 --- a/railties/lib/rails/generators/test_case.rb +++ b/railties/lib/rails/generators/test_case.rb @@ -81,7 +81,7 @@ module Rails # # assert_file "app/controller/products_controller.rb" do |controller| # assert_instance_method :index, content do |index| - # assert_match /Product\.all/, index + # assert_match(/Product\.all/, index) # end # end # @@ -148,7 +148,7 @@ module Rails # # assert_migration "db/migrate/create_products.rb" do |migration| # assert_class_method :up, migration do |up| - # assert_match /create_table/, up + # assert_match(/create_table/, up) # end # end # @@ -161,7 +161,7 @@ module Rails # # assert_file "app/controller/products_controller.rb" do |controller| # assert_instance_method :index, content do |index| - # assert_match /Product\.all/, index + # assert_match(/Product\.all/, index) # end # end # diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml index d4138ca2f5..5c8780aa64 100644 --- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml @@ -1,4 +1,4 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html <% unless attributes.empty? -%> one: diff --git a/railties/test/application/asset_debugging_test.rb b/railties/test/application/asset_debugging_test.rb index 707abe7191..1b99af22a4 100644 --- a/railties/test/application/asset_debugging_test.rb +++ b/railties/test/application/asset_debugging_test.rb @@ -45,8 +45,8 @@ module ApplicationTests # the debug_assets params isn't used if compile is off get '/posts?debug_assets=true' - assert_match /<script src="\/assets\/application-([0-z]+)\.js" type="text\/javascript"><\/script>/, last_response.body - assert_no_match /<script src="\/assets\/xmlhr-([0-z]+)\.js" type="text\/javascript"><\/script>/, last_response.body + assert_match(/<script src="\/assets\/application-([0-z]+)\.js" type="text\/javascript"><\/script>/, last_response.body) + assert_no_match(/<script src="\/assets\/xmlhr-([0-z]+)\.js" type="text\/javascript"><\/script>/, last_response.body) end test "assets aren't concatened when compile is true is on and debug_assets params is true" do @@ -58,8 +58,8 @@ module ApplicationTests class ::PostsController < ActionController::Base ; end get '/posts?debug_assets=true' - assert_match /<script src="\/assets\/application-([0-z]+)\.js\?body=1" type="text\/javascript"><\/script>/, last_response.body - assert_match /<script src="\/assets\/xmlhr-([0-z]+)\.js\?body=1" type="text\/javascript"><\/script>/, last_response.body + assert_match(/<script src="\/assets\/application-([0-z]+)\.js\?body=1" type="text\/javascript"><\/script>/, last_response.body) + assert_match(/<script src="\/assets\/xmlhr-([0-z]+)\.js\?body=1" type="text\/javascript"><\/script>/, last_response.body) end end end diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index a412b7d99b..1e0a26918b 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -77,8 +77,8 @@ module ApplicationTests manifest = "#{app_path}/public/assets/manifest.yml" assets = YAML.load_file(manifest) - assert_match /application-([0-z]+)\.js/, assets["application.js"] - assert_match /application-([0-z]+)\.css/, assets["application.css"] + assert_match(/application-([0-z]+)\.js/, assets["application.js"]) + assert_match(/application-([0-z]+)\.css/, assets["application.css"]) end test "precompile creates a manifest file in a custom path with all the assets listed" do @@ -96,8 +96,8 @@ module ApplicationTests manifest = "#{app_path}/shared/manifest.yml" assets = YAML.load_file(manifest) - assert_match /application-([0-z]+)\.js/, assets["application.js"] - assert_match /application-([0-z]+)\.css/, assets["application.css"] + assert_match(/application-([0-z]+)\.js/, assets["application.js"]) + assert_match(/application-([0-z]+)\.css/, assets["application.css"]) end @@ -113,7 +113,7 @@ module ApplicationTests manifest = "#{app_path}/public/x/manifest.yml" assets = YAML.load_file(manifest) - assert_match /application-([0-z]+)\.js/, assets["application.js"] + assert_match(/application-([0-z]+)\.js/, assets["application.js"]) end test "precompile does not append asset digests when config.assets.digest is false" do @@ -176,8 +176,8 @@ module ApplicationTests class ::PostsController < ActionController::Base ; end get '/posts' - assert_match /AssetNotPrecompiledError/, last_response.body - assert_match /app.js isn't precompiled/, last_response.body + assert_match(/AssetNotPrecompiledError/, last_response.body) + assert_match(/app.js isn't precompiled/, last_response.body) end test "precompile appends the md5 hash to files referenced with asset_path and run in the provided RAILS_ENV" do @@ -189,7 +189,7 @@ module ApplicationTests Dir.chdir(app_path){ `bundle exec rake assets:precompile RAILS_ENV=test` } # end file = Dir["#{app_path}/public/assets/application-*.css"].first - assert_match /\/assets\/rails-([0-z]+)\.png/, File.read(file) + assert_match(/\/assets\/rails-([0-z]+)\.png/, File.read(file)) end test "precompile appends the md5 hash to files referenced with asset_path and run in production as default even using RAILS_GROUPS=assets" do @@ -201,7 +201,7 @@ module ApplicationTests Dir.chdir(app_path){ `bundle exec rake assets:precompile RAILS_GROUPS=assets` } end file = Dir["#{app_path}/public/assets/application-*.css"].first - assert_match /\/assets\/rails-([0-z]+)\.png/, File.read(file) + assert_match(/\/assets\/rails-([0-z]+)\.png/, File.read(file)) end test "assets are cleaned up properly" do diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index cc65a674c9..0e03c3dc2d 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -79,9 +79,9 @@ module ApplicationTests silence_stderr do output = Dir.chdir(app_path){ `rake test` } - assert_match /Errors running test:units! #<ActiveRecord::AdapterNotSpecified/, output - assert_match /Errors running test:functionals! #<RuntimeError/, output - assert_match /Errors running test:integration! #<RuntimeError/, output + assert_match(/Errors running test:units! #<ActiveRecord::AdapterNotSpecified/, output) + assert_match(/Errors running test:functionals! #<RuntimeError/, output) + assert_match(/Errors running test:integration! #<RuntimeError/, output) end end diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index b49945f153..9183945619 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -197,8 +197,8 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_file "app/helpers/bukkits/application_helper.rb", /module Bukkits\n module ApplicationHelper/ assert_file "app/views/layouts/bukkits/application.html.erb" do |contents| assert_match "<title>Bukkits</title>", contents - assert_match /stylesheet_link_tag\s+['"]bukkits\/application['"]/, contents - assert_match /javascript_include_tag\s+['"]bukkits\/application['"]/, contents + assert_match(/stylesheet_link_tag\s+['"]bukkits\/application['"]/, contents) + assert_match(/javascript_include_tag\s+['"]bukkits\/application['"]/, contents) end end @@ -241,7 +241,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase run_generator [destination_root, "--skip-test-unit"] assert_no_file "test" assert_file "bukkits.gemspec" do |contents| - assert_no_match /s.test_files = Dir\["test\/\*\*\/\*"\]/, contents + assert_no_match(/s.test_files = Dir\["test\/\*\*\/\*"\]/, contents) end end diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index d3074afd91..1534f0d828 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -191,11 +191,11 @@ module SharedCustomGeneratorTests end def test_builder_option_with_http - path = "http://gist.github.com/103208.txt" + url = "http://gist.github.com/103208.txt" template = "class #{builder_class}; end" template.instance_eval "def read; self; end" # Make the string respond to read - generator([destination_root], :builder => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) + generator([destination_root], :builder => url).expects(:open).with(url, 'Accept' => 'application/x-thor-template').returns(template) quietly { generator.invoke_all } default_files.each{ |path| assert_no_file(path) } diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 0ff1e0f180..06a60cd858 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -400,7 +400,7 @@ module RailtiesTest boot_rails get("/bukkits/posts/new") - assert_match /name="post\[title\]"/, last_response.body + assert_match(/name="post\[title\]"/, last_response.body) end test "isolated engine should set correct route module prefix for nested namespace" do diff --git a/railties/test/railties/shared_tests.rb b/railties/test/railties/shared_tests.rb index 9a64b7c64e..21fde49ff7 100644 --- a/railties/test/railties/shared_tests.rb +++ b/railties/test/railties/shared_tests.rb @@ -61,21 +61,21 @@ module RailtiesTest assert File.exists?("#{app_path}/db/migrate/2_create_users.rb") assert File.exists?("#{app_path}/db/migrate/3_add_last_name_to_users.rb") - assert_match /Copied migration 2_create_users.rb from bukkits/, output - assert_match /Copied migration 3_add_last_name_to_users.rb from bukkits/, output - assert_match /NOTE: Migration 3_create_sessions.rb from bukkits has been skipped/, output + assert_match(/Copied migration 2_create_users.rb from bukkits/, output) + assert_match(/Copied migration 3_add_last_name_to_users.rb from bukkits/, output) + assert_match(/NOTE: Migration 3_create_sessions.rb from bukkits has been skipped/, output) assert_equal 3, Dir["#{app_path}/db/migrate/*.rb"].length output = `bundle exec rake railties:install:migrations`.split("\n") assert File.exists?("#{app_path}/db/migrate/4_create_yaffles.rb") - assert_no_match /2_create_users/, output.join("\n") + assert_no_match(/2_create_users/, output.join("\n")) yaffle_migration_order = output.index(output.detect{|o| /Copied migration 4_create_yaffles.rb from acts_as_yaffle/ =~ o }) bukkits_migration_order = output.index(output.detect{|o| /NOTE: Migration 3_create_sessions.rb from bukkits has been skipped/ =~ o }) assert_not_nil yaffle_migration_order, "Expected migration to be copied" assert_not_nil bukkits_migration_order, "Expected migration to be skipped" - assert_equal (railties.index('acts_as_yaffle') > railties.index('bukkits')) , (yaffle_migration_order > bukkits_migration_order) + assert_equal(railties.index('acts_as_yaffle') > railties.index('bukkits'), yaffle_migration_order > bukkits_migration_order) migrations_count = Dir["#{app_path}/db/migrate/*.rb"].length output = `bundle exec rake railties:install:migrations` |