Skip to content

Commit 25f506e

Browse files
committed
adding lesson update tests to check project and remixes are renamed
1 parent 5721d90 commit 25f506e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

spec/concepts/lesson/update_spec.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
require 'rails_helper'
44

55
RSpec.describe Lesson::Update, type: :unit do
6-
let(:lesson) { create(:lesson, name: 'Test Lesson') }
6+
let(:school) { create(:school) }
7+
let(:teacher) { create(:teacher, school:) }
8+
let(:student) { create(:student, school:) }
9+
let(:lesson) { create(:lesson, name: 'Test Lesson', user_id: teacher.id) }
10+
let!(:student_project) { create(:project, remixed_from_id: lesson.project.id, user_id: student.id) }
711

812
let(:lesson_params) do
913
{ name: 'New Name' }
@@ -19,6 +23,17 @@
1923
expect(response[:lesson].name).to eq('New Name')
2024
end
2125

26+
it 'updates the project name' do
27+
described_class.call(lesson:, lesson_params:)
28+
expect(lesson.project.name).to eq('New Name')
29+
end
30+
31+
it 'updates the student project name' do
32+
described_class.call(lesson:, lesson_params:)
33+
student_remixes = lesson.project.remixes
34+
expect(student_remixes.first.name).to eq('New Name')
35+
end
36+
2237
it 'returns the lesson in the operation response' do
2338
response = described_class.call(lesson:, lesson_params:)
2439
expect(response[:lesson]).to be_a(Lesson)

0 commit comments

Comments
 (0)