BigW Consortium Gitlab

Commit 9d0065f0 by Marin Jankovski

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
parents 92c04ecb 6e4d36b4
......@@ -152,7 +152,7 @@ module CommitsHelper
options = {
class: "commit-#{options[:source]}-link has_tooltip",
data: { 'original-title': sanitize(source_email) }
data: { 'original-title'.to_sym => sanitize(source_email) }
}
if user.nil?
......
......@@ -40,7 +40,7 @@ module ProjectsHelper
link_to(author_html, user_path(author), class: "author_link").html_safe
else
title = opts[:title].sub(":name", sanitize(author.name))
link_to(author_html, user_path(author), class: "author_link has_tooltip", data: { 'original-title': title, container: 'body' } ).html_safe
link_to(author_html, user_path(author), class: "author_link has_tooltip", data: { 'original-title'.to_sym => title, container: 'body' } ).html_safe
end
end
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment