Change test structure

This commit is contained in:
Mathieu Magnin 2017-04-06 16:58:00 +02:00
parent a93aba5967
commit 86ab596a87
2 changed files with 17 additions and 7 deletions

View file

@ -15,13 +15,24 @@ feature 'drawing a zone with freedraw' do
expect(page).to have_css('#login_user') expect(page).to have_css('#login_user')
end end
context 'when he enter login information' do scenario 'he logs in and he is redirected to carte page', vcr: { cassette_name: 'drawing_a_zone_with_freedraw_redirected_to_carte_page' } do
within('#new_user') do
page.find_by_id('user_email').set user.email
page.find_by_id('user_password').set user.password
page.click_on 'Se connecter'
end
expect(page).to have_css('.content #map')
end
end
context 'when user is logged in' do
before do
login_as user, scope: :user
end
context 'when he is visiting the map page' do
before do before do
within('#new_user') do visit users_dossier_carte_path dossier_id: dossier.id
page.find_by_id('user_email').set user.email
page.find_by_id('user_password').set user.password
page.click_on 'Se connecter'
end
end end
context 'when procedure have api carto activated' do context 'when procedure have api carto activated' do

View file

@ -1,7 +1,6 @@
require 'spec_helper' require 'spec_helper'
feature 'user access to the list of his dossier' do feature 'user access to the list of his dossier' do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'replied')} let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'replied')}
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'replied') } let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'replied') }