Files
nairobi/spec/system/comments_spec.rb
taitus 0f2f79ba99 Unify not logged user comments specs
Since commit de1bfd44 'Write a comment' text is deleted.
We are changing this text for the current text 'Leave your comment'
or 'Leave your answer'
2024-03-25 07:59:42 +01:00

39 lines
1.0 KiB
Ruby

require "rails_helper"
describe "Comments" do
let(:factory) {
[
:budget_investment,
:debate,
:legislation_annotation,
:legislation_question,
:poll,
:proposal,
:topic_with_community,
:topic_with_investment_community
].sample
}
let(:resource) { create(factory) }
let(:fill_text) do
if factory == :legislation_question
"Leave your answer"
else
"Leave your comment"
end
end
describe "Not logged user" do
scenario "can not see comments forms" do
create(:comment, commentable: resource)
visit polymorphic_path(resource)
expect(page).to have_content "You must sign in or sign up to leave a comment"
within("#comments") do
expect(page).not_to have_content fill_text
expect(page).not_to have_content "Reply"
end
end
end
end