diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index 40b705768..b124ab463 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -6,19 +6,6 @@ describe "Commenting Budget::Investments" do it_behaves_like "flaggable", :budget_investment_comment - scenario "Turns links into html links" do - create(:comment, commentable: investment, body: "Built with http://rubyonrails.org/") - - visit budget_investment_path(investment.budget, investment) - - within first(".comment") do - expect(page).to have_content "Built with http://rubyonrails.org/" - expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") - expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") - expect(find_link("http://rubyonrails.org/")[:target]).to be_blank - end - end - scenario "Sanitizes comment body for security" do create(:comment, commentable: investment, body: " " \ diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index 8597f66c9..a20522bb2 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -25,19 +25,6 @@ describe "Commenting debates" do end end - scenario "Turns links into html links" do - create(:comment, commentable: debate, body: "Built with http://rubyonrails.org/") - - visit debate_path(debate) - - within first(".comment") do - expect(page).to have_content "Built with http://rubyonrails.org/" - expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") - expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") - expect(find_link("http://rubyonrails.org/")[:target]).to be_blank - end - end - scenario "Sanitizes comment body for security" do create(:comment, commentable: debate, body: " " \ diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index 068ff9b1a..8f3026706 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -6,20 +6,6 @@ describe "Commenting legislation questions" do it_behaves_like "flaggable", :legislation_annotation_comment - scenario "Turns links into html links" do - annotation = create(:legislation_annotation, author: user) - annotation.comments << create(:comment, body: "Built with http://rubyonrails.org/") - - visit polymorphic_path(annotation) - - within all(".comment").first do - expect(page).to have_content "Built with http://rubyonrails.org/" - expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") - expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") - expect(find_link("http://rubyonrails.org/")[:target]).to be_blank - end - end - scenario "Sanitizes comment body for security" do create(:comment, commentable: annotation, body: " " \ diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index e12c8922d..286b97518 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -10,19 +10,6 @@ describe "Commenting legislation questions" do it_behaves_like "flaggable", :legislation_question_comment end - scenario "Turns links into html links" do - create(:comment, commentable: question, body: "Built with http://rubyonrails.org/") - - visit legislation_process_question_path(question.process, question) - - within first(".comment") do - expect(page).to have_content "Built with http://rubyonrails.org/" - expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") - expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") - expect(find_link("http://rubyonrails.org/")[:target]).to be_blank - end - end - scenario "Sanitizes comment body for security" do create(:comment, commentable: question, body: " " \ diff --git a/spec/system/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb index 29501d5c3..54a963b5a 100644 --- a/spec/system/comments/polls_spec.rb +++ b/spec/system/comments/polls_spec.rb @@ -4,19 +4,6 @@ describe "Commenting polls" do let(:user) { create(:user) } let(:poll) { create(:poll, author: create(:user)) } - scenario "Turns links into html links" do - create(:comment, commentable: poll, body: "Built with http://rubyonrails.org/") - - visit poll_path(poll) - - within first(".comment") do - expect(page).to have_content "Built with http://rubyonrails.org/" - expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") - expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") - expect(find_link("http://rubyonrails.org/")[:target]).to be_blank - end - end - scenario "Sanitizes comment body for security" do create(:comment, commentable: poll, body: " " \ diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb index d0dad7f06..f2fe13be3 100644 --- a/spec/system/comments/proposals_spec.rb +++ b/spec/system/comments/proposals_spec.rb @@ -6,19 +6,6 @@ describe "Commenting proposals" do it_behaves_like "flaggable", :proposal_comment - scenario "Turns links into html links" do - create(:comment, commentable: proposal, body: "Built with http://rubyonrails.org/") - - visit proposal_path(proposal) - - within first(".comment") do - expect(page).to have_content "Built with http://rubyonrails.org/" - expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") - expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") - expect(find_link("http://rubyonrails.org/")[:target]).to be_blank - end - end - scenario "Sanitizes comment body for security" do create(:comment, commentable: proposal, body: " " \ diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb index 19f5ecbd1..7b6472398 100644 --- a/spec/system/comments/topics_spec.rb +++ b/spec/system/comments/topics_spec.rb @@ -6,21 +6,6 @@ describe "Commenting topics from proposals" do it_behaves_like "flaggable", :topic_with_community_comment - scenario "Turns links into html links" do - community = proposal.community - topic = create(:topic, community: community) - create(:comment, commentable: topic, body: "Built with http://rubyonrails.org/") - - visit community_topic_path(community, topic) - - within first(".comment") do - expect(page).to have_content "Built with http://rubyonrails.org/" - expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") - expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") - expect(find_link("http://rubyonrails.org/")[:target]).to be_blank - end - end - scenario "Sanitizes comment body for security" do community = proposal.community topic = create(:topic, community: community) @@ -405,21 +390,6 @@ describe "Commenting topics from budget investments" do let(:user) { create(:user) } let(:investment) { create(:budget_investment) } - scenario "Turns links into html links" do - community = investment.community - topic = create(:topic, community: community) - create(:comment, commentable: topic, body: "Built with http://rubyonrails.org/") - - visit community_topic_path(community, topic) - - within first(".comment") do - expect(page).to have_content "Built with http://rubyonrails.org/" - expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") - expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") - expect(find_link("http://rubyonrails.org/")[:target]).to be_blank - end - end - scenario "Sanitizes comment body for security" do community = investment.community topic = create(:topic, community: community) diff --git a/spec/system/comments_spec.rb b/spec/system/comments_spec.rb index 5f822f34a..fb4bde3e2 100644 --- a/spec/system/comments_spec.rb +++ b/spec/system/comments_spec.rb @@ -230,6 +230,19 @@ describe "Comments" do expect(old_child.body).to appear_before(new_child.body) end + scenario "Turns links into html links" do + create(:comment, commentable: resource, body: "Built with http://rubyonrails.org/") + + visit polymorphic_path(resource) + + within first(".comment") do + expect(page).to have_content "Built with http://rubyonrails.org/" + expect(page).to have_link("http://rubyonrails.org/", href: "http://rubyonrails.org/") + expect(find_link("http://rubyonrails.org/")[:rel]).to eq("nofollow") + expect(find_link("http://rubyonrails.org/")[:target]).to be_blank + end + end + scenario "Errors on create" do login_as(user) visit polymorphic_path(resource)