Don't allow to modify answer's videos for started polls
Same rules that will apply for the answer itself should apply for the attachments like videos, images, and/or documents.
This commit is contained in:
committed by
Javi Martín
parent
14542df0de
commit
5fe86264ca
@@ -0,0 +1,23 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Admin::Poll::Questions::Answers::Videos::TableActionsComponent, controller: Admin::BaseController do
|
||||
before { sign_in(create(:administrator).user) }
|
||||
|
||||
it "displays the edit and destroy actions when the poll has not started" do
|
||||
video = create(:poll_answer_video, poll: create(:poll, :future))
|
||||
|
||||
render_inline Admin::Poll::Questions::Answers::Videos::TableActionsComponent.new(video)
|
||||
|
||||
expect(page).to have_link "Edit"
|
||||
expect(page).to have_button "Delete"
|
||||
end
|
||||
|
||||
it "does not display the edit and destroy actions when the poll has started" do
|
||||
video = create(:poll_answer_video, poll: create(:poll))
|
||||
|
||||
render_inline Admin::Poll::Questions::Answers::Videos::TableActionsComponent.new(video)
|
||||
|
||||
expect(page).not_to have_link "Edit"
|
||||
expect(page).not_to have_button "Delete"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user