Commit 78e842de authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'id-fix-void-expect-offenses' into 'master'

Fix RSpec/VoidExpect offenses

See merge request gitlab-org/gitlab!29000
parents ac470cd5 71b55808
...@@ -269,14 +269,6 @@ RSpec/ScatteredSetup: ...@@ -269,14 +269,6 @@ RSpec/ScatteredSetup:
- 'spec/requests/api/jobs_spec.rb' - 'spec/requests/api/jobs_spec.rb'
- 'spec/services/projects/create_service_spec.rb' - 'spec/services/projects/create_service_spec.rb'
# Offense count: 4
RSpec/VoidExpect:
Exclude:
- 'spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb'
- 'spec/models/ci/group_spec.rb'
- 'spec/models/ci/runner_spec.rb'
- 'spec/services/users/destroy_service_spec.rb'
# Offense count: 10 # Offense count: 10
# Cop supports --auto-correct. # Cop supports --auto-correct.
Rails/ApplicationController: Rails/ApplicationController:
......
...@@ -174,7 +174,7 @@ describe 'Set up Mattermost slash commands', :js do ...@@ -174,7 +174,7 @@ describe 'Set up Mattermost slash commands', :js do
describe 'stable logo url' do describe 'stable logo url' do
it 'shows a publicly available logo' do it 'shows a publicly available logo' do
expect(File.exist?(Rails.root.join('public/slash-command-logo.png'))) expect(File.exist?(Rails.root.join('public/slash-command-logo.png'))).to be_truthy
end end
end end
end end
...@@ -53,7 +53,7 @@ describe Ci::Group do ...@@ -53,7 +53,7 @@ describe Ci::Group do
it 'calls the status from the object itself' do it 'calls the status from the object itself' do
expect(jobs.first).to receive(:detailed_status) expect(jobs.first).to receive(:detailed_status)
expect(subject.detailed_status(double(:user))) subject.detailed_status(double(:user))
end end
end end
......
...@@ -526,14 +526,14 @@ describe Ci::Runner do ...@@ -526,14 +526,14 @@ describe Ci::Runner do
it 'sets a new last_update value when it is called the first time' do it 'sets a new last_update value when it is called the first time' do
last_update = runner.ensure_runner_queue_value last_update = runner.ensure_runner_queue_value
expect_value_in_queues.to eq(last_update) expect(value_in_queues).to eq(last_update)
end end
it 'does not change if it is not expired and called again' do it 'does not change if it is not expired and called again' do
last_update = runner.ensure_runner_queue_value last_update = runner.ensure_runner_queue_value
expect(runner.ensure_runner_queue_value).to eq(last_update) expect(runner.ensure_runner_queue_value).to eq(last_update)
expect_value_in_queues.to eq(last_update) expect(value_in_queues).to eq(last_update)
end end
context 'updates runner queue after changing editable value' do context 'updates runner queue after changing editable value' do
...@@ -544,7 +544,7 @@ describe Ci::Runner do ...@@ -544,7 +544,7 @@ describe Ci::Runner do
end end
it 'sets a new last_update value' do it 'sets a new last_update value' do
expect_value_in_queues.not_to eq(last_update) expect(value_in_queues).not_to eq(last_update)
end end
end end
...@@ -556,14 +556,14 @@ describe Ci::Runner do ...@@ -556,14 +556,14 @@ describe Ci::Runner do
end end
it 'has an old last_update value' do it 'has an old last_update value' do
expect_value_in_queues.to eq(last_update) expect(value_in_queues).to eq(last_update)
end end
end end
def expect_value_in_queues def value_in_queues
Gitlab::Redis::SharedState.with do |redis| Gitlab::Redis::SharedState.with do |redis|
runner_queue_key = runner.send(:runner_queue_key) runner_queue_key = runner.send(:runner_queue_key)
expect(redis.get(runner_queue_key)) redis.get(runner_queue_key)
end end
end end
end end
......
...@@ -15,7 +15,7 @@ describe Users::DestroyService do ...@@ -15,7 +15,7 @@ describe Users::DestroyService do
it 'deletes the user' do it 'deletes the user' do
user_data = service.execute(user) user_data = service.execute(user)
expect { user_data['email'].to eq(user.email) } expect(user_data['email']).to eq(user.email)
expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound)
expect { Namespace.find(namespace.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { Namespace.find(namespace.id) }.to raise_error(ActiveRecord::RecordNotFound)
end 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