Autoformat code with rubocop

This commit is contained in:
Nelson Jovel 2022-03-04 15:29:54 +01:00
parent 68dde8a6ef
commit ed7a3b8a3d
43 changed files with 112 additions and 114 deletions

View file

@ -16,38 +16,38 @@ module Legacy
end
let(:schedule) do
Schedule.create(name: 'Test Schedule', question_list: question_list, recipient_list: recipient_list)
Schedule.create(name: 'Test Schedule', question_list:, recipient_list:)
end
let(:school) { Legacy::School.create!(name: 'School') }
let(:recipient_schedule) do
RecipientSchedule.create(recipient: recipients.first, schedule: schedule, next_attempt_at: Time.now)
RecipientSchedule.create(recipient: recipients.first, schedule:, next_attempt_at: Time.now)
end
let(:recipient_schedule2) do
RecipientSchedule.create(recipient: recipients.last, schedule: schedule, next_attempt_at: Time.now)
RecipientSchedule.create(recipient: recipients.last, schedule:, next_attempt_at: Time.now)
end
let!(:first_attempt) do
Attempt.create(
schedule: schedule,
schedule:,
recipient: recipients.first,
recipient_schedule: recipient_schedule,
recipient_schedule:,
question: questions.first,
sent_at: Time.new
)
end
let!(:attempt) do
Attempt.create(
schedule: schedule,
schedule:,
recipient: recipients.first,
recipient_schedule: recipient_schedule,
recipient_schedule:,
question: questions.first,
sent_at: Time.new
)
end
let!(:attempt2) do
Attempt.create(
schedule: schedule,
schedule:,
recipient: recipients.last,
recipient_schedule: recipient_schedule2,
question: questions.first,

View file

@ -45,7 +45,7 @@ module Legacy
let(:valid_session) { {} }
before :each do
user.user_schools.create(school: school)
user.user_schools.create(school:)
sign_in user
end

View file

@ -42,7 +42,7 @@ module Legacy
let(:valid_session) { {} }
before :each do
user.user_schools.create(school: school)
user.user_schools.create(school:)
sign_in user
end

View file

@ -57,7 +57,7 @@ module Legacy
let(:valid_session) { {} }
before :each do
user.user_schools.create(school: school)
user.user_schools.create(school:)
sign_in user
end

View file

@ -21,15 +21,15 @@ require 'rails_helper'
module Legacy
RSpec.describe SchoolsController, type: :controller do
let(:district) { District.create! name: 'District' }
let!(:school) { School.create! name: 'school', district: district }
let!(:school) { School.create! name: 'school', district: }
let!(:user) { User.create(email: 'test@example.com', password: '123456') }
let!(:user_school) { user.user_schools.create(school: school) }
let!(:user_school) { user.user_schools.create(school:) }
# This should return the minimal set of attributes required to create a valid
# School. As you add validations to School, be sure to
# adjust the attributes here as well.
let(:valid_attributes) do
{ name: 'School', district: district }
{ name: 'School', district: }
end
let(:invalid_attributes) do

View file

@ -17,7 +17,7 @@ module Legacy
let(:ready_recipient_schedule) { double('ready recipient schedule', attempt_question: nil) }
let(:recipient_schedules) { double('recipient schedules', ready: [ready_recipient_schedule]) }
let(:active_schedule) { double('active schedule', recipient_schedules: recipient_schedules) }
let(:active_schedule) { double('active schedule', recipient_schedules:) }
it 'finds all active schedules' do
date = ActiveSupport::TimeZone['UTC'].parse(now.strftime('%Y-%m-%dT20:00:00%z'))
@ -64,7 +64,7 @@ module Legacy
Schedule.create!(
name: 'Parent Schedule',
recipient_list_id: recipient_list.id,
question_list: question_list,
question_list:,
frequency_hours: 24 * 7,
start_date: Time.new,
end_date: 1.year.from_now,

View file

@ -16,13 +16,13 @@ module Legacy
end
let(:schedule) do
Schedule.create!(name: 'Parent Schedule', recipient_list_id: recipient_list.id, question_list: question_list)
Schedule.create!(name: 'Parent Schedule', recipient_list_id: recipient_list.id, question_list:)
end
let(:recipient_schedule) do
RecipientSchedule.create!(
recipient: recipient,
schedule: schedule,
recipient:,
schedule:,
upcoming_question_ids: "#{question.id},3",
attempted_question_ids: '2',
last_attempt_at: 2.weeks.ago,
@ -32,9 +32,9 @@ module Legacy
let!(:attempt) do
recipient.attempts.create(
schedule: schedule,
recipient_schedule: recipient_schedule,
question: question
schedule:,
recipient_schedule:,
question:
)
end

View file

@ -31,7 +31,7 @@ module Legacy
Schedule.create!(
name: 'Parent Schedule',
recipient_list_id: recipient_list.id,
question_list: question_list,
question_list:,
random: false,
frequency_hours: 24 * 7
)

View file

@ -19,7 +19,7 @@ module Legacy
Schedule.create!(
name: 'Parent Schedule',
recipient_list_id: recipient_list.id,
question_list: question_list,
question_list:,
random: false,
frequency_hours: 24
)
@ -28,8 +28,8 @@ module Legacy
let!(:not_ready_recipient_schedule) do
RecipientSchedule.create!(
recipient: recipient,
schedule: schedule,
recipient:,
schedule:,
upcoming_question_ids: '1,3',
attempted_question_ids: '2',
last_attempt_at: Date.today + (60 * 60 * schedule.frequency_hours),

View file

@ -33,7 +33,7 @@ module Legacy
Schedule.create!(
name: 'Parent Schedule',
recipient_list_id: recipient_list.id,
question_list: question_list,
question_list:,
random: false,
frequency_hours: 24 * 7
)

View file

@ -21,9 +21,9 @@ module Legacy
let(:default_schedule_params) do
{
school: school,
recipient_list: recipient_list,
question_list: question_list,
school:,
recipient_list:,
question_list:,
name: 'Parents Schedule',
description: 'Schedule for parent questions',
start_date: 1.month.ago,

View file

@ -6,33 +6,33 @@ describe CategoryPresenter do
subcategory2 = Subcategory.create(name: 'Another subcategory', subcategory_id: '2')
category = Category.create(name: 'Some Category', subcategories: [subcategory1, subcategory2],
description: 'A description for some Category', short_description: 'A short description for some Category', category_id: '1')
return CategoryPresenter.new(category: category)
description: 'A description for some Category', short_description: 'A short description for some Category', category_id: '1')
return CategoryPresenter.new(category:)
end
let(:teachers_and_leadership_presenter) do
category = create(:category, name: 'Teachers & Leadership')
return CategoryPresenter.new(category: category)
return CategoryPresenter.new(category:)
end
let(:school_culture_presenter) do
category = create(:category, name: 'School Culture')
return CategoryPresenter.new(category: category)
return CategoryPresenter.new(category:)
end
let(:resources_presenter) do
category = create(:category, name: 'Resources')
return CategoryPresenter.new(category: category)
return CategoryPresenter.new(category:)
end
let(:academic_learning_presenter) do
category = create(:category, name: 'Academic Learning')
return CategoryPresenter.new(category: category)
return CategoryPresenter.new(category:)
end
let(:community_and_wellbeing_presenter) do
category = create(:category, name: 'Community & Wellbeing')
return CategoryPresenter.new(category: category)
return CategoryPresenter.new(category:)
end
after :each do

View file

@ -11,7 +11,7 @@ describe GaugePresenter do
end
let(:score) { 3 }
let(:gauge_presenter) { GaugePresenter.new(zones: zones, score: score) }
let(:gauge_presenter) { GaugePresenter.new(zones:, score:) }
it 'returns the key benchmark percentage for the gauge' do
expect(gauge_presenter.key_benchmark_percentage).to eq 0.625

View file

@ -10,7 +10,7 @@ describe SubcategoryCardPresenter do
)
end
let(:subcategory_card_presenter) { SubcategoryCardPresenter.new(name: 'Card name', zones: zones, score: score) }
let(:subcategory_card_presenter) { SubcategoryCardPresenter.new(name: 'Card name', zones:, score:) }
context 'when the given score is in the Warning zone for the given scale' do
let(:score) { 1 }

View file

@ -68,11 +68,11 @@ describe SubcategoryPresenter do
end
it 'returns the student response rate' do
expect(subcategory_presenter.student_response_rate).to eq "25%"
expect(subcategory_presenter.student_response_rate).to eq '25%'
end
it 'returns the teacher response rate' do
expect(subcategory_presenter.teacher_response_rate).to eq "50%"
expect(subcategory_presenter.teacher_response_rate).to eq '50%'
end
it 'returns the admin collection rate' do

View file

@ -1,14 +1,14 @@
require 'simplecov'
SimpleCov.start do
add_filter "/app/models/legacy"
add_filter "/app/views/legacy"
add_filter "/app/controllers/legacy"
add_filter "/spec/models/legacy"
add_filter "/spec/views/legacy"
add_filter "/spec/controllers/legacy"
add_filter "/app/helpers/schedules_helper.rb"
add_filter "/lib/tasks/survey.rake"
add_filter "/spec/lib/tasks/survey_rake_spec.rb"
add_filter '/app/models/legacy'
add_filter '/app/views/legacy'
add_filter '/app/controllers/legacy'
add_filter '/spec/models/legacy'
add_filter '/spec/views/legacy'
add_filter '/spec/controllers/legacy'
add_filter '/app/helpers/schedules_helper.rb'
add_filter '/lib/tasks/survey.rake'
add_filter '/spec/lib/tasks/survey_rake_spec.rb'
end
require 'capybara/rspec'
@ -184,7 +184,7 @@ def create_questions(count, category = nil)
option3: "Option #{i}:#{count} C",
option4: "Option #{i}:#{count} D",
option5: "Option #{i}:#{count} E",
category: category
category:
)
end
questions

View file

@ -2,7 +2,7 @@ require 'rails_helper'
describe 'authentication' do
let(:district) { create(:district) }
let(:school) { create(:school, district: district) }
let(:school) { create(:school, district:) }
let(:academic_year) { create(:academic_year) }
context 'when using the wrong credentials' do

View file

@ -2,11 +2,11 @@ require 'rails_helper'
describe 'SQM Application' do
let(:district) { create(:district) }
let(:school) { create(:school, district: district) }
let(:school) { create(:school, district:) }
let(:academic_year) { create(:academic_year) }
let(:category) { create(:category) }
let(:measure) { create(:measure) }
let(:scale) {create(:scale, measure:)}
let(:scale) { create(:scale, measure:) }
before :each do
driven_by :rack_test
@ -30,7 +30,7 @@ describe 'SQM Application' do
before :each do
teacher_survey_item = create(:teacher_survey_item, scale:)
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD,
survey_item: teacher_survey_item, academic_year: academic_year, school: school)
survey_item: teacher_survey_item, academic_year:, school:)
end
it 'does not show a modal on any page' do

View file

@ -6,7 +6,7 @@ module Legacy
@school = assign(:school, School.create!(name: 'School'))
recipients = ['Jared Cosulich', 'Lauren Cosulich'].collect do |name|
@school.recipients.create!(name: name)
@school.recipients.create!(name:)
end
@recipient_list = assign(:recipient_list, RecipientList.create!(