fix specs
This commit is contained in:
@@ -15,33 +15,33 @@ RSpec.describe BroadcastRecordingsController, type: :controller do
|
||||
describe "#update" do
|
||||
let(:broadcast) { create(:broadcast, project: project, name: "New Broadcast") }
|
||||
let(:recordings) { create_list(:broadcast_recording, 5, :with_random_asset_uid, broadcast: broadcast) }
|
||||
let(:starred_recordings) { create_list(:broadcast_recording, 5, :with_random_asset_uid, broadcast: broadcast, star: true) }
|
||||
let(:starred_recordings) { create_list(:broadcast_recording, 5, :with_random_asset_uid, broadcast: broadcast, starred: true) }
|
||||
|
||||
it "sets star property to true when recording is starred" do
|
||||
recordings.each do |recording|
|
||||
expect(recording.star).to be_falsey
|
||||
expect(recording.starred).to be_falsey
|
||||
end
|
||||
|
||||
put :update, params: { project_id: project, broadcast_id: broadcast, id: recordings.first.id }, xhr: true
|
||||
|
||||
expect(recordings.first.reload.star).to eq true
|
||||
expect(recordings.first.reload.starred).to eq true
|
||||
|
||||
recordings[1..5].each do |recording|
|
||||
expect(recording.reload.star).to be_falsey
|
||||
expect(recording.reload.starred).to be_falsey
|
||||
end
|
||||
end
|
||||
|
||||
it "sets star property to false when recording is unstarred" do
|
||||
starred_recordings.each do |recording|
|
||||
expect(recording.star).to be_truthy
|
||||
expect(recording.starred).to be_truthy
|
||||
end
|
||||
|
||||
put :update, params: { project_id: project, broadcast_id: broadcast, id: starred_recordings.first.id }, xhr: true
|
||||
|
||||
expect(starred_recordings.first.reload.star).to eq false
|
||||
expect(starred_recordings.first.reload.starred).to eq false
|
||||
|
||||
starred_recordings[1..5].each do |recording|
|
||||
expect(recording.reload.star).to eq true
|
||||
expect(recording.reload.starred).to eq true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user