Don't allow changing answers if the poll has started

Just like we did with questions.
This commit is contained in:
Julian Herrero
2022-02-26 17:41:37 +07:00
committed by Javi Martín
parent 7a812a82e2
commit 3a6e99cb8c
9 changed files with 183 additions and 29 deletions

View File

@@ -0,0 +1,21 @@
require "rails_helper"
describe Admin::Poll::Questions::Answers::TableActionsComponent, controller: Admin::BaseController do
before { sign_in(create(:administrator).user) }
it "displays the edit action when the poll has not started" do
answer = create(:poll_question_answer, poll: create(:poll, :future))
render_inline Admin::Poll::Questions::Answers::TableActionsComponent.new(answer)
expect(page).to have_link "Edit"
end
it "does not display the edit action when the poll has started" do
answer = create(:poll_question_answer, poll: create(:poll))
render_inline Admin::Poll::Questions::Answers::TableActionsComponent.new(answer)
expect(page).not_to have_link "Edit"
end
end