aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/generator_test.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2015-12-18 18:02:21 +1030
committerMatthew Draper <matthew@trebex.net>2015-12-18 18:02:21 +1030
commit46d1cc90be94307f313a3ab384bd176a5b7f58b3 (patch)
treeffcd8621849fcb5d7f914ac4ac67bd79151a843f /railties/test/generators/generator_test.rb
parent8f8cb1baa3b5609969805fcdd7295f3d7de2bd6b (diff)
downloadrails-46d1cc90be94307f313a3ab384bd176a5b7f58b3.tar.gz
rails-46d1cc90be94307f313a3ab384bd176a5b7f58b3.tar.bz2
rails-46d1cc90be94307f313a3ab384bd176a5b7f58b3.zip
Allow normal version updates within a release series
We originally chose to apply very strict versioning on the `rails` entry in the Gemfile, because our future versioning policy was not strongly defined. Now it is, and our policy is very much designed on the expectation that people will regularly update to the latest patch level in their release series... so we should encourage that. Of course, Gemfile.lock will do its job and prevent unplanned updates, just as it does for every other gem in the bundle... but if you run `bundle update`, we want to get you the latest bug/security fixes without requiring a manual edit of the Gemfile entry. Our current version could be a few different shapes, so it takes a bit of work to find the right specifier, but in principle, we match anything of the form x.y.*, where x.y matches our current release series.
Diffstat (limited to 'railties/test/generators/generator_test.rb')
-rw-r--r--railties/test/generators/generator_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/test/generators/generator_test.rb b/railties/test/generators/generator_test.rb
index 7871399dd7..8ef44a8dcb 100644
--- a/railties/test/generators/generator_test.rb
+++ b/railties/test/generators/generator_test.rb
@@ -80,6 +80,21 @@ module Rails
}
assert_equal gems.drop(2), generator.gemfile_entries
end
+
+ def test_recommended_rails_versions
+ klass = make_builder_class
+ generator = klass.start(['new', 'blah'])
+
+ specifier_for = -> v { generator.send(:rails_version_specifier, Gem::Version.new(v)) }
+
+ assert_equal '~> 4.1.13', specifier_for['4.1.13']
+ assert_equal ['>= 4.1.6.rc1', '< 4.2'], specifier_for['4.1.6.rc1']
+ assert_equal ['~> 4.1.7', '>= 4.1.7.1'], specifier_for['4.1.7.1']
+ assert_equal ['~> 4.1.7', '>= 4.1.7.1.2'], specifier_for['4.1.7.1.2']
+ assert_equal ['>= 4.1.7.1.rc2', '< 4.2'], specifier_for['4.1.7.1.rc2']
+ assert_equal ['>= 4.2.0.beta1', '< 4.3'], specifier_for['4.2.0.beta1']
+ assert_equal ['>= 5.0.0.beta1', '< 5.1'], specifier_for['5.0.0.beta1']
+ end
end
end
end