Skip to content

Commit 874ef29

Browse files
author
Scott Adams
committed
rubocop
1 parent 4e07b5e commit 874ef29

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

app/models/project.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def user_has_a_role_within_the_school
8080
end
8181

8282
def user_is_a_member_or_the_owner_of_the_lesson
83-
return if !lesson || user_id == lesson.user_id || (lesson.school_class && lesson.school_class.members.exists?(student_id: user_id))
83+
return if !lesson || user_id == lesson.user_id || lesson.school_class&.members&.exists?(student_id: user_id)
8484

8585
errors.add(:user, "'#{user_id}' is not the owner or a member of the lesson '#{lesson_id}'")
8686
end

spec/features/lesson/updating_a_lesson_spec.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
require 'rails_helper'
44

55
RSpec.describe 'Updating a lesson', type: :request do
6-
before do
7-
authenticated_in_hydra_as(owner)
8-
stub_user_info_api_for(teacher)
9-
end
10-
116
let(:headers) { { Authorization: UserProfileMock::TOKEN } }
127
let(:params) do
138
{
@@ -23,6 +18,8 @@
2318
let(:project) { create(:project) }
2419

2520
before do
21+
authenticated_in_hydra_as(owner)
22+
stub_user_info_api_for(teacher)
2623
lesson
2724
project.update!(lesson:, school:, user_id: lesson.user_id, identifier: 'something')
2825
end

0 commit comments

Comments
 (0)