Apply manual rubocop fixes

This commit is contained in:
Sebastian Serth
2021-05-14 11:07:11 +02:00
parent 6cbecb5b39
commit da0a682ffb
109 changed files with 431 additions and 416 deletions

View File

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

View File

@ -4,11 +4,11 @@ require './exercise'
require './reference'
describe '#fibonacci' do
SAMPLE_COUNT = 32
let(:sample_count) { 32 }
let(:reference) { Class.new.extend(Reference) }
SAMPLE_COUNT.times do |i|
sample_count.times do |i|
instance_eval do
it "obtains the correct result for input #{i}" do
expect(fibonacci(i)).to eq(reference.fibonacci(i))

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Reference
def fibonacci(n)
n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2)
def fibonacci(number)
number < 2 ? number : fibonacci(number - 1) + fibonacci(number - 2)
end
end

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
# Write your code here

View File

@ -29,7 +29,7 @@ FileType.create_factories
# change all resources' author
[ExecutionEnvironment, Exercise, FileType].each do |model|
model.update_all(user_id: InternalUser.first.id)
model.update(user_id: InternalUser.first.id)
end
# delete temporary users

View File

@ -10,5 +10,7 @@ database = SQLite3::Database.new('/database.db')
missing_tuples = database.execute(REFERENCE_QUERY) - database.execute(STUDENT_QUERY)
unexpected_tuples = database.execute(STUDENT_QUERY) - database.execute(REFERENCE_QUERY)
# rubocop:disable Rails/Output
puts("Missing tuples: #{missing_tuples}")
puts("Unexpected tuples: #{unexpected_tuples}")
# rubocop:enable Rails/Output

View File

@ -0,0 +1,3 @@
# frozen_string_literal: true
# Write your code here