Commit c10064aa authored by Douwe Maan's avatar Douwe Maan

Enable Style/SpaceInsideBrackets

parent b7d8df50
...@@ -413,6 +413,9 @@ Style/SpaceBeforeComment: ...@@ -413,6 +413,9 @@ Style/SpaceBeforeComment:
Style/SpaceBeforeSemicolon: Style/SpaceBeforeSemicolon:
Enabled: true Enabled: true
Style/SpaceInsideBrackets:
Enabled: true
# Use spaces inside hash literal braces - or don't. # Use spaces inside hash literal braces - or don't.
Style/SpaceInsideHashLiteralBraces: Style/SpaceInsideHashLiteralBraces:
Enabled: true Enabled: true
......
...@@ -729,11 +729,6 @@ Style/SpaceInLambdaLiteral: ...@@ -729,11 +729,6 @@ Style/SpaceInLambdaLiteral:
Style/SpaceInsideBlockBraces: Style/SpaceInsideBlockBraces:
Enabled: false Enabled: false
# Offense count: 120
# Cop supports --auto-correct.
Style/SpaceInsideBrackets:
Enabled: false
# Offense count: 90 # Offense count: 90
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/SpaceInsideParens: Style/SpaceInsideParens:
......
...@@ -37,8 +37,8 @@ module SubmoduleHelper ...@@ -37,8 +37,8 @@ module SubmoduleHelper
end end
def self_url?(url, namespace, project) def self_url?(url, namespace, project)
return true if url == [ Gitlab.config.gitlab.url, '/', namespace, '/', return true if url == [Gitlab.config.gitlab.url, '/', namespace, '/',
project, '.git' ].join('') project, '.git'].join('')
url == gitlab_shell.url_to_repo([namespace, '/', project].join('')) url == gitlab_shell.url_to_repo([namespace, '/', project].join(''))
end end
...@@ -48,8 +48,8 @@ module SubmoduleHelper ...@@ -48,8 +48,8 @@ module SubmoduleHelper
end end
def standard_links(host, namespace, project, commit) def standard_links(host, namespace, project, commit)
base = [ 'https://', host, '/', namespace, '/', project ].join('') base = ['https://', host, '/', namespace, '/', project].join('')
[base, [ base, '/tree/', commit ].join('')] [base, [base, '/tree/', commit].join('')]
end end
def relative_self_links(url, commit) def relative_self_links(url, commit)
......
...@@ -68,7 +68,7 @@ module Issuable ...@@ -68,7 +68,7 @@ module Issuable
scope :without_label, -> { joins("LEFT OUTER JOIN label_links ON label_links.target_type = '#{name}' AND label_links.target_id = #{table_name}.id").where(label_links: { id: nil }) } scope :without_label, -> { joins("LEFT OUTER JOIN label_links ON label_links.target_type = '#{name}' AND label_links.target_id = #{table_name}.id").where(label_links: { id: nil }) }
scope :join_project, -> { joins(:project) } scope :join_project, -> { joins(:project) }
scope :inc_notes_with_associations, -> { includes(notes: [ :project, :author, :award_emoji ]) } scope :inc_notes_with_associations, -> { includes(notes: [:project, :author, :award_emoji]) }
scope :references_project, -> { references(:project) } scope :references_project, -> { references(:project) }
scope :non_archived, -> { join_project.where(projects: { archived: false }) } scope :non_archived, -> { join_project.where(projects: { archived: false }) }
......
...@@ -5,6 +5,6 @@ module ReactiveService ...@@ -5,6 +5,6 @@ module ReactiveService
include ReactiveCaching include ReactiveCaching
# Default cache key: class name + project_id # Default cache key: class name + project_id
self.reactive_cache_key = ->(service) { [ service.class.model_name.singular, service.project_id ] } self.reactive_cache_key = ->(service) { [service.class.model_name.singular, service.project_id] }
end end
end end
...@@ -3,7 +3,7 @@ class KubernetesService < DeploymentService ...@@ -3,7 +3,7 @@ class KubernetesService < DeploymentService
include Gitlab::Kubernetes include Gitlab::Kubernetes
include ReactiveCaching include ReactiveCaching
self.reactive_cache_key = ->(service) { [ service.class.model_name.singular, service.project_id ] } self.reactive_cache_key = ->(service) { [service.class.model_name.singular, service.project_id] }
# Namespace defaults to the project path, but can be overridden in case that # Namespace defaults to the project path, but can be overridden in case that
# is an invalid or inappropriate name # is an invalid or inappropriate name
...@@ -167,7 +167,7 @@ class KubernetesService < DeploymentService ...@@ -167,7 +167,7 @@ class KubernetesService < DeploymentService
url = URI.parse(api_url) url = URI.parse(api_url)
prefix = url.path.sub(%r{/+\z}, '') prefix = url.path.sub(%r{/+\z}, '')
url.path = [ prefix, *parts ].join("/") url.path = [prefix, *parts].join("/")
url.to_s url.to_s
end end
......
...@@ -19,7 +19,7 @@ class Settings < Settingslogic ...@@ -19,7 +19,7 @@ class Settings < Settingslogic
else else
custom_port = ":#{gitlab.port}" custom_port = ":#{gitlab.port}"
end end
[ gitlab.protocol, [gitlab.protocol,
"://", "://",
gitlab.host, gitlab.host,
custom_port, custom_port,
...@@ -80,7 +80,7 @@ class Settings < Settingslogic ...@@ -80,7 +80,7 @@ class Settings < Settingslogic
def base_url(config) def base_url(config)
custom_port = on_standard_port?(config) ? nil : ":#{config.port}" custom_port = on_standard_port?(config) ? nil : ":#{config.port}"
[ config.protocol, [config.protocol,
"://", "://",
config.host, config.host,
custom_port custom_port
......
...@@ -24,7 +24,7 @@ Devise.setup do |config| ...@@ -24,7 +24,7 @@ Devise.setup do |config|
# session. If you need permissions, you should implement that in a before filter. # session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether # You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present. # or not authentication should be aborted when the value is not present.
config.authentication_keys = [ :login ] config.authentication_keys = [:login]
# Configure parameters from the request object used for authentication. Each entry # Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the # given should be a request method and it will automatically be passed to the
...@@ -36,12 +36,12 @@ Devise.setup do |config| ...@@ -36,12 +36,12 @@ Devise.setup do |config|
# Configure which authentication keys should be case-insensitive. # Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used # These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email. # to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [ :email ] config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped. # Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or # These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email. # modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [ :email ] config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default. # Tell if authentication through request.params is enabled. True by default.
# config.params_authenticatable = true # config.params_authenticatable = true
...@@ -124,7 +124,7 @@ Devise.setup do |config| ...@@ -124,7 +124,7 @@ Devise.setup do |config|
config.lock_strategy = :failed_attempts config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account # Defines which key will be used when locking and unlocking an account
config.unlock_keys = [ :email ] config.unlock_keys = [:email]
# Defines which strategy will be used to unlock an account. # Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email # :email = Sends an unlock link to the user email
......
...@@ -21,4 +21,4 @@ gitlab_trusted_proxies = Array(Gitlab.config.gitlab.trusted_proxies).map do |pro ...@@ -21,4 +21,4 @@ gitlab_trusted_proxies = Array(Gitlab.config.gitlab.trusted_proxies).map do |pro
end.compact end.compact
Rails.application.config.action_dispatch.trusted_proxies = ( Rails.application.config.action_dispatch.trusted_proxies = (
[ '127.0.0.1', '::1' ] + gitlab_trusted_proxies) ['127.0.0.1', '::1'] + gitlab_trusted_proxies)
...@@ -114,7 +114,7 @@ module API ...@@ -114,7 +114,7 @@ module API
private private
def install_error_responders(base) def install_error_responders(base)
error_classes = [ MissingTokenError, TokenNotFoundError, error_classes = [MissingTokenError, TokenNotFoundError,
ExpiredError, RevokedError, InsufficientScopeError] ExpiredError, RevokedError, InsufficientScopeError]
base.send :rescue_from, *error_classes, oauth2_bearer_token_error_handler base.send :rescue_from, *error_classes, oauth2_bearer_token_error_handler
......
...@@ -15,7 +15,7 @@ module API ...@@ -15,7 +15,7 @@ module API
requires :"#{awardable_id_string}", type: Integer, desc: "The ID of an Issue, Merge Request or Snippet" requires :"#{awardable_id_string}", type: Integer, desc: "The ID of an Issue, Merge Request or Snippet"
end end
[ ":id/#{awardable_string}/:#{awardable_id_string}/award_emoji", [":id/#{awardable_string}/:#{awardable_id_string}/award_emoji",
":id/#{awardable_string}/:#{awardable_id_string}/notes/:note_id/award_emoji" ":id/#{awardable_string}/:#{awardable_id_string}/notes/:note_id/award_emoji"
].each do |endpoint| ].each do |endpoint|
......
...@@ -19,7 +19,7 @@ module API ...@@ -19,7 +19,7 @@ module API
optional :visibility_level, type: Integer, values: [ optional :visibility_level, type: Integer, values: [
Gitlab::VisibilityLevel::PRIVATE, Gitlab::VisibilityLevel::PRIVATE,
Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::INTERNAL,
Gitlab::VisibilityLevel::PUBLIC ], desc: 'Create a public project. The same as visibility_level = 20.' Gitlab::VisibilityLevel::PUBLIC], desc: 'Create a public project. The same as visibility_level = 20.'
optional :public_builds, type: Boolean, desc: 'Perform public builds' optional :public_builds, type: Boolean, desc: 'Perform public builds'
optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access' optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access'
optional :only_allow_merge_if_build_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed' optional :only_allow_merge_if_build_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed'
......
...@@ -45,7 +45,7 @@ module API ...@@ -45,7 +45,7 @@ module API
requires :sha, type: String, desc: 'The commit, branch name, or tag name' requires :sha, type: String, desc: 'The commit, branch name, or tag name'
requires :filepath, type: String, desc: 'The path to the file to display' requires :filepath, type: String, desc: 'The path to the file to display'
end end
get [ ":id/repository/blobs/:sha", ":id/repository/commits/:sha/blob" ] do get [":id/repository/blobs/:sha", ":id/repository/commits/:sha/blob"] do
repo = user_project.repository repo = user_project.repository
commit = repo.commit(params[:sha]) commit = repo.commit(params[:sha])
......
...@@ -20,7 +20,7 @@ module API ...@@ -20,7 +20,7 @@ module API
optional :visibility_level, type: Integer, values: [ optional :visibility_level, type: Integer, values: [
Gitlab::VisibilityLevel::PRIVATE, Gitlab::VisibilityLevel::PRIVATE,
Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::INTERNAL,
Gitlab::VisibilityLevel::PUBLIC ], desc: 'Create a public project. The same as visibility_level = 20.' Gitlab::VisibilityLevel::PUBLIC], desc: 'Create a public project. The same as visibility_level = 20.'
optional :public_builds, type: Boolean, desc: 'Perform public builds' optional :public_builds, type: Boolean, desc: 'Perform public builds'
optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access' optional :request_access_enabled, type: Boolean, desc: 'Allow users to request member access'
optional :only_allow_merge_if_build_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed' optional :only_allow_merge_if_build_succeeds, type: Boolean, desc: 'Only allow to merge if builds succeed'
......
...@@ -55,7 +55,7 @@ describe IssuesHelper do ...@@ -55,7 +55,7 @@ describe IssuesHelper do
describe "merge_requests_sentence" do describe "merge_requests_sentence" do
subject { merge_requests_sentence(merge_requests)} subject { merge_requests_sentence(merge_requests)}
let(:merge_requests) do let(:merge_requests) do
[ build(:merge_request, iid: 1), build(:merge_request, iid: 2), [build(:merge_request, iid: 1), build(:merge_request, iid: 2),
build(:merge_request, iid: 3)] build(:merge_request, iid: 3)]
end end
......
...@@ -20,97 +20,97 @@ describe SubmoduleHelper do ...@@ -20,97 +20,97 @@ describe SubmoduleHelper do
it 'detects ssh on standard port' do it 'detects ssh on standard port' do
allow(Gitlab.config.gitlab_shell).to receive(:ssh_port).and_return(22) # set this just to be sure allow(Gitlab.config.gitlab_shell).to receive(:ssh_port).and_return(22) # set this just to be sure
allow(Gitlab.config.gitlab_shell).to receive(:ssh_path_prefix).and_return(Settings.send(:build_gitlab_shell_ssh_path_prefix)) allow(Gitlab.config.gitlab_shell).to receive(:ssh_path_prefix).and_return(Settings.send(:build_gitlab_shell_ssh_path_prefix))
stub_url([ config.user, '@', config.host, ':gitlab-org/gitlab-ce.git' ].join('')) stub_url([config.user, '@', config.host, ':gitlab-org/gitlab-ce.git'].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ]) expect(submodule_links(submodule_item)).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')])
end end
it 'detects ssh on non-standard port' do it 'detects ssh on non-standard port' do
allow(Gitlab.config.gitlab_shell).to receive(:ssh_port).and_return(2222) allow(Gitlab.config.gitlab_shell).to receive(:ssh_port).and_return(2222)
allow(Gitlab.config.gitlab_shell).to receive(:ssh_path_prefix).and_return(Settings.send(:build_gitlab_shell_ssh_path_prefix)) allow(Gitlab.config.gitlab_shell).to receive(:ssh_path_prefix).and_return(Settings.send(:build_gitlab_shell_ssh_path_prefix))
stub_url([ 'ssh://', config.user, '@', config.host, ':2222/gitlab-org/gitlab-ce.git' ].join('')) stub_url(['ssh://', config.user, '@', config.host, ':2222/gitlab-org/gitlab-ce.git'].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ]) expect(submodule_links(submodule_item)).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')])
end end
it 'detects http on standard port' do it 'detects http on standard port' do
allow(Gitlab.config.gitlab).to receive(:port).and_return(80) allow(Gitlab.config.gitlab).to receive(:port).and_return(80)
allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url)) allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, '/gitlab-org/gitlab-ce.git' ].join('')) stub_url(['http://', config.host, '/gitlab-org/gitlab-ce.git'].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ]) expect(submodule_links(submodule_item)).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')])
end end
it 'detects http on non-standard port' do it 'detects http on non-standard port' do
allow(Gitlab.config.gitlab).to receive(:port).and_return(3000) allow(Gitlab.config.gitlab).to receive(:port).and_return(3000)
allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url)) allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, ':3000/gitlab-org/gitlab-ce.git' ].join('')) stub_url(['http://', config.host, ':3000/gitlab-org/gitlab-ce.git'].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ]) expect(submodule_links(submodule_item)).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')])
end end
it 'works with relative_url_root' do it 'works with relative_url_root' do
allow(Gitlab.config.gitlab).to receive(:port).and_return(80) # set this just to be sure allow(Gitlab.config.gitlab).to receive(:port).and_return(80) # set this just to be sure
allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return('/gitlab/root') allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return('/gitlab/root')
allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url)) allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, '/gitlab/root/gitlab-org/gitlab-ce.git' ].join('')) stub_url(['http://', config.host, '/gitlab/root/gitlab-org/gitlab-ce.git'].join(''))
expect(submodule_links(submodule_item)).to eq([ namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash') ]) expect(submodule_links(submodule_item)).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')])
end end
end end
context 'submodule on github.com' do context 'submodule on github.com' do
it 'detects ssh' do it 'detects ssh' do
stub_url('git@github.com:gitlab-org/gitlab-ce.git') stub_url('git@github.com:gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ]) expect(submodule_links(submodule_item)).to eq(['https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash'])
end end
it 'detects http' do it 'detects http' do
stub_url('http://github.com/gitlab-org/gitlab-ce.git') stub_url('http://github.com/gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ]) expect(submodule_links(submodule_item)).to eq(['https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash'])
end end
it 'detects https' do it 'detects https' do
stub_url('https://github.com/gitlab-org/gitlab-ce.git') stub_url('https://github.com/gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ]) expect(submodule_links(submodule_item)).to eq(['https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash'])
end end
it 'returns original with non-standard url' do it 'returns original with non-standard url' do
stub_url('http://github.com/gitlab-org/gitlab-ce') stub_url('http://github.com/gitlab-org/gitlab-ce')
expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ]) expect(submodule_links(submodule_item)).to eq([repo.submodule_url_for, nil])
stub_url('http://github.com/another/gitlab-org/gitlab-ce.git') stub_url('http://github.com/another/gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ]) expect(submodule_links(submodule_item)).to eq([repo.submodule_url_for, nil])
end end
end end
context 'submodule on gitlab.com' do context 'submodule on gitlab.com' do
it 'detects ssh' do it 'detects ssh' do
stub_url('git@gitlab.com:gitlab-org/gitlab-ce.git') stub_url('git@gitlab.com:gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ]) expect(submodule_links(submodule_item)).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash'])
end end
it 'detects http' do it 'detects http' do
stub_url('http://gitlab.com/gitlab-org/gitlab-ce.git') stub_url('http://gitlab.com/gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ]) expect(submodule_links(submodule_item)).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash'])
end end
it 'detects https' do it 'detects https' do
stub_url('https://gitlab.com/gitlab-org/gitlab-ce.git') stub_url('https://gitlab.com/gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ]) expect(submodule_links(submodule_item)).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash'])
end end
it 'returns original with non-standard url' do it 'returns original with non-standard url' do
stub_url('http://gitlab.com/gitlab-org/gitlab-ce') stub_url('http://gitlab.com/gitlab-org/gitlab-ce')
expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ]) expect(submodule_links(submodule_item)).to eq([repo.submodule_url_for, nil])
stub_url('http://gitlab.com/another/gitlab-org/gitlab-ce.git') stub_url('http://gitlab.com/another/gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ]) expect(submodule_links(submodule_item)).to eq([repo.submodule_url_for, nil])
end end
end end
context 'submodule on unsupported' do context 'submodule on unsupported' do
it 'returns original' do it 'returns original' do
stub_url('http://mygitserver.com/gitlab-org/gitlab-ce') stub_url('http://mygitserver.com/gitlab-org/gitlab-ce')
expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ]) expect(submodule_links(submodule_item)).to eq([repo.submodule_url_for, nil])
stub_url('http://mygitserver.com/gitlab-org/gitlab-ce.git') stub_url('http://mygitserver.com/gitlab-org/gitlab-ce.git')
expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ]) expect(submodule_links(submodule_item)).to eq([repo.submodule_url_for, nil])
end end
end end
......
...@@ -27,7 +27,7 @@ describe 'trusted_proxies', lib: true do ...@@ -27,7 +27,7 @@ describe 'trusted_proxies', lib: true do
context 'with private IP ranges added' do context 'with private IP ranges added' do
before do before do
set_trusted_proxies([ "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" ]) set_trusted_proxies(["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"])
end end
it 'filters out private and local IPs' do it 'filters out private and local IPs' do
...@@ -39,7 +39,7 @@ describe 'trusted_proxies', lib: true do ...@@ -39,7 +39,7 @@ describe 'trusted_proxies', lib: true do
context 'with proxy IP added' do context 'with proxy IP added' do
before do before do
set_trusted_proxies([ "60.98.25.47" ]) set_trusted_proxies(["60.98.25.47"])
end end
it 'filters out proxy IP' do it 'filters out proxy IP' do
......
...@@ -42,7 +42,7 @@ describe Bitbucket::Representation::Repo do ...@@ -42,7 +42,7 @@ describe Bitbucket::Representation::Repo do
describe '#clone_url' do describe '#clone_url' do
it 'builds url' do it 'builds url' do
data = { 'links' => { 'clone' => [ { 'name' => 'https', 'href' => 'https://bibucket.org/test/test.git' }] } } data = { 'links' => { 'clone' => [{ 'name' => 'https', 'href' => 'https://bibucket.org/test/test.git' }] } }
expect(described_class.new(data).clone_url('abc')).to eq('https://x-token-auth:abc@bibucket.org/test/test.git') expect(described_class.new(data).clone_url('abc')).to eq('https://x-token-auth:abc@bibucket.org/test/test.git')
end end
end end
......
...@@ -580,7 +580,7 @@ module Ci ...@@ -580,7 +580,7 @@ module Ci
context 'when syntax is incorrect' do context 'when syntax is incorrect' do
context 'when variables defined but invalid' do context 'when variables defined but invalid' do
let(:variables) do let(:variables) do
[ 'VAR1', 'value1', 'VAR2', 'value2' ] ['VAR1', 'value1', 'VAR2', 'value2']
end end
it 'raises error' do it 'raises error' do
......
...@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::Entry::Key do ...@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::Entry::Key do
end end
context 'when entry value is not correct' do context 'when entry value is not correct' do
let(:config) { [ 'incorrect' ] } let(:config) { ['incorrect'] }
describe '#errors' do describe '#errors' do
it 'saves errors' do it 'saves errors' do
......
...@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::Entry::Paths do ...@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::Entry::Paths do
end end
context 'when entry value is not valid' do context 'when entry value is not valid' do
let(:config) { [ 1 ] } let(:config) { [1] }
describe '#errors' do describe '#errors' do
it 'saves errors' do it 'saves errors' do
......
...@@ -29,7 +29,7 @@ describe Gitlab::Ci::Config::Entry::Variables do ...@@ -29,7 +29,7 @@ describe Gitlab::Ci::Config::Entry::Variables do
end end
context 'when entry value is not correct' do context 'when entry value is not correct' do
let(:config) { [ :VAR, 'test' ] } let(:config) { [:VAR, 'test'] }
describe '#errors' do describe '#errors' do
it 'saves errors' do it 'saves errors' do
......
...@@ -365,7 +365,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do ...@@ -365,7 +365,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do
end end
context 'when go over safe limits on files' do context 'when go over safe limits on files' do
let(:iterator) { [ fake_diff(1, 1) ] * 4 } let(:iterator) { [fake_diff(1, 1)] * 4 }
before(:each) do before(:each) do
stub_const('Gitlab::Git::DiffCollection::DEFAULT_LIMITS', { max_files: 2, max_lines: max_lines }) stub_const('Gitlab::Git::DiffCollection::DEFAULT_LIMITS', { max_files: 2, max_lines: max_lines })
......
...@@ -151,7 +151,7 @@ describe Gitlab::OAuth::User, lib: true do ...@@ -151,7 +151,7 @@ describe Gitlab::OAuth::User, lib: true do
expect(gl_user.identities.length).to eql 2 expect(gl_user.identities.length).to eql 2
identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array( expect(identities_as_hash).to match_array(
[ { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, [{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
{ provider: 'twitter', extern_uid: uid } { provider: 'twitter', extern_uid: uid }
]) ])
end end
...@@ -170,7 +170,7 @@ describe Gitlab::OAuth::User, lib: true do ...@@ -170,7 +170,7 @@ describe Gitlab::OAuth::User, lib: true do
expect(gl_user.identities.length).to eql 2 expect(gl_user.identities.length).to eql 2
identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array( expect(identities_as_hash).to match_array(
[ { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, [{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
{ provider: 'twitter', extern_uid: uid } { provider: 'twitter', extern_uid: uid }
]) ])
end end
......
...@@ -157,7 +157,7 @@ describe Gitlab::Saml::User, lib: true do ...@@ -157,7 +157,7 @@ describe Gitlab::Saml::User, lib: true do
expect(gl_user.email).to eql 'john@mail.com' expect(gl_user.email).to eql 'john@mail.com'
expect(gl_user.identities.length).to eql 2 expect(gl_user.identities.length).to eql 2
identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array([ { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
{ provider: 'saml', extern_uid: uid } { provider: 'saml', extern_uid: uid }
]) ])
end end
...@@ -180,7 +180,7 @@ describe Gitlab::Saml::User, lib: true do ...@@ -180,7 +180,7 @@ describe Gitlab::Saml::User, lib: true do
expect(gl_user.email).to eql 'john@mail.com' expect(gl_user.email).to eql 'john@mail.com'
expect(gl_user.identities.length).to eql 2 expect(gl_user.identities.length).to eql 2
identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array([ { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
{ provider: 'saml', extern_uid: uid } { provider: 'saml', extern_uid: uid }
]) ])
end end
...@@ -206,7 +206,7 @@ describe Gitlab::Saml::User, lib: true do ...@@ -206,7 +206,7 @@ describe Gitlab::Saml::User, lib: true do
expect(local_gl_user).to be_valid expect(local_gl_user).to be_valid
expect(local_gl_user.identities.length).to eql 2 expect(local_gl_user.identities.length).to eql 2
identities_as_hash = local_gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } identities_as_hash = local_gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } }
expect(identities_as_hash).to match_array([ { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, expect(identities_as_hash).to match_array([{ provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' },
{ provider: 'saml', extern_uid: 'uid=user1,ou=People,dc=example' } { provider: 'saml', extern_uid: 'uid=user1,ou=People,dc=example' }
]) ])
end end
......
...@@ -1262,8 +1262,8 @@ describe Ci::Build, :models do ...@@ -1262,8 +1262,8 @@ describe Ci::Build, :models do
context 'when build has user' do context 'when build has user' do
let(:user_variables) do let(:user_variables) do
[ { key: 'GITLAB_USER_ID', value: user.id.to_s, public: true }, [{ key: 'GITLAB_USER_ID', value: user.id.to_s, public: true },
{ key: 'GITLAB_USER_EMAIL', value: user.email, public: true } ] { key: 'GITLAB_USER_EMAIL', value: user.email, public: true }]
end end
before do before do
......
...@@ -18,7 +18,7 @@ describe 'CycleAnalytics#staging', feature: true do ...@@ -18,7 +18,7 @@ describe 'CycleAnalytics#staging', feature: true do
start_time_conditions: [["merge request that closes issue is merged", start_time_conditions: [["merge request that closes issue is merged",
-> (context, data) do -> (context, data) do
context.merge_merge_requests_closing_issue(data[:issue]) context.merge_merge_requests_closing_issue(data[:issue])
end ]], end]],
end_time_conditions: [["merge request that closes issue is deployed to production", end_time_conditions: [["merge request that closes issue is deployed to production",
-> (context, data) do -> (context, data) do
context.deploy_master context.deploy_master
......
...@@ -89,8 +89,8 @@ describe ProjectMember, models: true do ...@@ -89,8 +89,8 @@ describe ProjectMember, models: true do
@user_1 = create :user @user_1 = create :user
@user_2 = create :user @user_2 = create :user
@project_1.team << [ @user_1, :developer ] @project_1.team << [@user_1, :developer]
@project_2.team << [ @user_2, :reporter ] @project_2.team << [@user_2, :reporter]
@status = @project_2.team.import(@project_1) @status = @project_2.team.import(@project_1)
end end
...@@ -137,8 +137,8 @@ describe ProjectMember, models: true do ...@@ -137,8 +137,8 @@ describe ProjectMember, models: true do
@user_1 = create :user @user_1 = create :user
@user_2 = create :user @user_2 = create :user
@project_1.team << [ @user_1, :developer] @project_1.team << [@user_1, :developer]
@project_2.team << [ @user_2, :reporter] @project_2.team << [@user_2, :reporter]
ProjectMember.truncate_teams([@project_1.id, @project_2.id]) ProjectMember.truncate_teams([@project_1.id, @project_2.id])
end end
......
...@@ -171,7 +171,7 @@ describe KubernetesService, models: true, caching: true do ...@@ -171,7 +171,7 @@ describe KubernetesService, models: true, caching: true do
context 'with invalid pods' do context 'with invalid pods' do
it 'returns no terminals' do it 'returns no terminals' do
stub_reactive_cache(service, pods: [ { "bad" => "pod" } ]) stub_reactive_cache(service, pods: [{ "bad" => "pod" }])
is_expected.to be_empty is_expected.to be_empty
end end
...@@ -184,7 +184,7 @@ describe KubernetesService, models: true, caching: true do ...@@ -184,7 +184,7 @@ describe KubernetesService, models: true, caching: true do
before do before do
stub_reactive_cache( stub_reactive_cache(
service, service,
pods: [ pod, pod, kube_pod(app: "should-be-filtered-out") ] pods: [pod, pod, kube_pod(app: "should-be-filtered-out")]
) )
end end
......
...@@ -303,7 +303,7 @@ describe API::Groups, api: true do ...@@ -303,7 +303,7 @@ describe API::Groups, api: true do
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
project_names = json_response.map { |proj| proj['name' ] } project_names = json_response.map { |proj| proj['name'] }
expect(project_names).to match_array([project1.name, project3.name]) expect(project_names).to match_array([project1.name, project3.name])
expect(json_response.first['visibility_level']).to be_present expect(json_response.first['visibility_level']).to be_present
end end
...@@ -314,7 +314,7 @@ describe API::Groups, api: true do ...@@ -314,7 +314,7 @@ describe API::Groups, api: true do
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response.length).to eq(2) expect(json_response.length).to eq(2)
project_names = json_response.map { |proj| proj['name' ] } project_names = json_response.map { |proj| proj['name'] }
expect(project_names).to match_array([project1.name, project3.name]) expect(project_names).to match_array([project1.name, project3.name])
expect(json_response.first['visibility_level']).not_to be_present expect(json_response.first['visibility_level']).not_to be_present
end end
...@@ -398,7 +398,7 @@ describe API::Groups, api: true do ...@@ -398,7 +398,7 @@ describe API::Groups, api: true do
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
project_names = json_response.map { |proj| proj['name' ] } project_names = json_response.map { |proj| proj['name'] }
expect(project_names).to match_array([project1.name, project3.name]) expect(project_names).to match_array([project1.name, project3.name])
end end
......
...@@ -6,8 +6,8 @@ describe ProtectedBranches::CreateService, services: true do ...@@ -6,8 +6,8 @@ describe ProtectedBranches::CreateService, services: true do
let(:params) do let(:params) do
{ {
name: 'master', name: 'master',
merge_access_levels_attributes: [ { access_level: Gitlab::Access::MASTER } ], merge_access_levels_attributes: [{ access_level: Gitlab::Access::MASTER }],
push_access_levels_attributes: [ { access_level: Gitlab::Access::MASTER } ] push_access_levels_attributes: [{ access_level: Gitlab::Access::MASTER }]
} }
end end
......
...@@ -11,7 +11,7 @@ module KubernetesHelpers ...@@ -11,7 +11,7 @@ module KubernetesHelpers
def kube_pods_body(*pods) def kube_pods_body(*pods)
{ "kind" => "PodList", { "kind" => "PodList",
"items" => [ kube_pod ], "items" => [kube_pod],
} }
end end
......
...@@ -11,7 +11,7 @@ shared_examples 'new issuable record that supports slash commands' do ...@@ -11,7 +11,7 @@ shared_examples 'new issuable record that supports slash commands' do
let(:params) { base_params.merge(defined?(default_params) ? default_params : {}).merge(example_params) } let(:params) { base_params.merge(defined?(default_params) ? default_params : {}).merge(example_params) }
let(:issuable) { described_class.new(project, user, params).execute } let(:issuable) { described_class.new(project, user, params).execute }
before { project.team << [assignee, :master ] } before { project.team << [assignee, :master] }
context 'with labels in command only' do context 'with labels in command only' do
let(:example_params) do let(:example_params) do
......
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