demarches-normaliennes/spec/controllers/root_controller_spec.rb
Xavier J 51c145d2ce Update landing page :
- Release scrape on Github
- Add presentation video
- Add demonstration link for gestionnaire and user
2016-02-16 12:01:39 +01:00

43 lines
No EOL
1,005 B
Ruby

require 'spec_helper'
describe RootController, type: :controller do
subject { get :index }
context 'when User is connected' do
before do
sign_in create(:user)
end
it { expect(subject).to redirect_to(users_dossiers_path) }
end
context 'when Gestionnaire is connected' do
before do
sign_in create(:gestionnaire)
end
it { expect(subject).to redirect_to(backoffice_dossiers_path) }
end
context 'when Administrateur is connected' do
before do
sign_in create(:administrateur)
end
it { expect(subject).to redirect_to(admin_procedures_path) }
end
context 'when nobody is connected' do
render_views
before do
stub_request(:get, "https://api.github.com/repos/sgmap/tps/releases/latest").
to_return(:status => 200, :body => '{"tag_name": "plip", "body": "blabla", "published_at": "2016-02-09T16:46:47Z"}', :headers => {})
subject
end
it { expect(response.body).to have_css('#landing') }
end
end