validate zoom meeting url

This commit is contained in:
Bilal
2020-07-15 16:35:18 +02:00
parent da8e187430
commit cde81508b4
8 changed files with 122 additions and 24 deletions

View File

@@ -37,6 +37,16 @@ RSpec.describe Admin::CastingCallInterviewsController, type: :controller do
post :create, params: { casting_call_interview: casting_call_interview_params }
}.to change(CastingCallInterview, :count)
end
it "does not create new record if zoom meeting url is not valid" do
expect {
post :create, params: {
casting_call_interview: casting_call_interview_params
.except(:zoom_meeting_url)
.merge(zoom_meeting_url: "malformed_url")
}
}.to change(CastingCallInterview, :count).by(0)
end
end
describe "#edit" do
@@ -74,7 +84,7 @@ RSpec.describe Admin::CastingCallInterviewsController, type: :controller do
it "updates casting call interview" do
patch :update, params: { id: casting_call_interview, casting_call_interview: update_params }
expect(casting_call_interview.reload.zoom_meeting_url).to eq("new_zoom_meeting_url")
expect(casting_call_interview.reload.zoom_meeting_url).to eq new_zoom_meeting_url
end
end
@@ -100,7 +110,15 @@ RSpec.describe Admin::CastingCallInterviewsController, type: :controller do
def update_params
{
zoom_meeting_url: "new_zoom_meeting_url"
zoom_meeting_url: new_zoom_meeting_url
}
end
def new_zoom_meeting_url
"https://s01web.zoom.us/j/11111?pwd=Ab123Cq34"
end
def invalid_meeting_url_flash_error
t 'casting_call_interviews.validation_errors.invalid_meeting_url'
end
end