aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/plugin_new_generator_test.rb
diff options
context:
space:
mode:
authorFred Wu <ifredwu@gmail.com>2012-06-05 15:49:40 +1000
committerFred Wu <ifredwu@gmail.com>2012-06-05 15:49:40 +1000
commit126586a5e61ec2026843c14606d1b7e2f8bbe7b7 (patch)
tree9592fad6c186cea4a5c4aa8104e1f6c14ba6f9eb /railties/test/generators/plugin_new_generator_test.rb
parent2186540f9160b47e075b9926d12d3a6843e95d31 (diff)
downloadrails-126586a5e61ec2026843c14606d1b7e2f8bbe7b7.tar.gz
rails-126586a5e61ec2026843c14606d1b7e2f8bbe7b7.tar.bz2
rails-126586a5e61ec2026843c14606d1b7e2f8bbe7b7.zip
Fixed the Gemfile when gemspec is skipped in the 'rails plugin new' command
Diffstat (limited to 'railties/test/generators/plugin_new_generator_test.rb')
-rw-r--r--railties/test/generators/plugin_new_generator_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb
index 58740978aa..f7dffe9a5c 100644
--- a/railties/test/generators/plugin_new_generator_test.rb
+++ b/railties/test/generators/plugin_new_generator_test.rb
@@ -269,6 +269,32 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
def test_skipping_gemspec
run_generator [destination_root, "--skip-gemspec"]
assert_no_file "bukkits.gemspec"
+ assert_file "Gemfile" do |contents|
+ assert_no_match('gemspec', contents)
+ assert_match(/gem "rails", "~> #{Rails::VERSION::STRING}"/, contents)
+ assert_match(/group :development do\n gem "sqlite3"\nend/, contents)
+ assert_no_match(/# gem "jquery-rails"/, contents)
+ end
+ end
+
+ def test_skipping_gemspec_in_full_mode
+ run_generator [destination_root, "--skip-gemspec", "--full"]
+ assert_no_file "bukkits.gemspec"
+ assert_file "Gemfile" do |contents|
+ assert_no_match('gemspec', contents)
+ assert_match(/gem "rails", "~> #{Rails::VERSION::STRING}"/, contents)
+ assert_match(/group :development do\n gem "sqlite3"\nend/, contents)
+ assert_match(/# gem "jquery-rails"/, contents)
+ assert_no_match(/# jquery-rails is used by the dummy application\ngem "jquery-rails"/, contents)
+ end
+ end
+
+ def test_skipping_gemspec_in_full_mode_with_javascript_option
+ run_generator [destination_root, "--skip-gemspec", "--full", "--javascript=prototype"]
+ assert_file "Gemfile" do |contents|
+ assert_match(/# gem "prototype-rails"/, contents)
+ assert_match(/# jquery-rails is used by the dummy application\ngem "jquery-rails"/, contents)
+ end
end
def test_creating_plugin_in_app_directory_adds_gemfile_entry