Cast me sync

This commit is contained in:
Senad Uka
2020-07-17 04:50:04 +02:00
parent 96b31b71cf
commit e3acdb4d0e
53 changed files with 678 additions and 635 deletions

View File

@@ -1,71 +0,0 @@
require "rails_helper"
feature "Admin managing casting call interviews" do
let(:current_user) { create(:user, admin: true, email: "user@test.com") }
let(:project) { create(:project, account: current_user.primary_account, name: "Test Project") }
before do
sign_in current_user
end
scenario "admin cannot create casting call interview with invalid zoom url", js: true do
visit admin_casting_call_interviews_path
cc = create(:casting_call, title: "SpecialCastingCall")
click_link create_casting_call_interview_button
expect(page).to have_content new_casting_call_interview_heading
fill_in performer_name_field, with: "TestName"
select cc.title, from: casting_call_field
fill_in zoom_meeting_url_field, with: "malformed url"
expect do
click_on submit_casting_call_interview_form
end.to change(CastingCallInterview, :count).by(0)
expect(page).to have_content zoom_meeting_url_invalid_error
fill_in zoom_meeting_url_field, with: "https://similar.google.com/j/24324324?pwd=334kni3j4"
expect do
click_on submit_casting_call_interview_form
end.to change(CastingCallInterview, :count).by(0)
expect(page).to have_content zoom_meeting_url_invalid_error
fill_in zoom_meeting_url_field, with: "https://s01.zoom.us/j/343434?pwd=dawidj34ijij"
expect do
click_on submit_casting_call_interview_form
end.to change(CastingCallInterview, :count).by(1)
expect(page).to have_content create_casting_call_interview_button
end
private
def create_casting_call_interview_button
t 'admin.casting_call_interviews.index.actions.new'
end
def new_casting_call_interview_heading
t 'admin.casting_call_interviews.new.heading'
end
def submit_casting_call_interview_form
t 'helpers.submit.casting_call_interview.create'
end
def zoom_meeting_url_invalid_error
t 'casting_call_interviews.validation_errors.invalid_meeting_url'
end
def performer_name_field
'casting_call_interview[performer_name]'
end
def zoom_meeting_url_field
'casting_call_interview[zoom_meeting_url]'
end
def casting_call_field
'casting_call_interview[casting_call_id]'
end
end

View File

@@ -0,0 +1,71 @@
require "rails_helper"
feature "Admin managing casting submissions" do
let(:current_user) { create(:user, admin: true, email: "user@test.com") }
let(:project) { create(:project, account: current_user.primary_account, name: "Test Project") }
before do
sign_in current_user
end
scenario "admin cannot create casting submission with invalid zoom url", js: true do
visit admin_casting_submissions_path
cc = create(:casting_call, title: "SpecialCastingCall")
click_link create_casting_submission_button
expect(page).to have_content new_casting_submission_heading
fill_in performer_name_field, with: "TestName"
select cc.title, from: casting_call_field
fill_in zoom_meeting_url_field, with: "malformed url"
expect do
click_on submit_casting_submission_form
end.to change(CastingSubmission, :count).by(0)
expect(page).to have_content zoom_meeting_url_invalid_error
fill_in zoom_meeting_url_field, with: "https://similar.google.com/j/24324324?pwd=334kni3j4"
expect do
click_on submit_casting_submission_form
end.to change(CastingSubmission, :count).by(0)
expect(page).to have_content zoom_meeting_url_invalid_error
fill_in zoom_meeting_url_field, with: "https://s01.zoom.us/j/343434?pwd=dawidj34ijij"
expect do
click_on submit_casting_submission_form
end.to change(CastingSubmission, :count).by(1)
expect(page).to have_content create_casting_submission_button
end
private
def create_casting_submission_button
t 'admin.casting_submissions.index.actions.new'
end
def new_casting_submission_heading
t 'admin.casting_submissions.new.heading'
end
def submit_casting_submission_form
t 'helpers.submit.casting_submission.create'
end
def zoom_meeting_url_invalid_error
t 'casting_submissions.validation_errors.invalid_meeting_url'
end
def performer_name_field
'casting_submission[performer_name]'
end
def zoom_meeting_url_field
'casting_submission[zoom_meeting_url]'
end
def casting_call_field
'casting_submission[casting_call_id]'
end
end

View File

@@ -38,11 +38,11 @@ feature "User managing casting calls" do
expect(page).to have_content no_casting_calls_label
click_on add_new_casting_call_label
fill_in title_field, with: "Title"
fill_in title_field, with: "Casting Title"
fill_in description_field, with: "Description"
fill_in project_description_field, with: "Project Description"
fill_in interview_instructions_field, with: "Interview instructions"
fill_in interview_requirements_field, with: "Interview requirements"
fill_in interview_instructions_field, with: "Welcome Message"
fill_in interview_requirements_field, with: "Goodbye Message"
fill_in questions_field, with: "Questions"
click_on "Create Casting call"
@@ -89,26 +89,26 @@ feature "User managing casting calls" do
end
def title_field
t "casting_calls.form.labels.title"
t "helpers.label.casting_call.title"
end
def description_field
t "casting_calls.form.labels.description"
t "helpers.label.casting_call.description"
end
def project_description_field
t "casting_calls.form.labels.project_description"
t "helpers.label.casting_call.project_description"
end
def interview_instructions_field
t "casting_calls.form.labels.interview_instructions"
t "helpers.label.casting_call.interview_instructions"
end
def interview_requirements_field
t "casting_calls.form.labels.interview_requirements"
t "helpers.label.casting_call.interview_requirements"
end
def questions_field
t "casting_calls.form.labels.questions"
t "helpers.label.casting_call.questions"
end
end
end