diff options
author | Marin Jankovski <marin@gitlab.com> | 2016-01-29 08:12:18 +0000 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2016-01-29 08:12:18 +0000 |
commit | 9d0065f05455e1f9146ab30a3aaf903472c9b8f4 (patch) | |
tree | 3e43624c81f66e5dfcba4d9c55a80c99ceec4177 /spec/models | |
parent | 92c04ecbd7308b7ccb53bb4a8adac8706285f481 (diff) | |
parent | 6e4d36b49d7fc9c41e136f234c6b5dd74a86df50 (diff) | |
download | gitlab-ce-9d0065f05455e1f9146ab30a3aaf903472c9b8f4.tar.gz |
Merge branch 'hotfix/ruby-21-broken-update' into 'master'
fix syntax error on 2.1 and rubocop on 2.2
Background:
Hashes `{:'key': 'value'}` are not valid in 2.1 but are recommended by Rubocop on 2.2. We only use those when we have a key such as `weird-key`, `weird.key`, etc...
We could disable Rubocop but it wouldn't warn us about the recommended syntax since `Ruby 1.9`: `{key: 'value'}`, which is valid for `Ruby 1.9+`.
Workaround 1 could be disabling `Style/HashSyntax:` in `rubocop.yml`.
Workaround 2 (tried in this MR) is to trick Rubocop using `.to_sym` which is effectively the same as adding the `:`. This would allow to keep the warning in place.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/12801
See merge request !2637
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/case_sensitivity_spec.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/models/concerns/case_sensitivity_spec.rb b/spec/models/concerns/case_sensitivity_spec.rb index 6535246bf2d..92fdc5cd65d 100644 --- a/spec/models/concerns/case_sensitivity_spec.rb +++ b/spec/models/concerns/case_sensitivity_spec.rb @@ -37,7 +37,7 @@ describe CaseSensitivity, models: true do with(%q{LOWER("foo"."bar") = LOWER(:value)}, value: 'bar'). and_return(criteria) - expect(model.iwhere('foo.bar': 'bar')).to eq(criteria) + expect(model.iwhere('foo.bar'.to_sym => 'bar')).to eq(criteria) end end @@ -87,8 +87,8 @@ describe CaseSensitivity, models: true do with(%q{LOWER("foo"."baz") = LOWER(:value)}, value: 'baz'). and_return(final) - got = model.iwhere('foo.bar': 'bar', - 'foo.baz': 'baz') + got = model.iwhere('foo.bar'.to_sym => 'bar', + 'foo.baz'.to_sym => 'baz') expect(got).to eq(final) end @@ -127,7 +127,7 @@ describe CaseSensitivity, models: true do with(%q{`foo`.`bar` = :value}, value: 'bar'). and_return(criteria) - expect(model.iwhere('foo.bar': 'bar')). + expect(model.iwhere('foo.bar'.to_sym => 'bar')). to eq(criteria) end end @@ -178,8 +178,8 @@ describe CaseSensitivity, models: true do with(%q{`foo`.`baz` = :value}, value: 'baz'). and_return(final) - got = model.iwhere('foo.bar': 'bar', - 'foo.baz': 'baz') + got = model.iwhere('foo.bar'.to_sym => 'bar', + 'foo.baz'.to_sym => 'baz') expect(got).to eq(final) end |