Commit 809a5f1d authored by Jason Goodman's avatar Jason Goodman

Refactor specs to use contains_exactly

parent ddc17b0f
......@@ -31,9 +31,11 @@ RSpec.describe GroupsController, type: :request do
context 'valid param' do
shared_examples 'creates ip restrictions' do
it 'creates ip restrictions' do
expect { subject }
.to(change { group.reload.ip_restrictions.map(&:range).sort }
.from([]).to(range.split(',').sort))
expect(group.ip_restrictions).to be_empty
subject
expect(group.reload.ip_restrictions.map(&:range)).to contain_exactly(*range.split(','))
expect(response).to have_gitlab_http_status(:found)
end
end
......@@ -71,9 +73,11 @@ RSpec.describe GroupsController, type: :request do
context 'valid param' do
shared_examples 'updates ip restrictions' do
it 'updates ip restrictions' do
expect { subject }
.to(change { group.reload.ip_restrictions.map(&:range).sort }
.from(['10.0.0.0/8']).to(range.split(',').sort))
expect(group.ip_restrictions.map(&:range)).to eq(['10.0.0.0/8'])
subject
expect(group.reload.ip_restrictions.map(&:range)).to contain_exactly(*range.split(','))
expect(response).to have_gitlab_http_status(:found)
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