Improve zone specs

#475
This commit is contained in:
Artur Beljajev 2017-05-01 21:31:54 +03:00
parent 71e62a5f86
commit eb2796483d
2 changed files with 4 additions and 4 deletions

View file

@ -17,20 +17,20 @@ RSpec.describe 'admin zone create', settings: false do
text_attributes.each do |attr_name| text_attributes.each do |attr_name|
it "saves #{attr_name}" do it "saves #{attr_name}" do
post admin_zones_path, { zone: attributes_for(:zone, attr_name => 'test') } post admin_zones_path, zone: attributes_for(:zone, attr_name => 'test')
expect(zone.send(attr_name)).to eq('test') expect(zone.send(attr_name)).to eq('test')
end end
end end
integer_attributes.each do |attr_name| integer_attributes.each do |attr_name|
it "saves #{attr_name}" do it "saves #{attr_name}" do
post admin_zones_path, { zone: attributes_for(:zone, attr_name => '1') } post admin_zones_path, zone: attributes_for(:zone, attr_name => '1')
expect(zone.send(attr_name)).to eq(1) expect(zone.send(attr_name)).to eq(1)
end end
end end
it 'redirects to :index' do it 'redirects to :index' do
post admin_zones_path, { zone: attributes_for(:zone) } post admin_zones_path, zone: attributes_for(:zone)
expect(response).to redirect_to admin_zones_url expect(response).to redirect_to admin_zones_url
end end
end end

View file

@ -33,7 +33,7 @@ RSpec.describe 'admin zone update', settings: false do
it 'redirects to :index' do it 'redirects to :index' do
zone = create(:zone) zone = create(:zone)
patch admin_zone_path(zone), { zone: attributes_for(:zone) } patch admin_zone_path(zone), zone: attributes_for(:zone)
expect(response).to redirect_to admin_zones_url expect(response).to redirect_to admin_zones_url
end end