Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,10 @@ GEM
rack (>= 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
rubocop-rspec (3.9.0)
rubocop-rspec (3.10.0)
lint_roller (~> 1.1)
rubocop (~> 1.81)
regexp_parser (>= 2.0)
rubocop (~> 1.86, >= 1.86.2)
rubocop-rspec_rails (2.32.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/class_member/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school_class:, students:, teachers:)
expect(response[:error]).to match(/No valid school members provided/)
expect(response[:error]).to include('No valid school members provided')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/class_member/delete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school_class:, class_member_id:)
expect(response[:error]).to match(/does-not-exist/)
expect(response[:error]).to include('does-not-exist')
end

it 'sent the exception to Sentry' do
Expand Down
4 changes: 2 additions & 2 deletions spec/concepts/feedback/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@

it 'returns the error message in the operation response' do
response = described_class.call(feedback_params:)
expect(response[:error]).to match(/Error creating feedback/)
expect(response[:error]).to include('Error creating feedback')
end

it 'raises school project not found error when no school project' do
response = described_class.call(feedback_params:)
expect(response[:error]).to match(/School project must exist/)
expect(response[:error]).to include('School project must exist')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/feedback/delete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(feedback_id:)
expect(response[:error]).to match(/does-not-exist/)
expect(response[:error]).to include('does-not-exist')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/lesson/create_copy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(lesson:, lesson_params:)
expect(response[:error]).to match(/Error creating copy of lesson/)
expect(response[:error]).to include('Error creating copy of lesson')
end

it 'sent the exception to Sentry' do
Expand Down
4 changes: 2 additions & 2 deletions spec/concepts/lesson/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(lesson_params:)
expect(response[:error]).to match(/Error creating lesson/)
expect(response[:error]).to include('Error creating lesson')
end

it 'sent the exception to Sentry' do
Expand Down Expand Up @@ -151,7 +151,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(lesson_params:)
expect(response[:error]).to match(/Error creating lesson/)
expect(response[:error]).to include('Error creating lesson')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/lesson/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(lesson:, lesson_params:)
expect(response[:error]).to match(/Error updating lesson/)
expect(response[:error]).to include('Error updating lesson')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/project/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
end

it 'returns an error message' do
expect(update[:error]).to match(/Projects with instructions must belong to a school/)
expect(update[:error]).to include('Projects with instructions must belong to a school')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school/delete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school_id:)
expect(response[:error]).to match(/does-not-exist/)
expect(response[:error]).to include('does-not-exist')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school:, school_params:)
expect(response[:error]).to match(/Error updating school/)
expect(response[:error]).to include('Error updating school')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school_class/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school:, school_class_params:, current_user: teacher)
expect(response[:error]).to match(/Error creating school class/)
expect(response[:error]).to include('Error creating school class')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school_class/delete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school:, school_class_id:)
expect(response[:error]).to match(/does-not-exist/)
expect(response[:error]).to include('does-not-exist')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school_class/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school_class:, school_class_params:)
expect(response[:error]).to match(/Error updating school/)
expect(response[:error]).to include('Error updating school')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school_student/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school:, school_student_params:, token:)
expect(response[:error]).to match(/username '' is invalid/)
expect(response[:error]).to include("username '' is invalid")
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school_student/delete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school:, student_id:, token:)
expect(response[:error]).to match(/Some API error/)
expect(response[:error]).to include('Some API error')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school_student/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school:, token:, student_ids:)
expect(response[:error]).to match(/Some API error/)
expect(response[:error]).to include('Some API error')
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school_student/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school:, student_id:, school_student_params:, token:)
expect(response[:error]).to match(/username ' ' is invalid/)
expect(response[:error]).to include("username ' ' is invalid")
end

it 'sent the exception to Sentry' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concepts/school_teacher/invite_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

it 'returns the error message in the operation response' do
response = described_class.call(school:, school_teacher_params:, token:)
expect(response[:error]).to match(/Email address 'invalid' is invalid/)
expect(response[:error]).to include("Email address 'invalid' is invalid")
end

it 'sent the exception to Sentry' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
post("/api/schools/#{school.id}/classes/#{school_class.id}/members/batch", headers:, params:)
data = JSON.parse(response.body, symbolize_names: true)
member_not_added = data.find { |result| result[:user_id] == existing_class_member_id && result[:success] == false }
expect(member_not_added[:error]).to match(/Student has already been taken/)
expect(member_not_added[:error]).to include('Student has already been taken')
end

