Apply automatic rubocop fixes

This commit is contained in:
Sebastian Serth
2021-05-14 10:51:44 +02:00
parent fe4000916c
commit 6cbecb5b39
440 changed files with 2705 additions and 1853 deletions

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rack/file'
require 'capybara/rspec'

View File

@ -18,7 +18,7 @@ external_user = FactoryBot.create(:external_user)
ExecutionEnvironment.create_factories user: admin
# exercises
@exercises = find_factories_by_class(Exercise).map(&:name).map { |factory_name| [factory_name, FactoryBot.create(factory_name, user: teacher)] }.to_h
@exercises = find_factories_by_class(Exercise).map(&:name).index_with {|factory_name| FactoryBot.create(factory_name, user: teacher) }
# file types
FileType.create_factories

View File

@ -1,2 +1,3 @@
def fibonacci(n)
end
# frozen_string_literal: true
def fibonacci(n); end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require './exercise'
describe '#fibonacci' do

View File

@ -1,9 +1,11 @@
# frozen_string_literal: true
require './exercise'
describe '#fibonacci' do
it 'works recursively' do
@n = 16
expect(self).to receive(:fibonacci).and_call_original.at_least(@n ** 2).times
expect(self).to receive(:fibonacci).and_call_original.at_least(@n**2).times
fibonacci(@n)
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require './exercise'
require './reference'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Reference
def fibonacci(n)
n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
SOURCE_FILENAME = 'data.txt'
TARGET_FILENAME = 'copy.txt'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require './exercise'
describe '#write_to_file' do

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
describe 'Exercise' do
it "outputs 'Hello World" do
expect($stdout).to receive(:puts).with('Hello World')

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'highline/import'
# consumers
@ -7,7 +9,7 @@ FactoryBot.create(:consumer)
email = ask('Enter admin email: ')
passwords = ['password', 'password confirmation'].map do |attribute|
ask("Enter admin #{attribute}: ") { |question| question.echo = false }
ask("Enter admin #{attribute}: ") {|question| question.echo = false }
end
if passwords.uniq.length == 1

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'sqlite3'
REFERENCE_QUERY = File.new('reference.sql', 'r').read

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
describe 'Exercise' do
it 'includes a successful example' do
expect(true).to be true

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'sinatra'
set :bind, '0.0.0.0'