concretized redirection expectations in controller specs
This commit is contained in:
@ -42,6 +42,6 @@ describe CodeOcean::FilesController do
|
||||
expect { request.call }.to change(CodeOcean::File, :count).by(-1)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(:exercise)
|
||||
end
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ describe ConsumersController do
|
||||
expect { request.call }.to change(Consumer, :count).by(1)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(Consumer.last)
|
||||
end
|
||||
|
||||
context 'with an invalid consumer' do
|
||||
@ -79,7 +79,7 @@ describe ConsumersController do
|
||||
before(:each) { put :update, consumer: FactoryGirl.attributes_for(:consumer), id: consumer.id }
|
||||
|
||||
expect_assigns(consumer: Consumer)
|
||||
expect_redirect
|
||||
expect_redirect(:consumer)
|
||||
end
|
||||
|
||||
context 'with an invalid consumer' do
|
||||
|
@ -19,7 +19,7 @@ describe ExecutionEnvironmentsController do
|
||||
expect { request.call }.to change(ExecutionEnvironment, :count).by(1)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(ExecutionEnvironment.last)
|
||||
end
|
||||
|
||||
context 'with an invalid execution environment' do
|
||||
@ -150,7 +150,7 @@ describe ExecutionEnvironmentsController do
|
||||
|
||||
expect_assigns(docker_images: Array)
|
||||
expect_assigns(execution_environment: ExecutionEnvironment)
|
||||
expect_redirect
|
||||
expect_redirect(:execution_environment)
|
||||
end
|
||||
|
||||
context 'with an invalid execution environment' do
|
||||
|
@ -22,7 +22,7 @@ describe ExercisesController do
|
||||
expect(Exercise.last.token).not_to eq(exercise.token)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(Exercise.last)
|
||||
end
|
||||
|
||||
context 'when saving fails' do
|
||||
@ -51,7 +51,7 @@ describe ExercisesController do
|
||||
expect { request.call }.to change(Exercise, :count).by(1)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(Exercise.last)
|
||||
end
|
||||
|
||||
context 'when including a file' do
|
||||
@ -254,7 +254,7 @@ describe ExercisesController do
|
||||
before(:each) { put :update, exercise: exercise_attributes, id: exercise.id }
|
||||
|
||||
expect_assigns(exercise: Exercise)
|
||||
expect_redirect
|
||||
expect_redirect(:exercise)
|
||||
end
|
||||
|
||||
context 'with an invalid exercise' do
|
||||
|
@ -17,7 +17,7 @@ describe FileTypesController do
|
||||
expect { request.call }.to change(FileType, :count).by(1)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(FileType.last)
|
||||
end
|
||||
|
||||
context 'with an invalid file type' do
|
||||
@ -84,7 +84,7 @@ describe FileTypesController do
|
||||
|
||||
expect_assigns(editor_modes: Array)
|
||||
expect_assigns(file_type: FileType)
|
||||
expect_redirect
|
||||
expect_redirect(:file_type)
|
||||
end
|
||||
|
||||
context 'with an invalid file type' do
|
||||
|
@ -18,7 +18,7 @@ describe HintsController do
|
||||
expect { request.call }.to change(Hint, :count).by(1)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(Hint.last)
|
||||
end
|
||||
|
||||
context 'with an invalid hint' do
|
||||
@ -42,7 +42,7 @@ describe HintsController do
|
||||
expect { delete :destroy, execution_environment_id: execution_environment.id, id: hint.id }.to change(Hint, :count).by(-1)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect { execution_environment_hints_path(execution_environment) }
|
||||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
@ -88,7 +88,7 @@ describe HintsController do
|
||||
|
||||
expect_assigns(execution_environment: :execution_environment)
|
||||
expect_assigns(hint: Hint)
|
||||
expect_redirect
|
||||
expect_redirect { hint }
|
||||
end
|
||||
|
||||
context 'with an invalid hint' do
|
||||
|
@ -15,7 +15,7 @@ describe InternalUsersController do
|
||||
context 'without a valid activation token' do
|
||||
before(:each) { get :activate, id: user.id }
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(:root)
|
||||
end
|
||||
|
||||
context 'with an already activated user' do
|
||||
@ -24,7 +24,7 @@ describe InternalUsersController do
|
||||
get :activate, id: user.id, token: user.activation_token
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(:root)
|
||||
end
|
||||
|
||||
context 'with valid preconditions' do
|
||||
@ -49,7 +49,7 @@ describe InternalUsersController do
|
||||
context 'without a valid activation token' do
|
||||
before(:each) { put :activate, id: user.id }
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(:root)
|
||||
end
|
||||
|
||||
context 'with an already activated user' do
|
||||
@ -58,7 +58,7 @@ describe InternalUsersController do
|
||||
put :activate, id: user.id, internal_user: {activation_token: user.activation_token, password: password, password_confirmation: password}
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(:root)
|
||||
end
|
||||
|
||||
context 'without a password' do
|
||||
@ -95,7 +95,7 @@ describe InternalUsersController do
|
||||
end
|
||||
|
||||
expect_flash_message(:notice, :'internal_users.activate.success')
|
||||
expect_redirect
|
||||
expect_redirect(:sign_in)
|
||||
end
|
||||
end
|
||||
|
||||
@ -125,7 +125,7 @@ describe InternalUsersController do
|
||||
request.call
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(InternalUser.last)
|
||||
end
|
||||
|
||||
context 'with an invalid internal user' do
|
||||
@ -234,7 +234,7 @@ describe InternalUsersController do
|
||||
context 'without a valid password reset token' do
|
||||
before(:each) { get :reset_password, id: user.id }
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(:root)
|
||||
end
|
||||
|
||||
context 'with a valid password reset token' do
|
||||
@ -272,7 +272,7 @@ describe InternalUsersController do
|
||||
expect(InternalUser.authenticate(user.email, password)).to eq(user)
|
||||
end
|
||||
|
||||
expect_redirect { Rails.application.routes.url_helpers.send(:sign_in_path) }
|
||||
expect_redirect(:sign_in)
|
||||
end
|
||||
|
||||
context 'without a matching password confirmation' do
|
||||
@ -305,7 +305,7 @@ describe InternalUsersController do
|
||||
before(:each) { put :update, internal_user: FactoryGirl.attributes_for(:teacher), id: users.first.id }
|
||||
|
||||
expect_assigns(user: InternalUser)
|
||||
expect_redirect
|
||||
expect_redirect { user }
|
||||
end
|
||||
|
||||
context 'with an invalid internal user' do
|
||||
|
@ -15,7 +15,7 @@ describe SessionsController do
|
||||
end
|
||||
|
||||
expect_flash_message(:notice, :'sessions.create.success')
|
||||
expect_redirect
|
||||
expect_redirect(:root)
|
||||
end
|
||||
|
||||
context 'with invalid credentials' do
|
||||
@ -206,7 +206,7 @@ describe SessionsController do
|
||||
get :new
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(:root)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ describe TeamsController do
|
||||
expect { request.call }.to change(Team, :count).by(1)
|
||||
end
|
||||
|
||||
expect_redirect
|
||||
expect_redirect(Team.last)
|
||||
end
|
||||
|
||||
context 'with an invalid team' do
|
||||
@ -79,7 +79,7 @@ describe TeamsController do
|
||||
before(:each) { put :update, team: FactoryGirl.attributes_for(:team), id: team.id }
|
||||
|
||||
expect_assigns(team: Team)
|
||||
expect_redirect
|
||||
expect_redirect(:team)
|
||||
end
|
||||
|
||||
context 'with an invalid team' do
|
||||
|
Reference in New Issue
Block a user