it 'returns success result for members that could be added' do
Expand Down Expand Up @@ -187,7 +187,7 @@
it 'returns the error message in the operation response' do
post("/api/schools/#{school.id}/classes/#{school_class.id}/members/batch", headers:, params: invalid_params)
data = JSON.parse(response.body, symbolize_names: true)
expect(data[:error]).to match(/No valid school members provided/)
expect(data[:error]).to include('No valid school members provided')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/features/class_member/creating_a_class_member_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
post("/api/schools/#{school.id}/classes/#{school_class.id}/members", headers:, params: invalid_params)
data = JSON.parse(response.body, symbolize_names: true)

expect(data[:error]).to match(/No valid school members provided/)
expect(data[:error]).to include('No valid school members provided')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/features/feedback/deleting_feedback_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

it 'returns an error message' do
data = JSON.parse(response.body, symbolize_names: true)
expect(data[:error]).to match(/Couldn't find Feedback with 'id'="invalid-id"/)
expect(data[:error]).to include("Couldn't find Feedback with 'id'=\"invalid-id\"")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@

# First student should have error
failed_result = json['results'].find { |r| r['user_id'] == student_1.id }
expect(failed_result['error']).to match(/StandardError: Profile API error/)
expect(failed_result['error']).to include('StandardError: Profile API error')

# Second student should succeed
success_result = json['results'].find { |r| r['user_id'] == student_2.id }
Expand Down
6 changes: 3 additions & 3 deletions spec/graphql/mutations/delete_project_mutation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
let(:project_id) { 'dummy' }

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/not found/)
expect(result.dig('errors', 0, 'message')).to include('not found')
end
end

Expand All @@ -67,7 +67,7 @@
end

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/not permitted/)
expect(result.dig('errors', 0, 'message')).to include('not permitted')
end
end

Expand All @@ -79,7 +79,7 @@
end

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/Deletion failed/)
expect(result.dig('errors', 0, 'message')).to include('Deletion failed')
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/graphql/mutations/remix_project_mutation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
end

it 'returns "not permitted to create" error' do
expect(result.dig('errors', 0, 'message')).to match(/not permitted to create/)
expect(result.dig('errors', 0, 'message')).to include('not permitted to create')
end
end

context 'when original project not found' do
let(:project_id) { SecureRandom.uuid }

it 'returns "not found" error' do
expect(result.dig('errors', 0, 'message')).to match(/not found/)
expect(result.dig('errors', 0, 'message')).to include('not found')
end

it 'does not create a project' do
Expand All @@ -60,7 +60,7 @@
end

it 'returns "not permitted to read" error' do
expect(result.dig('errors', 0, 'message')).to match(/not permitted to read/)
expect(result.dig('errors', 0, 'message')).to include('not permitted to read')
end

it 'does not create a project' do
Expand Down
6 changes: 3 additions & 3 deletions spec/graphql/mutations/update_component_mutation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
let(:component_id) { 'dummy' }

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/not found/)
expect(result.dig('errors', 0, 'message')).to include('not found')
end
end

Expand All @@ -84,7 +84,7 @@
end

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/not permitted/)
expect(result.dig('errors', 0, 'message')).to include('not permitted')
end
end

Expand All @@ -96,7 +96,7 @@
end

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/An error message/)
expect(result.dig('errors', 0, 'message')).to include('An error message')
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/graphql/mutations/update_project_mutation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
let(:project_id) { 'dummy' }

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/not found/)
expect(result.dig('errors', 0, 'message')).to include('not found')
end
end

Expand All @@ -80,7 +80,7 @@
end

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/not permitted/)
expect(result.dig('errors', 0, 'message')).to include('not permitted')
end
end

Expand All @@ -92,7 +92,7 @@
end

it 'returns an error' do
expect(result.dig('errors', 0, 'message')).to match(/An error message/)
expect(result.dig('errors', 0, 'message')).to include('An error message')
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/services/student_removal_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
results = service.remove_students

# Should have error in result
expect(results.first[:error]).to match(/Profile API failure/)
expect(results.first[:error]).to include('Profile API failure')

# Database changes should have been rolled back
expect(Project.exists?(project.id)).to be true
Expand All @@ -181,7 +181,7 @@
it 'handles errors gracefully' do
allow(ClassStudent).to receive(:joins).and_raise(StandardError, 'fail')
results = service.remove_students
expect(results.first[:error]).to match(/StandardError: fail/)
expect(results.first[:error]).to include('StandardError: fail')
end

it 'continues processing other students after an error' do
Expand All @@ -197,7 +197,7 @@
results = service.remove_students

expect(results.length).to eq(2)
expect(results.first[:error]).to match(/StandardError/)
expect(results.first[:error]).to include('StandardError')
# Second student should succeed
expect(Role.where(user_id: second_student.id, school: school, role: :student)).not_to exist
end
Expand Down
Loading