demarches-normaliennes/spec/controllers/manager/demandes_controller_spec.rb

21 lines
619 B
Ruby
Raw Normal View History

2020-02-10 10:22:22 +01:00
describe Manager::DemandesController, type: :controller do
let(:super_admin) { create(:super_admin) }
2020-02-10 10:22:22 +01:00
describe 'GET #index' do
before do
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