diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 61a4d2f347..69ff23eb95 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -372,11 +372,8 @@ class PluginGeneratorTest < Rails::Generators::TestCase end def test_git_name_and_email_in_gemspec_file - name = `git config user.name`.chomp rescue '' - name = "TODO: Write your name" if name.blank? - - email = `git config user.email`.chomp rescue '' - email = "TODO: Write your email address" if email.blank? + 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| @@ -385,9 +382,8 @@ class PluginGeneratorTest < Rails::Generators::TestCase end end - def test_git_name_in_licence_file - name = `git config user.name`.chomp rescue '' - name = "TODO: Write your name" if name.blank? + 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| @@ -395,6 +391,20 @@ class PluginGeneratorTest < Rails::Generators::TestCase 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) } |