Files
old-holivud2/spec/controllers/public/casting_submissions_controller.rb
2020-07-17 04:50:04 +02:00

45 lines
1.3 KiB
Ruby

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