fixed multiple style guide violations

This commit is contained in:
Hauke Klement
2015-02-17 10:23:01 +01:00
parent cb87870a46
commit a13d1738e2
32 changed files with 56 additions and 64 deletions

View File

@ -67,7 +67,7 @@ describe Lti do
describe '#return_to_consumer' do
context 'with a return URL' do
let(:consumer_return_url) { 'http://example.org' }
before(:each) { expect(controller).to receive(:params).and_return({launch_presentation_return_url: consumer_return_url}) }
before(:each) { expect(controller).to receive(:params).and_return(launch_presentation_return_url: consumer_return_url) }
it 'redirects to the tool consumer' do
expect(controller).to receive(:redirect_to).with(consumer_return_url)

View File

@ -38,7 +38,7 @@ describe CodeOcean::FilesController do
expect_assigns(file: CodeOcean::File)
it 'destroys the file' do
exercise = FactoryGirl.create(:fibonacci)
FactoryGirl.create(:fibonacci)
expect { request.call }.to change(CodeOcean::File, :count).by(-1)
end

View File

@ -60,7 +60,7 @@ describe ExecutionEnvironmentsController do
let(:command) { 'which ruby' }
before(:each) do
expect(DockerClient).to receive(:new).with(execution_environment: execution_environment, user: user).and_call_original
expect(DockerClient).to receive(:new).with(execution_environment: execution_environment).and_call_original
expect_any_instance_of(DockerClient).to receive(:execute_arbitrary_command).with(command)
post :execute_command, command: command, id: execution_environment.id
end

View File

@ -30,7 +30,7 @@ describe ExercisesController do
end
end
context "with a file upload" do
context 'with a file upload' do
let(:files_attributes) { {'0' => FactoryGirl.build(:file, content: fixture_file_upload('upload.rb', 'text/x-ruby')).attributes} }
let(:request) { proc { post :create, exercise: exercise_attributes.merge(files_attributes: files_attributes) } }
@ -144,7 +144,7 @@ describe ExercisesController do
context 'when the score transmission succeeds' do
before(:each) do
expect(controller).to receive(:send_score).and_return({status: 'success'})
expect(controller).to receive(:send_score).and_return(status: 'success')
request
end
@ -160,7 +160,7 @@ describe ExercisesController do
context 'when the score transmission fails' do
before(:each) do
expect(controller).to receive(:send_score).and_return({status: 'unsupported'})
expect(controller).to receive(:send_score).and_return(status: 'unsupported')
request
end

View File

@ -10,7 +10,7 @@ def create_seed_file(exercise, path, file_attributes = {})
else
file_attributes.merge!(content: SeedsHelper.read_seed_file(path))
end
file = exercise.add_file!(file_attributes)
exercise.add_file!(file_attributes)
end
FactoryGirl.define do
@ -18,7 +18,7 @@ FactoryGirl.define do
created_by_teacher
description "Try HTML's audio and video capabilities."
association :execution_environment, factory: :html
instructions "Build a simple website including an HTML <audio> and <video> element. Link the following media files: chai.ogg, devstories.mp4."
instructions 'Build a simple website including an HTML <audio> and <video> element. Link the following media files: chai.ogg, devstories.mp4.'
title 'Audio & Video'
after(:create) do |exercise|

View File

@ -182,9 +182,7 @@ FactoryGirl.define do
end
%w(binary executable renderable).each do |attribute|
trait(attribute) do
self.send(attribute, true)
end
trait(attribute) { send(attribute, true) }
end
trait :singleton_file_type do

View File

@ -27,10 +27,8 @@ describe DockerContainerPool do
end
it 'destroys all containers' do
described_class.instance_variable_get(:@containers).each do |key, value|
value.each do |container|
expect(DockerClient).to receive(:destroy_container).with(container)
end
described_class.instance_variable_get(:@containers).values.flatten.each do |container|
expect(DockerClient).to receive(:destroy_container).with(container)
end
end
end

View File

@ -10,7 +10,7 @@ describe JunitAdapter do
let(:stdout) { "FAILURES!!!\nTests run: #{count}, Failures: #{failed}" }
it 'returns the correct numbers' do
expect(adapter.parse_output(stdout: stdout)).to eq({count: count, failed: failed})
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, failed: failed)
end
end
@ -19,7 +19,7 @@ describe JunitAdapter do
let(:stdout) { "OK (#{count} tests)" }
it 'returns the correct numbers' do
expect(adapter.parse_output(stdout: stdout)).to eq({count: count, passed: count})
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, passed: count)
end
end
end

View File

@ -8,7 +8,7 @@ describe PyUnitAdapter do
describe '#parse_output' do
it 'returns the correct numbers' do
expect(adapter.parse_output(stderr: stderr)).to eq({count: count, failed: failed})
expect(adapter.parse_output(stderr: stderr)).to eq(count: count, failed: failed)
end
end
end

View File

@ -8,7 +8,7 @@ describe RspecAdapter do
describe '#parse_output' do
it 'returns the correct numbers' do
expect(adapter.parse_output(stdout: stdout)).to eq({count: count, failed: failed})
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, failed: failed)
end
end
end

View File

@ -8,7 +8,7 @@ describe SqlResultSetComparatorAdapter do
let(:stdout) { "Missing tuples: [1]\nUnexpected tuples: []" }
it 'considers the test as failed' do
expect(adapter.parse_output(stdout: stdout)).to eq({count: 1, failed: 1})
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, failed: 1)
end
end
@ -16,7 +16,7 @@ describe SqlResultSetComparatorAdapter do
let(:stdout) { "Missing tuples: []\nUnexpected tuples: [1]" }
it 'considers the test as failed' do
expect(adapter.parse_output(stdout: stdout)).to eq({count: 1, failed: 1})
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, failed: 1)
end
end
@ -24,7 +24,7 @@ describe SqlResultSetComparatorAdapter do
let(:stdout) { "Missing tuples: []\nUnexpected tuples: []" }
it 'considers the test as passed' do
expect(adapter.parse_output(stdout: stdout)).to eq({count: 1, passed: 1})
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, passed: 1)
end
end
end

View File

@ -21,7 +21,7 @@ describe CodeOcean::File do
context 'as a teacher-defined test' do
before(:each) { file.update(role: 'teacher_defined_test') }
it 'validates the presence of a feedback message' do
expect(file.errors[:feedback_message]).to be_present
end

View File

@ -81,7 +81,7 @@ describe ExecutionEnvironment do
context 'when the command produces an error' do
it 'adds an error' do
expect_any_instance_of(DockerClient).to receive(:execute_arbitrary_command).and_return({stderr: 'command not found'})
expect_any_instance_of(DockerClient).to receive(:execute_arbitrary_command).and_return(stderr: 'command not found')
working_docker_image?
expect(execution_environment.errors[:docker_image]).to be_present
end

View File

@ -1,7 +1,7 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
ENV['RAILS_ENV'] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'pundit/rspec'
@ -12,7 +12,7 @@ require 'pundit/rspec'
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.

View File

@ -3,7 +3,7 @@ class AnonymousController < ApplicationController
@flash ||= {}
end
def redirect_to(*options)
def redirect_to(*)
end
def session