Cast me
This commit is contained in:
43
spec/controllers/casting_call_interviews_controller_spec.rb
Normal file
43
spec/controllers/casting_call_interviews_controller_spec.rb
Normal file
@@ -0,0 +1,43 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe CastingCallInterviewsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:account) { user.primary_account }
|
||||
let(:project) { create(:project, account: user.primary_account) }
|
||||
let(:casting_call) { create(:casting_call, project: project, title: "My Interview") }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
end
|
||||
|
||||
describe "#index" do
|
||||
it "returns a successful response" do
|
||||
get :index, params: { project_id: project }
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it "only shows completed interviews" do
|
||||
create(:casting_call_interview, casting_call: casting_call, interviewed_at: Time.zone.now, performer_name: "John Doe")
|
||||
create(:casting_call_interview, casting_call: casting_call, interviewed_at: nil, performer_name: "Jane Doe")
|
||||
|
||||
get :index, params: { project_id: project }
|
||||
|
||||
expect(response.body).to have_content("John Doe")
|
||||
expect(response.body).not_to have_content("Jane Doe")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#show" do
|
||||
let!(:casting_call_interview) { create(:casting_call_interview, :with_files, casting_call: casting_call, interviewed_at: Time.zone.now, performer_name: "Jane Doe") }
|
||||
|
||||
it "shows files of casting call interview" do
|
||||
get :show, params: { project_id: project, id: casting_call_interview.id }
|
||||
|
||||
expect(response.body).to have_content("Filename")
|
||||
expect(response.body).to have_content("location_photo.png")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user