Upstream sync
This commit is contained in:
155
spec/features/user_managing_casiting_calls_spec.rb
Normal file
155
spec/features/user_managing_casiting_calls_spec.rb
Normal file
@@ -0,0 +1,155 @@
|
||||
require "rails_helper"
|
||||
|
||||
feature "User managing casting calls" do
|
||||
let(:current_user) { create(:user) }
|
||||
let(:project) { create(:project, account: current_user.primary_account) }
|
||||
|
||||
before :each do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "casting calls table is visible" do
|
||||
visit project_casting_calls_path(project)
|
||||
|
||||
expect(page).to have_content "Created On"
|
||||
expect(page).to have_content "Title"
|
||||
expect(page).to have_content "Status"
|
||||
end
|
||||
|
||||
scenario "sees list of casting calls" do
|
||||
visit project_casting_calls_path(project)
|
||||
|
||||
expect(page).to have_content no_casting_calls_label
|
||||
|
||||
casting_call = create(:casting_call, project: project)
|
||||
|
||||
visit project_casting_calls_path(project)
|
||||
|
||||
expect(page).not_to have_content no_casting_calls_label
|
||||
|
||||
expect(page).to have_content casting_call.created_at.try(:strftime, '%D')
|
||||
expect(page).to have_content casting_call.title
|
||||
expect(page).to have_content casting_call.status
|
||||
end
|
||||
|
||||
scenario "can create casting call requests" do
|
||||
visit project_casting_calls_path(project)
|
||||
|
||||
expect(page).to have_content no_casting_calls_label
|
||||
click_on add_new_casting_call_label
|
||||
|
||||
fill_in title_field, with: "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 questions_field, with: "Questions"
|
||||
|
||||
click_on "Create Casting call"
|
||||
|
||||
expect(page).to have_content("Your casting call request was successfully submitted. Thank you. A chat window will pop up on the lower right in a few seconds.")
|
||||
end
|
||||
|
||||
scenario "can update casting call requests" do
|
||||
create(:casting_call, title: "Title", project: project)
|
||||
visit project_casting_calls_path(project)
|
||||
|
||||
click_on manage_button
|
||||
click_on "Edit"
|
||||
|
||||
fill_in title_field, with: "New Title"
|
||||
|
||||
click_on "Update Casting call"
|
||||
|
||||
expect(page).to have_content("The casting call request has been updated")
|
||||
end
|
||||
|
||||
scenario "can cancel a casting call request" do
|
||||
create(:casting_call, title: "Title", project: project)
|
||||
visit project_casting_calls_path(project)
|
||||
|
||||
click_on manage_button
|
||||
click_on "Cancel"
|
||||
|
||||
expect(page).to have_content("The casting call request has been cancelled")
|
||||
end
|
||||
|
||||
scenario "can open casting call details" do
|
||||
cc = create(:casting_call, title: "Dummy title", project: project)
|
||||
|
||||
visit project_casting_calls_path(project)
|
||||
|
||||
click_on manage_button
|
||||
click_on view_button
|
||||
|
||||
expect(page).to have_content cc.title
|
||||
expect(page).to have_content cc.description
|
||||
expect(page).to have_content cc.project_description
|
||||
expect(page).to have_content cc.created_at
|
||||
expect(page).to have_content cc.status
|
||||
expect(page).to have_content cc.interview_instructions
|
||||
expect(page).to have_content cc.interview_requirements
|
||||
expect(page).to have_content cc.questions
|
||||
end
|
||||
|
||||
context "when signed out" do
|
||||
scenario "user opens public accessible casting call URL" do
|
||||
cc = create(:casting_call, title: "Dummy title", project: project)
|
||||
|
||||
sign_out
|
||||
public_url = "/casting_calls/#{cc.token}"
|
||||
visit public_url
|
||||
|
||||
expect(page).to have_content cc.title
|
||||
expect(page).to have_content cc.description
|
||||
expect(page).to have_content cc.project_description
|
||||
expect(page).not_to have_content cc.created_at
|
||||
expect(page).not_to have_content cc.status
|
||||
expect(page).not_to have_content cc.interview_instructions
|
||||
expect(page).not_to have_content cc.interview_requirements
|
||||
expect(page).not_to have_content cc.questions
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def no_casting_calls_label
|
||||
"Casting calls will appear here"
|
||||
end
|
||||
|
||||
def manage_button
|
||||
t "casting_calls.casting_call.actions.manage"
|
||||
end
|
||||
|
||||
def view_button
|
||||
'View'
|
||||
end
|
||||
|
||||
def add_new_casting_call_label
|
||||
t "casting_calls.index.actions.new"
|
||||
end
|
||||
|
||||
def title_field
|
||||
t "casting_calls.form.labels.title"
|
||||
end
|
||||
|
||||
def description_field
|
||||
t "casting_calls.form.labels.description"
|
||||
end
|
||||
|
||||
def project_description_field
|
||||
t "casting_calls.form.labels.project_description"
|
||||
end
|
||||
|
||||
def interview_instructions_field
|
||||
t "casting_calls.form.labels.interview_instructions"
|
||||
end
|
||||
|
||||
def interview_requirements_field
|
||||
t "casting_calls.form.labels.interview_requirements"
|
||||
end
|
||||
|
||||
def questions_field
|
||||
t "casting_calls.form.labels.questions"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user