new specs

This commit is contained in:
Bilal
2020-09-14 18:13:34 +03:00
parent ba4e6767f7
commit 6fff636f5c
5 changed files with 131 additions and 20 deletions

View File

@@ -97,6 +97,36 @@ feature 'User managing broadcasts' do
expect(page).to have_content token_reset_notice
end
scenario 'Clicking Conference button without previously created live meeting creates new room and opens live meeting' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
project.update(live_meeting_url: nil)
visit project_broadcast_path(project, broadcast)
dummy_room = { url: 'dummy_room_url' }.to_json
allow(Daily).to receive(:create_room).and_return JSON.parse(dummy_room)
expect {
click_link conference_button
}.not_to raise_error
expect(page).not_to have_content meeting_not_ready_message
end
scenario 'Clicking Conference button with previously created live meeting does not create new room and opens live meeting' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
expect(Daily).not_to receive(:create_room)
expect {
click_link conference_button
}.not_to raise_error
expect(page).not_to have_content meeting_not_ready_message
end
scenario 'form will not submit if user clicks Add files without selected files', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
@@ -254,6 +284,26 @@ feature 'User managing broadcasts' do
expect(Broadcast.find(broadcast.id).files.count).to eq 2
end
end
context 'When user is not signed in' do
before do
# sign_out
end
scenario 'Clicking Conference button without previously created live meeting does not create new meeting and shows error message' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
project.update(live_meeting_url: nil)
visit broadcast_url(broadcast.token)
expect(Daily).not_to receive(:create_room)
expect {
click_link conference_button
}.not_to raise_error
expect(page).to have_content meeting_not_ready_message
end
end
end
private
@@ -305,5 +355,12 @@ feature 'User managing broadcasts' do
t 'broadcasts.file.actions.delete_file'
end
def conference_button
'Video Conference'
end
def meeting_not_ready_message
t 'public.live_meetings.show.meeting_not_ready_message'
end
end