-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permet à un conseiller de créer un compte pour un de ses collègues
Co-authored-by: Marine Dominé <[email protected]>
- Loading branch information
1 parent
bf938c2
commit d80f7d9
Showing
4 changed files
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,20 +36,21 @@ | |
|
||
context 'en conseiller' do | ||
let(:ma_structure) { create :structure } | ||
let(:autre_structure) { create :structure } | ||
let(:conseiller_connecte) do | ||
create :compte_organisation, structure: ma_structure, email: 'moi@structure' | ||
end | ||
let!(:collegue) do | ||
create :compte_organisation, structure: ma_structure, email: 'collegue@structure' | ||
end | ||
let!(:inconnu) do | ||
create :compte_organisation, structure: autre_structure, email: 'inconnu@structure' | ||
end | ||
|
||
before(:each) { connecte conseiller_connecte } | ||
|
||
describe 'je vois mes collègues' do | ||
let(:autre_structure) { create :structure } | ||
let!(:inconnu) do | ||
create :compte_organisation, structure: autre_structure, email: 'inconnu@structure' | ||
end | ||
let!(:collegue) do | ||
create :compte_organisation, structure: ma_structure, email: 'collegue@structure' | ||
end | ||
|
||
before { visit admin_comptes_path } | ||
|
||
it do | ||
|
@@ -58,5 +59,23 @@ | |
expect(page).to_not have_content 'inconnu@structure' | ||
end | ||
end | ||
|
||
describe 'ajouter un collegue' do | ||
before { visit new_admin_compte_path } | ||
|
||
it do | ||
fill_in :compte_email, with: '[email protected]' | ||
fill_in :compte_password, with: 'billyjoel' | ||
fill_in :compte_password_confirmation, with: 'billyjoel' | ||
|
||
expect do | ||
click_on 'Créer un compte' | ||
end.to change(Compte, :count) | ||
|
||
compte_cree = Compte.last | ||
expect(compte_cree.structure).to eq ma_structure | ||
expect(compte_cree.role).to eq 'organisation' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters