Files
old-holivud2/spec/controllers/casting_submissions_controller_spec.rb

44 lines
1.4 KiB
Ruby
Raw Normal View History

2020-07-15 11:57:21 +02:00
require "rails_helper"
2020-07-17 04:50:04 +02:00
RSpec.describe CastingSubmissionsController, type: :controller do
2020-07-15 11:57:21 +02:00
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
2020-07-17 04:50:04 +02:00
it "only shows completed submissions" do
create(:casting_submission, casting_call: casting_call, interviewed_at: Time.zone.now, performer_name: "John Doe")
create(:casting_submission, casting_call: casting_call, interviewed_at: nil, performer_name: "Jane Doe")
2020-07-15 11:57:21 +02:00
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
2020-07-17 04:50:04 +02:00
let!(:casting_submission) { create(:casting_submission, :with_files, casting_call: casting_call, interviewed_at: Time.zone.now, performer_name: "Jane Doe") }
2020-07-15 11:57:21 +02:00
2020-07-17 04:50:04 +02:00
it "shows files of casting submission" do
get :show, params: { project_id: project, id: casting_submission.id }
2020-07-15 11:57:21 +02:00
expect(response.body).to have_content("Filename")
expect(response.body).to have_content("location_photo.png")
end
end
end