Skip to content

Commit

Permalink
Fixed more tests, updated openstax_rescue_from
Browse files Browse the repository at this point in the history
  • Loading branch information
Dantemss committed Oct 16, 2024
1 parent a4fe4a7 commit 908887d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/admin/security_logs_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions spec/controllers/doorkeeper/authorizations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,29 @@
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

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
Expand Down

0 comments on commit 908887d

Please sign in to comment.