Show poll user answers in subsequent sessions

This commit is contained in:
Senén Rodero Rodríguez
2022-09-29 12:20:35 +02:00
parent 48d7ec75d0
commit f90d0d9c4d
5 changed files with 1 additions and 83 deletions

View File

@@ -22,7 +22,6 @@ describe Polls::Questions::AnswersComponent do
it "renders a span instead of a button for existing user answers" do
user = create(:user, :verified)
allow(user).to receive(:current_sign_in_at).and_return(user.created_at)
create(:poll_answer, author: user, question: question, answer: "Yes")
sign_in(user)
@@ -33,18 +32,6 @@ describe Polls::Questions::AnswersComponent do
expect(page).to have_button "No"
end
it "hides current answer and shows buttons in successive sessions" do
user = create(:user, :verified)
create(:poll_answer, author: user, question: question, answer: "Yes")
allow(user).to receive(:current_sign_in_at).and_return(Time.current)
sign_in(user)
render_inline Polls::Questions::AnswersComponent.new(question)
expect(page).to have_button "Yes"
expect(page).to have_button "No"
end
it "when user is not signed in, renders answers links pointing to user sign in path" do
render_inline Polls::Questions::AnswersComponent.new(question)