2015-12-09 15:10:11 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gestionnaires::SessionsController, type: :controller do
|
|
|
|
before do
|
|
|
|
@request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
|
|
|
|
end
|
|
|
|
|
2016-02-19 15:04:29 +01:00
|
|
|
describe '.demo' do
|
2016-12-16 10:59:16 +01:00
|
|
|
subject { get :demo }
|
2017-06-20 15:55:17 +02:00
|
|
|
render_views
|
2016-12-16 10:59:16 +01:00
|
|
|
|
|
|
|
context 'when rails env is production' do
|
2016-02-19 15:04:29 +01:00
|
|
|
before do
|
|
|
|
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production"))
|
|
|
|
end
|
|
|
|
|
2016-12-16 10:59:16 +01:00
|
|
|
it { is_expected.to redirect_to root_path }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when rails env is not production' do
|
|
|
|
it { expect(subject.status).to eq 200 }
|
2016-02-19 15:04:29 +01:00
|
|
|
|
2016-12-16 10:59:16 +01:00
|
|
|
it 'Gestionnaire demo is initiated' do
|
|
|
|
subject
|
2017-06-20 15:55:17 +02:00
|
|
|
expect(response.body).to have_css("input#user_email[value='gestionnaire@apientreprise.fr']")
|
|
|
|
expect(response.body).to have_css("input#user_password[value='password']")
|
2016-12-16 10:59:16 +01:00
|
|
|
end
|
2016-02-19 15:04:29 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-12-09 15:10:11 +01:00
|
|
|
describe '.create' do
|
|
|
|
it { expect(described_class).to be < Sessions::SessionsController }
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|