diff --git a/Gemfile.lock b/Gemfile.lock index 3c4c1c1702..d694e23597 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -511,7 +511,7 @@ GEM uber openstax_healthcheck (1.0.1) rails (>= 3.0) - openstax_rescue_from (4.2.1) + openstax_rescue_from (4.2.2) rails (>= 3.1, < 7.0) openstax_salesforce (8.1.0) openstax_active_force diff --git a/spec/controllers/admin/security_logs_controller_spec.rb b/spec/controllers/admin/security_logs_controller_spec.rb index 1471bed7dc..88dbd2819e 100644 --- a/spec/controllers/admin/security_logs_controller_spec.rb +++ b/spec/controllers/admin/security_logs_controller_spec.rb @@ -16,7 +16,7 @@ end it 'passes search parameters to Admin::SearchSecurityLog' do - expect(Admin::SearchSecurityLog).to receive(:call).with(query: 'test').and_return(no_results) + expect(Admin::SearchSecurityLog).to receive(:call).with({query: 'test'}).and_return(no_results) get(:show, params: { search: {query: 'test'} }) end diff --git a/spec/controllers/doorkeeper/authorizations_controller_spec.rb b/spec/controllers/doorkeeper/authorizations_controller_spec.rb index 776edb12e5..5e7f61b4ef 100644 --- a/spec/controllers/doorkeeper/authorizations_controller_spec.rb +++ b/spec/controllers/doorkeeper/authorizations_controller_spec.rb @@ -3,13 +3,17 @@ RSpec.describe Doorkeeper::AuthorizationsController, type: :controller do before { controller.sign_in! user } + let(:app) { FactoryBot.create :doorkeeper_application } + context '#create' do context 'when a student uses social auth' do context 'user without a profile' do let(:user) { FactoryBot.create :user, state: :needs_profile } it 'redirects to /signup/profile' do - post :create, params: { response_type: :code } + post :create, params: { + client_id: app.uid, redirect_uri: app.redirect_uri, response_type: :code + } expect(response).to redirect_to signup_profile_url end end @@ -17,9 +21,11 @@ context 'user with a profile' do let(:user) { FactoryBot.create :user, :terms_agreed } - it 'does not redirect' do - post :create, params: { response_type: :code } - expect(response).to have_http_status(:unauthorized) + it 'redirects to the app, not to /signup/profile' do + post :create, params: { + client_id: app.uid, redirect_uri: app.redirect_uri, response_type: :code + } + expect(response).to redirect_to a_string_matching(app.redirect_uri) end end end