diff options
author | Roman Shmatov <romanshmatov@gmail.com> | 2013-04-12 10:51:52 +0600 |
---|---|---|
committer | Arun Agrawal <arunagw@gmail.com> | 2014-05-02 15:38:56 +0200 |
commit | e8c310edf6b69e5250a50e44e1605b495ae6ba03 (patch) | |
tree | 625b9c1e567c4bcb825b258984b7d547455c3e28 /railties/test/generators | |
parent | 65b551466bb6eaff933454279fdedfe1e2160b19 (diff) | |
download | rails-e8c310edf6b69e5250a50e44e1605b495ae6ba03.tar.gz rails-e8c310edf6b69e5250a50e44e1605b495ae6ba03.tar.bz2 rails-e8c310edf6b69e5250a50e44e1605b495ae6ba03.zip |
Works correctly if git not installed
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 853af80111..61a4d2f347 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -371,6 +371,30 @@ class PluginGeneratorTest < Rails::Generators::TestCase end 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? + + 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_licence_file + name = `git config user.name`.chomp rescue '' + name = "TODO: Write your name" if name.blank? + + run_generator [destination_root] + assert_file "MIT-LICENSE" do |contents| + assert_match(/#{Regexp.escape(name)}/, contents) + end + end + protected def action(*args, &block) silence(:stdout){ generator.send(*args, &block) } |