2020-02-10 10:22:22 +01:00
|
|
|
describe Manager::DemandesController, type: :controller do
|
2020-11-05 15:09:11 +01:00
|
|
|
let(:super_admin) { create(:super_admin) }
|
2020-02-10 10:22:22 +01:00
|
|
|
|
|
|
|
describe 'GET #index' do
|
|
|
|
before do
|
2020-11-05 15:09:11 +01:00
|
|
|
sign_in super_admin
|
2020-02-10 10:22:22 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it "display pending demandes" do
|
|
|
|
approved_administrateur = create(:administrateur, email: "approved@example.com")
|
|
|
|
pending_demande = { email: 'pending@example.com' }
|
|
|
|
demandes = [{ email: approved_administrateur.email }, pending_demande]
|
|
|
|
allow(PipedriveService).to receive(:get_demandes).and_return(demandes)
|
|
|
|
|
|
|
|
get :index
|
|
|
|
|
|
|
|
expect(assigns(:pending_demandes)).to eq([pending_demande])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|