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

@ -7,7 +7,7 @@ describe 'Authentication' do
let(:password) { FactoryBot.attributes_for(:admin)[:password] }
context 'when signed out' do
before(:each) { visit(root_path) }
before { visit(root_path) }
it 'displays a sign in link' do
expect(page).to have_content(I18n.t('sessions.new.link'))
@ -35,7 +35,7 @@ describe 'Authentication' do
end
context 'when signed in' do
before(:each) do
before do
sign_in(user, password)
visit(root_path)
end

View File

@ -5,7 +5,8 @@ require 'rails_helper'
describe 'Authorization' do
context 'as an admin' do
let(:user) { FactoryBot.create(:admin) }
before(:each) { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
before { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
[Consumer, ExecutionEnvironment, Exercise, FileType, InternalUser].each do |model|
expect_permitted_path(:"new_#{model.model_name.singular}_path")
@ -14,7 +15,8 @@ describe 'Authorization' do
context 'as an external user' do
let(:user) { FactoryBot.create(:external_user) }
before(:each) { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
before { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
[Consumer, ExecutionEnvironment, Exercise, FileType, InternalUser].each do |model|
expect_forbidden_path(:"new_#{model.model_name.singular}_path")
@ -23,7 +25,8 @@ describe 'Authorization' do
context 'as a teacher' do
let(:user) { FactoryBot.create(:teacher) }
before(:each) { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
before { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }
[Consumer, InternalUser, ExecutionEnvironment, FileType].each do |model|
expect_forbidden_path(:"new_#{model.model_name.singular}_path")

View File

@ -19,7 +19,7 @@ describe 'Editor', js: true do
score: 1.0,
filename: 'index.html_spec.rb',
message: 'Well done.',
weight: 2.0
weight: 2.0,
}]
end
let(:user) { FactoryBot.create(:teacher) }
@ -60,7 +60,7 @@ describe 'Editor', js: true do
context 'when selecting a binary file' do
context 'when selecting an audio file' do
let(:file) { exercise.files.detect { |file| file.file_type.audio? } }
let(:file) { exercise.files.detect {|file| file.file_type.audio? } }
it 'contains an <audio> tag' do
expect(page).to have_css("audio[src='#{file.native_file.url}']")
@ -68,7 +68,7 @@ describe 'Editor', js: true do
end
context 'when selecting an image file' do
let(:file) { exercise.files.detect { |file| file.file_type.image? } }
let(:file) { exercise.files.detect {|file| file.file_type.image? } }
it 'contains an <img> tag' do
expect(page).to have_css("img[src='#{file.native_file.url}']")
@ -76,7 +76,7 @@ describe 'Editor', js: true do
end
context 'when selecting a video file' do
let(:file) { exercise.files.detect { |file| file.file_type.video? } }
let(:file) { exercise.files.detect {|file| file.file_type.video? } }
it 'contains a <video> tag' do
expect(page).to have_css("video[src='#{file.native_file.url}']")
@ -85,7 +85,7 @@ describe 'Editor', js: true do
end
context 'when selecting a non-binary file' do
let(:file) { exercise.files.detect { |file| !file.file_type.binary? && !file.hidden? } }
let(:file) { exercise.files.detect {|file| !file.file_type.binary? && !file.hidden? } }
it "displays the file's code" do
expect(page).to have_css(".frame[data-filename='#{file.name_with_extension}']")

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'Factories' do

View File

@ -3,7 +3,6 @@
require 'rails_helper'
describe Prometheus::Controller do
let(:codeocean_config) { instance_double(CodeOcean::Config) }
let(:prometheus_config) { {prometheus_exporter: {enabled: true}} }

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'Request_for_Comments' do