require 'rails_helper' RSpec.describe Public::CastingCallInterviewsController, type: :controller do render_views describe "#show" do let(:casting_call_interview) { create(:casting_call_interview) } it "responds successfully" do get :show, params: { token: casting_call_interview.token } expect(response).to be_successful expect(assigns(:casting_call_interview)).to eq(casting_call_interview) end it "shows casting call interview details" do get :show, params: { token: casting_call_interview.token } expect(response.body).to have_content(casting_call_interview.performer_name) expect(response.body).to have_content(casting_call_interview.interview_date) expect(response.body).to have_link("Start Interview") end end describe "#update" do let(:casting_call_interview) { create(:casting_call_interview) } it "responds successfully" do patch :update, params: { token: casting_call_interview.token, casting_call_interview: casting_call_interview_params } expect(response).to redirect_to casting_call_interview_url(token: casting_call_interview.token) expect(flash.notice).to be_present end end private def casting_call_interview_params path = Rails.root.join("spec", "fixtures", "files", "contract.pdf") file = Rack::Test::UploadedFile.new(path, "application/pdf") { files: [file]} end end