summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-02-15 20:21:51 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-02-15 20:21:51 +0800
commit60288d6c62d7e65ed5a93a72ba047ccaa2daa22b (patch)
tree960e0a8197a561d9c1fcd2b8749d7d6b8b878d90
parent3856a3daa14bdfc2abed28d355a5244e32a81d6a (diff)
downloadgitlab-ce-use-update-runner-service.tar.gz
Use expect { }.to change { }use-update-runner-service
Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8664#note_23427575
-rw-r--r--spec/controllers/admin/runners_controller_spec.rb18
-rw-r--r--spec/controllers/projects/runners_controller_spec.rb18
2 files changed, 18 insertions, 18 deletions
diff --git a/spec/controllers/admin/runners_controller_spec.rb b/spec/controllers/admin/runners_controller_spec.rb
index ae55ce87f0b..b5fe40d0510 100644
--- a/spec/controllers/admin/runners_controller_spec.rb
+++ b/spec/controllers/admin/runners_controller_spec.rb
@@ -31,16 +31,16 @@ describe Admin::RunnersController do
describe '#update' do
it 'updates the runner and ticks the queue' do
- old_tick = runner.ensure_runner_queue_value
new_desc = runner.description.swapcase
- post :update, id: runner.id, runner: { description: new_desc }
+ expect do
+ post :update, id: runner.id, runner: { description: new_desc }
+ end.to change { runner.ensure_runner_queue_value }
runner.reload
expect(response).to have_http_status(302)
expect(runner.description).to eq(new_desc)
- expect(runner.ensure_runner_queue_value).not_to eq(old_tick)
end
end
@@ -55,31 +55,31 @@ describe Admin::RunnersController do
describe '#resume' do
it 'marks the runner as active and ticks the queue' do
- old_tick = runner.ensure_runner_queue_value
runner.update(active: false)
- post :resume, id: runner.id
+ expect do
+ post :resume, id: runner.id
+ end.to change { runner.ensure_runner_queue_value }
runner.reload
expect(response).to have_http_status(302)
expect(runner.active).to eq(true)
- expect(runner.ensure_runner_queue_value).not_to eq(old_tick)
end
end
describe '#pause' do
it 'marks the runner as inactive and ticks the queue' do
- old_tick = runner.ensure_runner_queue_value
runner.update(active: true)
- post :pause, id: runner.id
+ expect do
+ post :pause, id: runner.id
+ end.to change { runner.ensure_runner_queue_value }
runner.reload
expect(response).to have_http_status(302)
expect(runner.active).to eq(false)
- expect(runner.ensure_runner_queue_value).not_to eq(old_tick)
end
end
end
diff --git a/spec/controllers/projects/runners_controller_spec.rb b/spec/controllers/projects/runners_controller_spec.rb
index 6dec12f1815..0fa249e4405 100644
--- a/spec/controllers/projects/runners_controller_spec.rb
+++ b/spec/controllers/projects/runners_controller_spec.rb
@@ -21,16 +21,16 @@ describe Projects::RunnersController do
describe '#update' do
it 'updates the runner and ticks the queue' do
- old_tick = runner.ensure_runner_queue_value
new_desc = runner.description.swapcase
- post :update, params.merge(runner: { description: new_desc } )
+ expect do
+ post :update, params.merge(runner: { description: new_desc } )
+ end.to change { runner.ensure_runner_queue_value }
runner.reload
expect(response).to have_http_status(302)
expect(runner.description).to eq(new_desc)
- expect(runner.ensure_runner_queue_value).not_to eq(old_tick)
end
end
@@ -45,31 +45,31 @@ describe Projects::RunnersController do
describe '#resume' do
it 'marks the runner as active and ticks the queue' do
- old_tick = runner.ensure_runner_queue_value
runner.update(active: false)
- post :resume, params
+ expect do
+ post :resume, params
+ end.to change { runner.ensure_runner_queue_value }
runner.reload
expect(response).to have_http_status(302)
expect(runner.active).to eq(true)
- expect(runner.ensure_runner_queue_value).not_to eq(old_tick)
end
end
describe '#pause' do
it 'marks the runner as inactive and ticks the queue' do
- old_tick = runner.ensure_runner_queue_value
runner.update(active: true)
- post :pause, params
+ expect do
+ post :pause, params
+ end.to change { runner.ensure_runner_queue_value }
runner.reload
expect(response).to have_http_status(302)
expect(runner.active).to eq(false)
- expect(runner.ensure_runner_queue_value).not_to eq(old_tick)
end
end
end