Skip to content

Commit b930670

Browse files
committed
Correctly detect Rails version when using only parts of the framework
Follow up rubocop/rubocop#11289. This commit fixes the following failed tests. ```console % bundle exec rake (snip) Failures: 1) RuboCop::Config#target_rails_version when TargetRailsVersion is not set and gems.locked exists uses the single digit Rails version in gems.locked Failure/Error: expect(configuration.target_rails_version).to eq 4.1 expected: 4.1 got: 5.0 (compared using ==) # ./spec/rubocop/config_spec.rb:88:in `block (6 levels) in <top (required)>' 2) RuboCop::Config#target_rails_version when TargetRailsVersion is not set and gems.locked exists uses the multi digit Rails version in gems.locked Failure/Error: expect(configuration.target_rails_version).to eq 400.33 expected: 400.33 got: 5.0 (compared using ==) # ./spec/rubocop/config_spec.rb:122:in `block (6 levels) in <top (required)>' 3) RuboCop::Config#target_rails_version when TargetRailsVersion is not set and Gemfile.lock exists uses the multi digit Rails version in Gemfile.lock Failure/Error: expect(configuration.target_rails_version).to eq 400.33 expected: 400.33 got: 5.0 (compared using ==) # ./spec/rubocop/config_spec.rb:122:in `block (6 levels) in <top (required)>' 4) RuboCop::Config#target_rails_version when TargetRailsVersion is not set and Gemfile.lock exists uses the single digit Rails version in Gemfile.lock Failure/Error: expect(configuration.target_rails_version).to eq 4.1 expected: 4.1 got: 5.0 (compared using ==) # ./spec/rubocop/config_spec.rb:88:in `block (6 levels) in <top (required)>' Finished in 0.05343 seconds (files took 1.28 seconds to load) 11 examples, 4 failures Failed examples: rspec './spec/rubocop/config_spec.rb[1:1:2:3:1]' # RuboCop::Config#target_rails_version when TargetRailsVersion is not set and gems.locked exists uses the single digit Rails version in gems.locked rspec './spec/rubocop/config_spec.rb[1:1:2:3:2]' # RuboCop::Config#target_rails_version when TargetRailsVersion is not set and gems.locked exists uses the multi digit Rails version in gems.locked rspec './spec/rubocop/config_spec.rb[1:1:2:2:2]' # RuboCop::Config#target_rails_version when TargetRailsVersion is not set and Gemfile.lock exists uses the multi digit Rails version in Gemfile.lock rspec './spec/rubocop/config_spec.rb[1:1:2:2:1]' # RuboCop::Config#target_rails_version when TargetRailsVersion is not set and Gemfile.lock exists uses the single digit Rails version in Gemfile.lock ```
1 parent b9f852b commit b930670

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

spec/rubocop/config_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
bundler (>= 1.3.0, < 2.0)
7575
railties (= 4.1.0)
7676
sprockets-rails (~> 2.0)
77+
railties (4.1.0)
7778
7879
PLATFORMS
7980
ruby
@@ -108,6 +109,7 @@
108109
bundler (>= 1.3.0, < 2.0)
109110
railties (= 4.1.0)
110111
sprockets-rails (~> 2.0)
112+
railties (400.33.22)
111113
112114
PLATFORMS
113115
ruby

0 commit comments

Comments
 (0)