Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Aug 1, 2024
1 parent abd9f90 commit f4e0c96
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/models/validators/feedback_answer_format_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def validate(record)
if kind =~ FeedbackQuestion.send(:intrange_regex)
range = (Regexp.last_match(1).to_i)..(Regexp.last_match(2).to_i)
if !/^(-?\d+)$/.match?(ans)
record.errors.add(:answer, "is not an integer")
record.errors.add(:answer, 'is not an integer')
elsif !range.include?(ans.to_i)
record.errors.add(:answer, "is not between #{range.first}..#{range.last}")
end
Expand Down
14 changes: 7 additions & 7 deletions spec/controllers/course_templates_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
it 'should respond with a 302 and redirect to login with correct return_to param' do
get :index, params: {}
expect(response.code.to_i).to eq(302)
expect(response.headers["Location"]).to include('/login?return_to=%2Fcourse_templates')
expect(response.headers['Location']).to include('/login?return_to=%2Fcourse_templates')
end
end

Expand All @@ -249,15 +249,15 @@
it 'should respond with a 302 and redirect to login with correct return_to param' do
get :edit, params: { id: @course_template.to_param }
expect(response.code.to_i).to eq(302)
expect(response.headers["Location"]).to include('/login?return_to=%2Fcourse_templates')
expect(response.headers['Location']).to include('/login?return_to=%2Fcourse_templates')
end
end

describe 'GET new' do
it 'should respond with a 302 and redirect to login with correct return_to param' do
get :new
expect(response.code.to_i).to eq(302)
expect(response.headers["Location"]).to include('/login?return_to=%2Fcourse_templates')
expect(response.headers['Location']).to include('/login?return_to=%2Fcourse_templates')
end
end

Expand All @@ -269,7 +269,7 @@
it 'should respond with a 302 and redirect to login with correct return_to param' do
get :edit, params: { id: @course_template.to_param }
expect(response.code.to_i).to eq(302)
expect(response.headers["Location"]).to include('/login?return_to=%2Fcourse_templates')
expect(response.headers['Location']).to include('/login?return_to=%2Fcourse_templates')
end
end

Expand All @@ -283,7 +283,7 @@
it 'should respond with a 302 and redirect to login with correct return_to param' do
post :create, params: { course_template: valid_attributes }
expect(response.code.to_i).to eq(302)
expect(response.headers["Location"]).to include('/login?return_to=%2Fcourse_templates')
expect(response.headers['Location']).to include('/login?return_to=%2Fcourse_templates')
end
end

Expand All @@ -300,7 +300,7 @@
it 'should respond with a 302 and redirect to login with correct return_to param' do
put :update, params: { id: @course_template.to_param, course_template: invalid_attributes }
expect(response.code.to_i).to eq(302)
expect(response.headers["Location"]).to include('/login?return_to=%2Fcourse_templates')
expect(response.headers['Location']).to include('/login?return_to=%2Fcourse_templates')
end
end

Expand All @@ -318,7 +318,7 @@
it 'should respond with a 302 and redirect to login with correct return_to param' do
delete :destroy, params: { id: @course_template.to_param }
expect(response.code.to_i).to eq(302)
expect(response.headers["Location"]).to include('/login?return_to=%2Fcourse_templates')
expect(response.headers['Location']).to include('/login?return_to=%2Fcourse_templates')
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/participants_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
it 'redirects me to login page' do
get :me
expect(response.code.to_i).to eq(302)
expect(response.headers["Location"]).to include('login?return_to=%2Fparticipants%2Fme')
expect(response.headers['Location']).to include('login?return_to=%2Fparticipants%2Fme')
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
it 'should redirect to login page' do
get :show
expect(response.status).to eq(302)
expect(response.headers["Location"]).to include('/login?return_to=%2Fuser')
expect(response.headers['Location']).to include('/login?return_to=%2Fuser')
end

it 'should deny access if signup is disabled in site settings' do
Expand Down
8 changes: 4 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require 'etc'
require 'fileutils'
require 'capybara/rspec'
require "capybara/cuprite"
require 'capybara/cuprite'
require 'simplecov'
require 'tailoring'
# require 'rspec_remote_formatter'
Expand Down Expand Up @@ -54,16 +54,16 @@
config.before(:each, type: :system) do
driven_by(:cuprite, screen_size: [1440, 810], options: {
js_errors: false,
headless: %w[0 false].exclude?(ENV["HEADLESS"]),
slowmo: ENV["SLOWMO"]&.to_f,
headless: %w[0 false].exclude?(ENV['HEADLESS']),
slowmo: ENV['SLOWMO']&.to_f,
process_timeout: 15,
timeout: 10,
browser_options: { 'no-sandbox': nil },
pending_connection_errors: false
})
end

config.filter_gems_from_backtrace("capybara", "cuprite", "ferrum")
config.filter_gems_from_backtrace('capybara', 'cuprite', 'ferrum')
end

def get_m3_home
Expand Down

0 comments on commit f4e0c96

Please sign in to comment.