2016-08-22 16:10:48 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'on click on tabs button' do
|
|
|
|
let(:user) { create :user }
|
|
|
|
|
2017-12-14 15:51:45 +01:00
|
|
|
let(:dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'en_construction') }
|
2016-08-22 16:10:48 +02:00
|
|
|
|
|
|
|
before do
|
2017-12-14 15:51:45 +01:00
|
|
|
create(:dossier, :with_entreprise, user: user, state: 'en_construction')
|
2017-12-14 15:53:02 +01:00
|
|
|
create(:dossier, :with_entreprise, user: user, state: 'en_instruction')
|
2017-12-04 18:00:12 +01:00
|
|
|
create(:dossier, :with_entreprise, user: user, state: 'accepte')
|
2017-12-04 18:15:40 +01:00
|
|
|
create(:dossier, :with_entreprise, user: user, state: 'refuse')
|
2017-12-04 20:23:57 +01:00
|
|
|
create(:dossier, :with_entreprise, user: user, state: 'sans_suite')
|
2016-08-22 16:10:48 +02:00
|
|
|
|
|
|
|
create :invite, dossier: dossier_invite, user: user
|
|
|
|
|
|
|
|
login_as user, scope: :user
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user is logged in' do
|
2016-10-19 17:25:24 +02:00
|
|
|
context 'when he click on tabs en construction' do
|
2016-08-22 16:10:48 +02:00
|
|
|
before do
|
|
|
|
visit users_dossiers_url(liste: :a_traiter)
|
2017-09-22 10:28:16 +02:00
|
|
|
page.click_on 'En construction 1'
|
2016-08-22 16:10:48 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to users dossier termine' do
|
2017-04-12 11:12:05 +02:00
|
|
|
expect(page).to have_css('#users-index')
|
2016-08-22 16:10:48 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-14 16:57:51 +02:00
|
|
|
context 'when he click on tabs en examen' do
|
2016-08-22 16:10:48 +02:00
|
|
|
before do
|
|
|
|
visit users_dossiers_url(liste: :en_instruction)
|
2017-03-06 18:14:54 +01:00
|
|
|
page.click_on 'En instruction 1'
|
2016-08-22 16:10:48 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to users dossier termine' do
|
2017-04-12 11:12:05 +02:00
|
|
|
expect(page).to have_css('#users-index')
|
2016-08-22 16:10:48 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when he click on tabs termine' do
|
|
|
|
before do
|
|
|
|
visit users_dossiers_url(liste: :termine)
|
2017-03-06 18:14:54 +01:00
|
|
|
page.click_on 'Terminé 3'
|
2016-08-22 16:10:48 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to users dossier termine' do
|
2017-04-12 11:12:05 +02:00
|
|
|
expect(page).to have_css('#users-index')
|
2016-08-22 16:10:48 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when he click on tabs invitation' do
|
|
|
|
before do
|
|
|
|
visit users_dossiers_url(liste: :invite)
|
|
|
|
page.click_on 'Invitation 1'
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to users dossier invites' do
|
2017-04-12 11:12:05 +02:00
|
|
|
expect(page).to have_css('#users-index')
|
2016-08-22 16:10:48 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-10-18 15:51:32 +02:00
|
|
|
end
|