Check geozone 'safe_to_delete' behavior as unit test instead of integration test

This commit is contained in:
Alberto Miedes Garcés
2016-12-13 18:38:13 +01:00
parent 419905fb59
commit db029964fa
2 changed files with 27 additions and 46 deletions

View File

@@ -83,7 +83,7 @@ feature 'Admin geozones' do
expect(Geozone.where(id: geozone.id)).to be_empty
end
scenario 'Delete geozone with associated proposal' do
scenario 'Delete geozone with associated element' do
geozone = create(:geozone, name: 'Delete me!')
create(:proposal, geozone: geozone)
@@ -97,49 +97,4 @@ feature 'Admin geozones' do
expect(page).to have_content 'Delete me!'
end
end
scenario 'Delete geozone with associated spending proposal' do
geozone = create(:geozone, name: 'Delete me!')
create(:spending_proposal, geozone: geozone)
visit admin_geozones_path
within("#geozone_#{geozone.id}") { click_link 'Delete' }
expect(page).to have_content "This geozone can't be deleted since there are elements attached to it"
within("#geozone_#{geozone.id}") do
expect(page).to have_content 'Delete me!'
end
end
scenario 'Delete geozone with associated debate' do
geozone = create(:geozone, name: 'Delete me!')
create(:debate, geozone: geozone)
visit admin_geozones_path
within("#geozone_#{geozone.id}") { click_link 'Delete' }
expect(page).to have_content "This geozone can't be deleted since there are elements attached to it"
within("#geozone_#{geozone.id}") do
expect(page).to have_content 'Delete me!'
end
end
scenario 'Delete geozone with associated user' do
geozone = create(:geozone, name: 'Delete me!')
create(:user, geozone: geozone)
visit admin_geozones_path
within("#geozone_#{geozone.id}") { click_link 'Delete' }
expect(page).to have_content "This geozone can't be deleted since there are elements attached to it"
within("#geozone_#{geozone.id}") do
expect(page).to have_content 'Delete me!'
end
end
end