demarches-normaliennes/spec/controllers/users_controller_spec.rb

31 lines
843 B
Ruby
Raw Normal View History

require 'spec_helper'
require 'controllers/users_controller_shared_example'
describe UsersController, type: :controller do
2015-11-02 16:36:52 +01:00
describe '#current_user_dossier' do
let(:owner_user) { create(:user) }
let(:invite_user) { create :user, email: 'invite@plop.com' }
let(:not_invite_user) { create :user, email: 'not_invite@plop.com' }
let(:dossier) { create(:dossier, user: owner_user) }
context 'when user is the owner' do
before do
sign_in owner_user
end
it_should_behave_like "current_user_dossier_spec"
end
context 'when user is invite by the owner' do
before do
create :invite, email: invite_user.email, dossier: dossier, user: invite_user, type: 'InviteUser'
sign_in invite_user
end
it_should_behave_like "current_user_dossier_spec"
end
end
end