Adopt tests to respect Raven context
This commit is contained in:
@ -166,6 +166,8 @@ describe InternalUsersController do
|
|||||||
describe 'GET #forgot_password' do
|
describe 'GET #forgot_password' do
|
||||||
context 'when no user is logged in' do
|
context 'when no user is logged in' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
|
allow(controller).to receive(:set_raven_context).and_return(nil)
|
||||||
|
|
||||||
expect(controller).to receive(:current_user).and_return(nil)
|
expect(controller).to receive(:current_user).and_return(nil)
|
||||||
get :forgot_password
|
get :forgot_password
|
||||||
end
|
end
|
||||||
@ -176,6 +178,8 @@ describe InternalUsersController do
|
|||||||
|
|
||||||
context 'when a user is already logged in' do
|
context 'when a user is already logged in' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
|
allow(controller).to receive(:set_raven_context).and_return(nil)
|
||||||
|
|
||||||
expect(controller).to receive(:current_user).and_return(user)
|
expect(controller).to receive(:current_user).and_return(user)
|
||||||
get :forgot_password
|
get :forgot_password
|
||||||
end
|
end
|
||||||
|
@ -154,7 +154,10 @@ describe SessionsController do
|
|||||||
|
|
||||||
describe 'DELETE #destroy' do
|
describe 'DELETE #destroy' do
|
||||||
let(:user) { double }
|
let(:user) { double }
|
||||||
before(:each) { expect(controller).to receive(:current_user).at_least(:once).and_return(user) }
|
before(:each) {
|
||||||
|
allow(controller).to receive(:set_raven_context).and_return(nil)
|
||||||
|
expect(controller).to receive(:current_user).at_least(:once).and_return(user)
|
||||||
|
}
|
||||||
|
|
||||||
context 'with an internal user' do
|
context 'with an internal user' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@ -217,6 +220,8 @@ describe SessionsController do
|
|||||||
describe 'GET #new' do
|
describe 'GET #new' do
|
||||||
context 'when no user is logged in' do
|
context 'when no user is logged in' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
|
allow(controller).to receive(:set_raven_context).and_return(nil)
|
||||||
|
|
||||||
expect(controller).to receive(:current_user).and_return(nil)
|
expect(controller).to receive(:current_user).and_return(nil)
|
||||||
get :new
|
get :new
|
||||||
end
|
end
|
||||||
@ -227,6 +232,8 @@ describe SessionsController do
|
|||||||
|
|
||||||
context 'when a user is already logged in' do
|
context 'when a user is already logged in' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
|
allow(controller).to receive(:set_raven_context).and_return(nil)
|
||||||
|
|
||||||
expect(controller).to receive(:current_user).and_return(FactoryBot.build(:teacher))
|
expect(controller).to receive(:current_user).and_return(FactoryBot.build(:teacher))
|
||||||
get :new
|
get :new
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user