diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-10-29 22:07:13 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-10-29 22:09:23 -0200 |
commit | 67417f18215349cad990b1230ecf591b5509d557 (patch) | |
tree | ee103f76c6d5ea0c380986ab666d295346164828 /railties/test | |
parent | 8941831733fc56e2b1872f41c85cc48d782bb984 (diff) | |
download | rails-67417f18215349cad990b1230ecf591b5509d557.tar.gz rails-67417f18215349cad990b1230ecf591b5509d557.tar.bz2 rails-67417f18215349cad990b1230ecf591b5509d557.zip |
Add version constraint to database gem in generated application
We are using the same version constraint in the database adapters so
when a new version of the adapter that doesn't work with the version of
rails is released we don't break new applications.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index e5f10a89d3..446fef562b 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -264,7 +264,7 @@ class AppGeneratorTest < Rails::Generators::TestCase if defined?(JRUBY_VERSION) assert_gem "activerecord-jdbcmysql-adapter" else - assert_gem "mysql2" + assert_gem "mysql2", "'>= 0.3.18', '< 0.5'" end end @@ -279,7 +279,7 @@ class AppGeneratorTest < Rails::Generators::TestCase if defined?(JRUBY_VERSION) assert_gem "activerecord-jdbcpostgresql-adapter" else - assert_gem "pg" + assert_gem "pg", "'~> 0.18'" end end @@ -686,7 +686,11 @@ class AppGeneratorTest < Rails::Generators::TestCase capture(:stdout) { generator.send(*args, &block) } end - def assert_gem(gem) - assert_file "Gemfile", /^\s*gem\s+["']#{gem}["']$*/ + def assert_gem(gem, constraint = nil) + if constraint + assert_file "Gemfile", /^\s*gem\s+["']#{gem}["'], #{constraint}$*/ + else + assert_file "Gemfile", /^\s*gem\s+["']#{gem}["']$*/ + end end end |