Sign in accounts instead of users
This commit is contained in:
parent
3e1bb72481
commit
8d14229212
3 changed files with 61 additions and 9 deletions
|
@ -30,7 +30,11 @@ private
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_raven_context
|
def set_raven_context
|
||||||
Raven.user_context id: current_user.id if user_signed_in?
|
Raven.user_context(
|
||||||
|
account_id: current_account&.id,
|
||||||
|
user_id: current_user&.id,
|
||||||
|
)
|
||||||
|
|
||||||
Raven.extra_context params: params.to_unsafe_h, url: request.url
|
Raven.extra_context params: params.to_unsafe_h, url: request.url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,43 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe 'GET /passports/:passport_id/passport_confirmations' do
|
RSpec.describe 'GET /passports/:passport_id/passport_confirmations' do
|
||||||
let!(:passport) { create :passport_with_passport_map_and_image }
|
let!(:passport) { create :passport_with_passport_map_and_image }
|
||||||
let(:current_user) { create :user }
|
let(:current_account) { create :usual_account }
|
||||||
|
|
||||||
def make_request
|
def make_request
|
||||||
get "/passports/#{passport.id}/passport_confirmations"
|
get "/passports/#{passport.id}/passport_confirmations"
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in current_user if current_user
|
sign_in current_account.user if current_account&.user
|
||||||
make_request
|
make_request
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when no user is authenticated' do
|
context 'when no account is authenticated' do
|
||||||
let(:current_user) { nil }
|
let(:current_account) { nil }
|
||||||
|
|
||||||
|
specify do
|
||||||
|
expect(response).to have_http_status :ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when guest account is authenticated' do
|
||||||
|
let(:current_account) { create :guest_account }
|
||||||
|
|
||||||
|
specify do
|
||||||
|
expect(response).to have_http_status :ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when usual account is authenticated' do
|
||||||
|
let(:current_account) { create :usual_account }
|
||||||
|
|
||||||
|
specify do
|
||||||
|
expect(response).to have_http_status :ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when superuser account is authenticated' do
|
||||||
|
let(:current_account) { create :superuser_account }
|
||||||
|
|
||||||
specify do
|
specify do
|
||||||
expect(response).to have_http_status :ok
|
expect(response).to have_http_status :ok
|
||||||
|
|
|
@ -4,19 +4,43 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe 'GET /passports/:id' do
|
RSpec.describe 'GET /passports/:id' do
|
||||||
let!(:passport) { create :confirmed_passport }
|
let!(:passport) { create :confirmed_passport }
|
||||||
let(:current_user) { create :user }
|
let(:current_account) { create :usual_account }
|
||||||
|
|
||||||
def make_request
|
def make_request
|
||||||
get "/passports/#{passport.id}"
|
get "/passports/#{passport.id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in current_user if current_user
|
sign_in current_account.user if current_account&.user
|
||||||
make_request
|
make_request
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when no user is authenticated' do
|
context 'when no account is authenticated' do
|
||||||
let(:current_user) { nil }
|
let(:current_account) { nil }
|
||||||
|
|
||||||
|
specify do
|
||||||
|
expect(response).to have_http_status :ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when guest account is authenticated' do
|
||||||
|
let(:current_account) { create :guest_account }
|
||||||
|
|
||||||
|
specify do
|
||||||
|
expect(response).to have_http_status :ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when usual account is authenticated' do
|
||||||
|
let(:current_account) { create :usual_account }
|
||||||
|
|
||||||
|
specify do
|
||||||
|
expect(response).to have_http_status :ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when superuser account is authenticated' do
|
||||||
|
let(:current_account) { create :superuser_account }
|
||||||
|
|
||||||
specify do
|
specify do
|
||||||
expect(response).to have_http_status :ok
|
expect(response).to have_http_status :ok
|
||||||
|
|
Reference in a new issue