aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-11-04 14:55:21 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2013-11-04 15:00:29 -0800
commit8beb42cfbc41753ae4dbb91e16abcd1fb7d00356 (patch)
tree2cd40dbc7ef1e06e4b6cf61665e82a08615a5b53 /railties/test
parent37d4bfbfd9c49cdddcafdc135165b2d6932b074a (diff)
downloadrails-8beb42cfbc41753ae4dbb91e16abcd1fb7d00356.tar.gz
rails-8beb42cfbc41753ae4dbb91e16abcd1fb7d00356.tar.bz2
rails-8beb42cfbc41753ae4dbb91e16abcd1fb7d00356.zip
gems can be added or skipped from the template
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/app_generator_test.rb26
-rw-r--r--railties/test/generators/generator_test.rb1
2 files changed, 27 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index cbcfe48f71..bd8efcc6c7 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -156,6 +156,32 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
+ def test_add_gemfile_entry
+ template = Tempfile.open 'my_template'
+ template.puts 'gemfile_entry "tenderlove"'
+ template.flush
+
+ run_generator([destination_root, "-m", template.path])
+ assert_file "Gemfile", /tenderlove/
+ ensure
+ template.close
+ template.unlink
+ end
+
+ def test_add_skip_entry
+ template = Tempfile.open 'my_template'
+ template.puts 'add_gem_entry_filter { |gem| gem.name != "jbuilder" }'
+ template.flush
+
+ run_generator([destination_root, "-m", template.path])
+ assert_file "Gemfile" do |contents|
+ assert_no_match 'jbuilder', contents
+ end
+ ensure
+ template.close
+ template.unlink
+ end
+
def test_config_another_database
run_generator([destination_root, "-d", "mysql"])
assert_file "config/database.yml", /mysql/
diff --git a/railties/test/generators/generator_test.rb b/railties/test/generators/generator_test.rb
index 7871399dd7..94d2c1bf50 100644
--- a/railties/test/generators/generator_test.rb
+++ b/railties/test/generators/generator_test.rb
@@ -1,6 +1,7 @@
require 'active_support/test_case'
require 'active_support/testing/autorun'
require 'rails/generators/app_base'
+require 'rails/generators/rails/app/app_generator'
module Rails
module Generators