diff options
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/argv_scrubber_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 34 |
2 files changed, 35 insertions, 1 deletions
diff --git a/railties/test/generators/argv_scrubber_test.rb b/railties/test/generators/argv_scrubber_test.rb index a94350cbd7..31e07bc8da 100644 --- a/railties/test/generators/argv_scrubber_test.rb +++ b/railties/test/generators/argv_scrubber_test.rb @@ -16,7 +16,7 @@ module Rails output = nil exit_code = nil scrubber.extend(Module.new { - define_method(:puts) { |str| output = str } + define_method(:puts) { |string| output = string } define_method(:exit) { |code| exit_code = code } }) scrubber.prepare! diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 853af80111..69ff23eb95 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -371,6 +371,40 @@ class PluginGeneratorTest < Rails::Generators::TestCase end end + def test_git_name_and_email_in_gemspec_file + name = `git config user.name`.chomp rescue "TODO: Write your name" + email = `git config user.email`.chomp rescue "TODO: Write your email address" + + run_generator [destination_root] + assert_file "bukkits.gemspec" do |contents| + assert_match(/#{Regexp.escape(name)}/, contents) + assert_match(/#{Regexp.escape(email)}/, contents) + end + end + + def test_git_name_in_license_file + name = `git config user.name`.chomp rescue "TODO: Write your name" + + run_generator [destination_root] + assert_file "MIT-LICENSE" do |contents| + assert_match(/#{Regexp.escape(name)}/, contents) + end + end + + def test_no_details_from_git_when_skip_git + name = "TODO: Write your name" + email = "TODO: Write your email address" + + run_generator [destination_root, '--skip-git'] + assert_file "MIT-LICENSE" do |contents| + assert_match(/#{Regexp.escape(name)}/, contents) + end + assert_file "bukkits.gemspec" do |contents| + assert_match(/#{Regexp.escape(name)}/, contents) + assert_match(/#{Regexp.escape(email)}/, contents) + end + end + protected def action(*args, &block) silence(:stdout){ generator.send(*args, &block) } |