Extract methods in poll status component
This way we remove duplication in the HTML. We're also adding a test checking what happens when users can vote in order to test the `render?` method we've added.
This commit is contained in:
@@ -37,4 +37,12 @@ describe Polls::AccessStatusComponent do
|
||||
expect(page).to have_css ".already-answer", count: 1
|
||||
expect(page).to have_content "You already have participated in this poll"
|
||||
end
|
||||
|
||||
it "is not rendered when users can vote" do
|
||||
sign_in(create(:user, :level_two))
|
||||
|
||||
render_inline Polls::AccessStatusComponent.new(create(:poll))
|
||||
|
||||
expect(page).not_to be_rendered
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user