spec/controllers/authenticated_controller_spec.rb in foyer-0.2.0 vs spec/controllers/authenticated_controller_spec.rb in foyer-0.2.1

- old
+ new

@@ -1,34 +1,34 @@ require 'ostruct' require 'spec_helper' -describe AuthenticatedController do - describe "not authenticated" do - it "redirects to the identity_provider" do +describe AuthenticatedController, type: :controller do + describe 'not authenticated' do + it 'redirects to the identity_provider' do get :index expect(response.location).to match('/auth/gaggleamp') end - it "sets origin to the location an unauthenticated user was trying to access" do + it 'sets origin to the location an unauthenticated user was trying to access' do get :index response.location.split('?').last.tap do |query_string| expect(query_string.split('=').first).to eq('origin') expect(query_string.split('=').last).to eq(CGI.escape '/authenticated') end end end - describe "after authenticating" do - let(:user) { OpenStruct.new.tap { |i| i.id = rand(10000) } } + describe 'after authenticating' do + let(:user) { OpenStruct.new.tap { |i| i.id = rand(10_000) } } before do sign_in user - Foyer.user_finder = lambda { |_| user } + Foyer.user_finder = ->(_) { user } end - it "allows user to access the action" do + it 'allows user to access the action' do get :index expect(response.status).to eq 200 end end