Fix Rubocop offenses
This commit is contained in:
@ -314,9 +314,7 @@ describe ExercisesController do
|
||||
before do
|
||||
create(:lti_parameter, external_user: user, exercise:)
|
||||
submission = build(:submission, exercise:, user:)
|
||||
allow(submission).to receive(:normalized_score).and_return(1)
|
||||
allow(submission).to receive(:calculate_score).and_return(scoring_response)
|
||||
allow(submission).to receive(:redirect_to_feedback?).and_return(false)
|
||||
allow(submission).to receive_messages(normalized_score: 1, calculate_score: scoring_response, redirect_to_feedback?: false)
|
||||
allow(Submission).to receive(:create).and_return(submission)
|
||||
end
|
||||
|
||||
|
@ -178,9 +178,8 @@ describe InternalUsersController do
|
||||
describe 'GET #forgot_password' do
|
||||
context 'when no user is logged in' do
|
||||
before do
|
||||
allow(controller).to receive(:set_sentry_context).and_return(nil)
|
||||
allow(controller).to receive_messages(set_sentry_context: nil, current_user: nil)
|
||||
|
||||
allow(controller).to receive(:current_user).and_return(nil)
|
||||
get :forgot_password
|
||||
end
|
||||
|
||||
@ -190,9 +189,8 @@ describe InternalUsersController do
|
||||
|
||||
context 'when a user is already logged in' do
|
||||
before do
|
||||
allow(controller).to receive(:set_sentry_context).and_return(nil)
|
||||
allow(controller).to receive_messages(set_sentry_context: nil, current_user: user)
|
||||
|
||||
allow(controller).to receive(:current_user).and_return(user)
|
||||
get :forgot_password
|
||||
end
|
||||
|
||||
|
@ -227,9 +227,8 @@ describe SessionsController do
|
||||
describe 'GET #new' do
|
||||
context 'when no user is logged in' do
|
||||
before do
|
||||
allow(controller).to receive(:set_sentry_context).and_return(nil)
|
||||
allow(controller).to receive_messages(set_sentry_context: nil, current_user: nil)
|
||||
|
||||
allow(controller).to receive(:current_user).and_return(nil)
|
||||
get :new
|
||||
end
|
||||
|
||||
@ -239,9 +238,8 @@ describe SessionsController do
|
||||
|
||||
context 'when a user is already logged in' do
|
||||
before do
|
||||
allow(controller).to receive(:set_sentry_context).and_return(nil)
|
||||
allow(controller).to receive_messages(set_sentry_context: nil, current_user: build(:teacher))
|
||||
|
||||
allow(controller).to receive(:current_user).and_return(build(:teacher))
|
||||
get :new
|
||||
end
|
||||
|
||||
|
@ -9,10 +9,8 @@ describe 'yaml config files' do
|
||||
next unless /.*.\.yml/.match?(path)
|
||||
|
||||
before do
|
||||
allow(Rails).to receive(:root).and_return(Pathname.new('/tmp'))
|
||||
|
||||
app = instance_double Rails::Application
|
||||
allow(Rails).to receive(:application).and_return app
|
||||
allow(Rails).to receive_messages(root: Pathname.new('/tmp'), application: app)
|
||||
allow(app).to receive(:credentials).and_return({})
|
||||
end
|
||||
|
||||
|
@ -6,8 +6,7 @@ describe ExecutionEnvironment do
|
||||
let(:execution_environment) { described_class.create.tap {|execution_environment| execution_environment.update(network_enabled: nil, privileged_execution: nil) } }
|
||||
|
||||
it 'validates that the Docker image works' do
|
||||
allow(execution_environment).to receive(:validate_docker_image?).and_return(true)
|
||||
allow(execution_environment).to receive(:working_docker_image?).and_return(true)
|
||||
allow(execution_environment).to receive_messages(validate_docker_image?: true, working_docker_image?: true)
|
||||
execution_environment.update(build(:ruby).attributes)
|
||||
expect(execution_environment).to have_received(:working_docker_image?)
|
||||
end
|
||||
|
@ -56,8 +56,7 @@ describe Runner do
|
||||
let(:runner) { described_class.create }
|
||||
|
||||
before do
|
||||
allow(strategy_class).to receive(:request_from_management).and_return(runner_id)
|
||||
allow(strategy_class).to receive(:new).and_return(strategy)
|
||||
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
|
||||
end
|
||||
|
||||
it 'delegates to its strategy' do
|
||||
@ -73,8 +72,7 @@ describe Runner do
|
||||
let(:connection) { instance_double(Runner::Connection) }
|
||||
|
||||
before do
|
||||
allow(strategy_class).to receive(:request_from_management).and_return(runner_id)
|
||||
allow(strategy_class).to receive(:new).and_return(strategy)
|
||||
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
|
||||
allow(event_loop).to receive(:wait)
|
||||
allow(connection).to receive(:error).and_return(nil)
|
||||
allow(Runner::EventLoop).to receive(:new).and_return(event_loop)
|
||||
@ -128,8 +126,7 @@ describe Runner do
|
||||
let(:runner) { described_class.create }
|
||||
|
||||
before do
|
||||
allow(strategy_class).to receive(:request_from_management).and_return(runner_id)
|
||||
allow(strategy_class).to receive(:new).and_return(strategy)
|
||||
allow(strategy_class).to receive_messages(request_from_management: runner_id, new: strategy)
|
||||
end
|
||||
|
||||
it 'delegates to its strategy' do
|
||||
|
Reference in New Issue
Block a user