Add FactoryBot/ConsistentParenthesesStyle rule

This rule was added in rubocop-rspec 2.14.0. We were already applying it
most of the time.
This commit is contained in:
Javi Martín
2023-08-29 19:59:56 +02:00
parent 2d4ff86837
commit 8e276e2891
24 changed files with 104 additions and 101 deletions

View File

@@ -518,6 +518,9 @@ RSpec/ExampleWording:
RSpec/ExcessiveDocstringSpacing: RSpec/ExcessiveDocstringSpacing:
Enabled: true Enabled: true
RSpec/FactoryBot/ConsistentParenthesesStyle:
Enabled: true
RSpec/FactoryBot/FactoryClassName: RSpec/FactoryBot/FactoryClassName:
Enabled: true Enabled: true

View File

@@ -17,12 +17,12 @@ describe Admin::Api::StatsController, :admin do
time_2 = Time.zone.local(2015, 01, 02) time_2 = Time.zone.local(2015, 01, 02)
time_3 = Time.zone.local(2015, 01, 03) time_3 = Time.zone.local(2015, 01, 03)
create :ahoy_event, name: "foo", time: time_1 create(:ahoy_event, name: "foo", time: time_1)
create :ahoy_event, name: "foo", time: time_1 create(:ahoy_event, name: "foo", time: time_1)
create :ahoy_event, name: "foo", time: time_2 create(:ahoy_event, name: "foo", time: time_2)
create :ahoy_event, name: "bar", time: time_1 create(:ahoy_event, name: "bar", time: time_1)
create :ahoy_event, name: "bar", time: time_3 create(:ahoy_event, name: "bar", time: time_3)
create :ahoy_event, name: "bar", time: time_3 create(:ahoy_event, name: "bar", time: time_3)
end end
it "returns single events formated for working with c3.js" do it "returns single events formated for working with c3.js" do
@@ -38,9 +38,9 @@ describe Admin::Api::StatsController, :admin do
time_1 = Time.zone.local(2015, 01, 01) time_1 = Time.zone.local(2015, 01, 01)
time_2 = Time.zone.local(2015, 01, 02) time_2 = Time.zone.local(2015, 01, 02)
create :visit, started_at: time_1 create(:visit, started_at: time_1)
create :visit, started_at: time_1 create(:visit, started_at: time_1)
create :visit, started_at: time_2 create(:visit, started_at: time_2)
get :show, params: { visits: true } get :show, params: { visits: true }

View File

@@ -2,7 +2,7 @@ require "rails_helper"
describe GeozonesHelper do describe GeozonesHelper do
describe "#geozone_name" do describe "#geozone_name" do
let(:geozone) { create :geozone } let(:geozone) { create(:geozone) }
it "returns geozone name if present" do it "returns geozone name if present" do
proposal = create(:proposal, geozone: geozone) proposal = create(:proposal, geozone: geozone)

View File

@@ -7,12 +7,12 @@ describe Ahoy::DataSource do
time_2 = Time.zone.local(2015, 01, 02) time_2 = Time.zone.local(2015, 01, 02)
time_3 = Time.zone.local(2015, 01, 03) time_3 = Time.zone.local(2015, 01, 03)
create :ahoy_event, name: "foo", time: time_1 create(:ahoy_event, name: "foo", time: time_1)
create :ahoy_event, name: "foo", time: time_1 create(:ahoy_event, name: "foo", time: time_1)
create :ahoy_event, name: "foo", time: time_2 create(:ahoy_event, name: "foo", time: time_2)
create :ahoy_event, name: "bar", time: time_1 create(:ahoy_event, name: "bar", time: time_1)
create :ahoy_event, name: "bar", time: time_3 create(:ahoy_event, name: "bar", time: time_3)
create :ahoy_event, name: "bar", time: time_3 create(:ahoy_event, name: "bar", time: time_3)
end end
it "works without data sources" do it "works without data sources" do

View File

@@ -2,13 +2,13 @@ require "rails_helper"
describe Dashboard::Action do describe Dashboard::Action do
subject do subject do
build :dashboard_action, build(:dashboard_action,
title: "Take action!", title: "Take action!",
description: description, description: description,
day_offset: day_offset, day_offset: day_offset,
required_supports: required_supports, required_supports: required_supports,
request_to_administrators: request_to_administrators, request_to_administrators: request_to_administrators,
action_type: action_type action_type: action_type)
end end
let(:description) { Faker::Lorem.sentence } let(:description) { Faker::Lorem.sentence }
@@ -150,34 +150,34 @@ describe Dashboard::Action do
end end
describe ".active_for" do describe ".active_for" do
let!(:active_action) { create :dashboard_action, :active, day_offset: 0, required_supports: 0 } let!(:active_action) { create(:dashboard_action, :active, day_offset: 0, required_supports: 0) }
let!(:inactive_action) { create :dashboard_action, :inactive } let!(:inactive_action) { create(:dashboard_action, :inactive) }
let!(:not_enough_supports_action) do let!(:not_enough_supports_action) do
create :dashboard_action, :active, day_offset: 0, required_supports: 10_000 create(:dashboard_action, :active, day_offset: 0, required_supports: 10_000)
end end
let!(:future_action) do let!(:future_action) do
create :dashboard_action, :active, day_offset: 300, required_supports: 0 create(:dashboard_action, :active, day_offset: 300, required_supports: 0)
end end
let!(:action_published_proposal) do let!(:action_published_proposal) do
create :dashboard_action, create(:dashboard_action,
:active, :active,
day_offset: 0, day_offset: 0,
required_supports: 0, required_supports: 0,
published_proposal: true published_proposal: true)
end end
let!(:action_for_draft_proposal) do let!(:action_for_draft_proposal) do
create :dashboard_action, create(:dashboard_action,
:active, :active,
day_offset: 0, day_offset: 0,
required_supports: 0, required_supports: 0,
published_proposal: false published_proposal: false)
end end
let(:proposal) { create :proposal } let(:proposal) { create(:proposal) }
let(:draft_proposal) { create :proposal, :draft } let(:draft_proposal) { create(:proposal, :draft) }
it "actions with enough supports or days are active" do it "actions with enough supports or days are active" do
expect(Dashboard::Action.active_for(proposal)).to include(active_action) expect(Dashboard::Action.active_for(proposal)).to include(active_action)
@@ -213,13 +213,13 @@ describe Dashboard::Action do
end end
describe ".course_for" do describe ".course_for" do
let!(:proposed_action) { create :dashboard_action, :active, required_supports: 0 } let!(:proposed_action) { create(:dashboard_action, :active, required_supports: 0) }
let!(:inactive_resource) do let!(:inactive_resource) do
create :dashboard_action, :inactive, :resource, required_supports: 0 create(:dashboard_action, :inactive, :resource, required_supports: 0)
end end
let!(:resource) { create :dashboard_action, :active, :resource, required_supports: 10_000 } let!(:resource) { create(:dashboard_action, :active, :resource, required_supports: 10_000) }
let!(:achieved_resource) { create :dashboard_action, :active, :resource, required_supports: 0 } let!(:achieved_resource) { create(:dashboard_action, :active, :resource, required_supports: 0) }
let(:proposal) { create :proposal } let(:proposal) { create(:proposal) }
it "proposed actions are not part of proposal's course" do it "proposed actions are not part of proposal's course" do
expect(Dashboard::Action.course_for(proposal)).not_to include(proposed_action) expect(Dashboard::Action.course_for(proposal)).not_to include(proposed_action)

View File

@@ -1,8 +1,8 @@
require "rails_helper" require "rails_helper"
describe Dashboard::ExecutedAction do describe Dashboard::ExecutedAction do
let(:proposal) { create :proposal } let(:proposal) { create(:proposal) }
let(:action) { create :dashboard_action, request_to_administrators: true } let(:action) { create(:dashboard_action, request_to_administrators: true) }
it "is invalid when proposal is nil" do it "is invalid when proposal is nil" do
action = build(:dashboard_executed_action, proposal: nil) action = build(:dashboard_executed_action, proposal: nil)

View File

@@ -1,7 +1,7 @@
require "rails_helper" require "rails_helper"
describe Link do describe Link do
let(:action) { build :dashboard_action } let(:action) { build(:dashboard_action) }
it "is invalid when label is blank" do it "is invalid when label is blank" do
link = build(:link, linkable: action, label: "") link = build(:link, linkable: action, label: "")

View File

@@ -39,8 +39,8 @@ describe Notification do
describe "#recent" do describe "#recent" do
it "returns notifications sorted by id descendant" do it "returns notifications sorted by id descendant" do
old_notification = create :notification old_notification = create(:notification)
new_notification = create :notification new_notification = create(:notification)
expect(Notification.recent).to eq [new_notification, old_notification] expect(Notification.recent).to eq [new_notification, old_notification]
end end
@@ -80,8 +80,8 @@ describe Notification do
describe "#timestamp" do describe "#timestamp" do
it "returns the timestamp of the trackable object" do it "returns the timestamp of the trackable object" do
comment = create :comment comment = create(:comment)
notification = create :notification, notifiable: comment notification = create(:notification, notifiable: comment)
expect(notification.timestamp).to eq comment.created_at expect(notification.timestamp).to eq comment.created_at
end end

View File

@@ -358,8 +358,8 @@ describe Poll do
end end
describe ".overlaping_with" do describe ".overlaping_with" do
let(:proposal) { create :proposal } let(:proposal) { create(:proposal) }
let(:other_proposal) { create :proposal } let(:other_proposal) { create(:proposal) }
let(:poll) { create(:poll, related: proposal) } let(:poll) { create(:poll, related: proposal) }
let(:overlaping_poll) do let(:overlaping_poll) do
build(:poll, related: proposal, starts_at: poll.starts_at + 1.day, ends_at: poll.ends_at - 1.day) build(:poll, related: proposal, starts_at: poll.starts_at + 1.day, ends_at: poll.ends_at - 1.day)

View File

@@ -176,8 +176,8 @@ describe Poll::Stats do
hobbiton = create(:geozone, name: "Hobbiton") hobbiton = create(:geozone, name: "Hobbiton")
rivendel = create(:geozone, name: "Rivendel") rivendel = create(:geozone, name: "Rivendel")
3.times { create :poll_voter, poll: poll, user: create(:user, :level_two, geozone: hobbiton) } 3.times { create(:poll_voter, poll: poll, user: create(:user, :level_two, geozone: hobbiton)) }
2.times { create :poll_voter, poll: poll, user: create(:user, :level_two, geozone: rivendel) } 2.times { create(:poll_voter, poll: poll, user: create(:user, :level_two, geozone: rivendel)) }
expect(stats.participants_by_geozone["Hobbiton"][:count]).to eq 3 expect(stats.participants_by_geozone["Hobbiton"][:count]).to eq 3
expect(stats.participants_by_geozone["Hobbiton"][:percentage]).to eq 60.0 expect(stats.participants_by_geozone["Hobbiton"][:percentage]).to eq 60.0

View File

@@ -49,7 +49,7 @@ shared_examples "notifiable in-app" do |factory_name|
end end
scenario "A user replied to my comment" do scenario "A user replied to my comment" do
comment = create :comment, commentable: notifiable, user: author comment = create(:comment, commentable: notifiable, user: author)
login_as(create(:user, :verified)) login_as(create(:user, :verified))
visit path_for(notifiable) visit path_for(notifiable)
@@ -74,7 +74,7 @@ shared_examples "notifiable in-app" do |factory_name|
end end
scenario "Multiple replies to my comment" do scenario "Multiple replies to my comment" do
comment = create :comment, commentable: notifiable, user: author comment = create(:comment, commentable: notifiable, user: author)
3.times do |n| 3.times do |n|
login_as(create(:user, :verified)) login_as(create(:user, :verified))
@@ -118,7 +118,7 @@ shared_examples "notifiable in-app" do |factory_name|
end end
scenario "Author replied to his own comment" do scenario "Author replied to his own comment" do
comment = create :comment, commentable: notifiable, user: author comment = create(:comment, commentable: notifiable, user: author)
login_as author login_as author
visit path_for(notifiable) visit path_for(notifiable)

View File

@@ -26,7 +26,7 @@ describe "Admin dashboard actions", :admin do
end end
context "and actions defined" do context "and actions defined" do
let!(:action) { create :dashboard_action } let!(:action) { create(:dashboard_action) }
before do before do
visit admin_dashboard_actions_path visit admin_dashboard_actions_path
@@ -39,7 +39,7 @@ describe "Admin dashboard actions", :admin do
end end
context "when creating an action" do context "when creating an action" do
let(:action) { build :dashboard_action } let(:action) { build(:dashboard_action) }
before do before do
visit admin_dashboard_actions_path visit admin_dashboard_actions_path
@@ -63,7 +63,7 @@ describe "Admin dashboard actions", :admin do
end end
context "when editing an action" do context "when editing an action" do
let!(:action) { create :dashboard_action } let!(:action) { create(:dashboard_action) }
before do before do
visit admin_dashboard_actions_path visit admin_dashboard_actions_path
@@ -87,7 +87,7 @@ describe "Admin dashboard actions", :admin do
end end
context "when destroying an action" do context "when destroying an action" do
let!(:action) { create :dashboard_action } let!(:action) { create(:dashboard_action) }
before do before do
visit admin_dashboard_actions_path visit admin_dashboard_actions_path

View File

@@ -13,7 +13,7 @@ describe "Admin administrator tasks", :admin do
end end
context "and actions defined" do context "and actions defined" do
let!(:task) { create :dashboard_administrator_task, :pending } let!(:task) { create(:dashboard_administrator_task, :pending) }
before do before do
visit admin_dashboard_administrator_tasks_path visit admin_dashboard_administrator_tasks_path
@@ -31,7 +31,7 @@ describe "Admin administrator tasks", :admin do
end end
context "when solving a task" do context "when solving a task" do
let!(:task) { create :dashboard_administrator_task, :pending } let!(:task) { create(:dashboard_administrator_task, :pending) }
before do before do
visit admin_dashboard_administrator_tasks_path visit admin_dashboard_administrator_tasks_path

View File

@@ -1,8 +1,8 @@
require "rails_helper" require "rails_helper"
describe "Commenting Budget::Investments" do describe "Commenting Budget::Investments" do
let(:user) { create :user } let(:user) { create(:user) }
let(:investment) { create :budget_investment } let(:investment) { create(:budget_investment) }
it_behaves_like "flaggable", :budget_investment_comment it_behaves_like "flaggable", :budget_investment_comment
@@ -159,7 +159,7 @@ describe "Commenting Budget::Investments" do
end end
scenario "Turns links into html links" do scenario "Turns links into html links" do
create :comment, commentable: investment, body: "Built with http://rubyonrails.org/" create(:comment, commentable: investment, body: "Built with http://rubyonrails.org/")
visit budget_investment_path(investment.budget, investment) visit budget_investment_path(investment.budget, investment)
@@ -172,10 +172,10 @@ describe "Commenting Budget::Investments" do
end end
scenario "Sanitizes comment body for security" do scenario "Sanitizes comment body for security" do
create :comment, commentable: investment, create(:comment, commentable: investment,
body: "<script>alert('hola')</script> " \ body: "<script>alert('hola')</script> " \
"<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \ "<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \
"http://www.url.com" "http://www.url.com")
visit budget_investment_path(investment.budget, investment) visit budget_investment_path(investment.budget, investment)

View File

@@ -1,8 +1,8 @@
require "rails_helper" require "rails_helper"
describe "Commenting debates" do describe "Commenting debates" do
let(:user) { create :user } let(:user) { create(:user) }
let(:debate) { create :debate } let(:debate) { create(:debate) }
it_behaves_like "flaggable", :debate_comment it_behaves_like "flaggable", :debate_comment
@@ -162,7 +162,7 @@ describe "Commenting debates" do
end end
scenario "Turns links into html links" do scenario "Turns links into html links" do
create :comment, commentable: debate, body: "Built with http://rubyonrails.org/" create(:comment, commentable: debate, body: "Built with http://rubyonrails.org/")
visit debate_path(debate) visit debate_path(debate)
@@ -175,10 +175,10 @@ describe "Commenting debates" do
end end
scenario "Sanitizes comment body for security" do scenario "Sanitizes comment body for security" do
create :comment, commentable: debate, create(:comment, commentable: debate,
body: "<script>alert('hola')</script> " \ body: "<script>alert('hola')</script> " \
"<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \ "<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \
"http://www.url.com" "http://www.url.com")
visit debate_path(debate) visit debate_path(debate)

View File

@@ -1,8 +1,8 @@
require "rails_helper" require "rails_helper"
describe "Commenting legislation questions" do describe "Commenting legislation questions" do
let(:user) { create :user } let(:user) { create(:user) }
let(:annotation) { create :legislation_annotation, author: user } let(:annotation) { create(:legislation_annotation, author: user) }
it_behaves_like "flaggable", :legislation_annotation_comment it_behaves_like "flaggable", :legislation_annotation_comment
@@ -155,7 +155,7 @@ describe "Commenting legislation questions" do
end end
scenario "Turns links into html links" do scenario "Turns links into html links" do
annotation = create :legislation_annotation, author: user annotation = create(:legislation_annotation, author: user)
annotation.comments << create(:comment, body: "Built with http://rubyonrails.org/") annotation.comments << create(:comment, body: "Built with http://rubyonrails.org/")
visit polymorphic_path(annotation) visit polymorphic_path(annotation)
@@ -169,10 +169,10 @@ describe "Commenting legislation questions" do
end end
scenario "Sanitizes comment body for security" do scenario "Sanitizes comment body for security" do
create :comment, commentable: annotation, create(:comment, commentable: annotation,
body: "<script>alert('hola')</script> " \ body: "<script>alert('hola')</script> " \
"<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \ "<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \
"http://www.url.com" "http://www.url.com")
visit polymorphic_path(annotation) visit polymorphic_path(annotation)

View File

@@ -1,9 +1,9 @@
require "rails_helper" require "rails_helper"
describe "Commenting legislation questions" do describe "Commenting legislation questions" do
let(:user) { create :user, :level_two } let(:user) { create(:user, :level_two) }
let(:process) { create :legislation_process, :in_debate_phase } let(:process) { create(:legislation_process, :in_debate_phase) }
let(:question) { create :legislation_question, process: process } let(:question) { create(:legislation_question, process: process) }
context "Concerns" do context "Concerns" do
it_behaves_like "notifiable in-app", :legislation_question it_behaves_like "notifiable in-app", :legislation_question
@@ -151,7 +151,7 @@ describe "Commenting legislation questions" do
end end
scenario "Turns links into html links" do scenario "Turns links into html links" do
create :comment, commentable: question, body: "Built with http://rubyonrails.org/" create(:comment, commentable: question, body: "Built with http://rubyonrails.org/")
visit legislation_process_question_path(question.process, question) visit legislation_process_question_path(question.process, question)
@@ -164,10 +164,10 @@ describe "Commenting legislation questions" do
end end
scenario "Sanitizes comment body for security" do scenario "Sanitizes comment body for security" do
create :comment, commentable: question, create(:comment, commentable: question,
body: "<script>alert('hola')</script> " \ body: "<script>alert('hola')</script> " \
"<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \ "<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \
"http://www.url.com" "http://www.url.com")
visit legislation_process_question_path(question.process, question) visit legislation_process_question_path(question.process, question)
@@ -232,7 +232,7 @@ describe "Commenting legislation questions" do
end end
scenario "Unverified user can't create comments" do scenario "Unverified user can't create comments" do
unverified_user = create :user unverified_user = create(:user)
login_as(unverified_user) login_as(unverified_user)
visit legislation_process_question_path(question.process, question) visit legislation_process_question_path(question.process, question)

View File

@@ -1,7 +1,7 @@
require "rails_helper" require "rails_helper"
describe "Commenting polls" do describe "Commenting polls" do
let(:user) { create :user } let(:user) { create(:user) }
let(:poll) { create(:poll, author: create(:user)) } let(:poll) { create(:poll, author: create(:user)) }
scenario "Index" do scenario "Index" do
@@ -140,7 +140,7 @@ describe "Commenting polls" do
end end
scenario "Turns links into html links" do scenario "Turns links into html links" do
create :comment, commentable: poll, body: "Built with http://rubyonrails.org/" create(:comment, commentable: poll, body: "Built with http://rubyonrails.org/")
visit poll_path(poll) visit poll_path(poll)
@@ -153,10 +153,10 @@ describe "Commenting polls" do
end end
scenario "Sanitizes comment body for security" do scenario "Sanitizes comment body for security" do
create :comment, commentable: poll, create(:comment, commentable: poll,
body: "<script>alert('hola')</script> " \ body: "<script>alert('hola')</script> " \
"<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \ "<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \
"http://www.url.com" "http://www.url.com")
visit poll_path(poll) visit poll_path(poll)

View File

@@ -1,8 +1,8 @@
require "rails_helper" require "rails_helper"
describe "Commenting proposals" do describe "Commenting proposals" do
let(:user) { create :user } let(:user) { create(:user) }
let(:proposal) { create :proposal } let(:proposal) { create(:proposal) }
it_behaves_like "flaggable", :proposal_comment it_behaves_like "flaggable", :proposal_comment
@@ -145,7 +145,7 @@ describe "Commenting proposals" do
end end
scenario "Turns links into html links" do scenario "Turns links into html links" do
create :comment, commentable: proposal, body: "Built with http://rubyonrails.org/" create(:comment, commentable: proposal, body: "Built with http://rubyonrails.org/")
visit proposal_path(proposal) visit proposal_path(proposal)
@@ -158,10 +158,10 @@ describe "Commenting proposals" do
end end
scenario "Sanitizes comment body for security" do scenario "Sanitizes comment body for security" do
create :comment, commentable: proposal, create(:comment, commentable: proposal,
body: "<script>alert('hola')</script> " \ body: "<script>alert('hola')</script> " \
"<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \ "<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \
"http://www.url.com" "http://www.url.com")
visit proposal_path(proposal) visit proposal_path(proposal)

View File

@@ -1,8 +1,8 @@
require "rails_helper" require "rails_helper"
describe "Commenting topics from proposals" do describe "Commenting topics from proposals" do
let(:user) { create :user } let(:user) { create(:user) }
let(:proposal) { create :proposal } let(:proposal) { create(:proposal) }
it_behaves_like "flaggable", :topic_with_community_comment it_behaves_like "flaggable", :topic_with_community_comment
@@ -153,7 +153,7 @@ describe "Commenting topics from proposals" do
scenario "Turns links into html links" do scenario "Turns links into html links" do
community = proposal.community community = proposal.community
topic = create(:topic, community: community) topic = create(:topic, community: community)
create :comment, commentable: topic, body: "Built with http://rubyonrails.org/" create(:comment, commentable: topic, body: "Built with http://rubyonrails.org/")
visit community_topic_path(community, topic) visit community_topic_path(community, topic)
@@ -168,10 +168,10 @@ describe "Commenting topics from proposals" do
scenario "Sanitizes comment body for security" do scenario "Sanitizes comment body for security" do
community = proposal.community community = proposal.community
topic = create(:topic, community: community) topic = create(:topic, community: community)
create :comment, commentable: topic, create(:comment, commentable: topic,
body: "<script>alert('hola')</script> " \ body: "<script>alert('hola')</script> " \
"<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \ "<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \
"http://www.url.com" "http://www.url.com")
visit community_topic_path(community, topic) visit community_topic_path(community, topic)
@@ -574,8 +574,8 @@ describe "Commenting topics from proposals" do
end end
describe "Commenting topics from budget investments" do describe "Commenting topics from budget investments" do
let(:user) { create :user } let(:user) { create(:user) }
let(:investment) { create :budget_investment } let(:investment) { create(:budget_investment) }
scenario "Index" do scenario "Index" do
community = investment.community community = investment.community
@@ -702,7 +702,7 @@ describe "Commenting topics from budget investments" do
scenario "Turns links into html links" do scenario "Turns links into html links" do
community = investment.community community = investment.community
topic = create(:topic, community: community) topic = create(:topic, community: community)
create :comment, commentable: topic, body: "Built with http://rubyonrails.org/" create(:comment, commentable: topic, body: "Built with http://rubyonrails.org/")
visit community_topic_path(community, topic) visit community_topic_path(community, topic)
@@ -717,10 +717,10 @@ describe "Commenting topics from budget investments" do
scenario "Sanitizes comment body for security" do scenario "Sanitizes comment body for security" do
community = investment.community community = investment.community
topic = create(:topic, community: community) topic = create(:topic, community: community)
create :comment, commentable: topic, create(:comment, commentable: topic,
body: "<script>alert('hola')</script> " \ body: "<script>alert('hola')</script> " \
"<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \ "<a href=\"javascript:alert('sorpresa!')\">click me<a/> " \
"http://www.url.com" "http://www.url.com")
visit community_topic_path(community, topic) visit community_topic_path(community, topic)

View File

@@ -1,7 +1,7 @@
require "rails_helper" require "rails_helper"
describe "Notifications" do describe "Notifications" do
let(:user) { create :user } let(:user) { create(:user) }
before { login_as(user) } before { login_as(user) }
scenario "View all" do scenario "View all" do

View File

@@ -29,7 +29,7 @@ describe "Tags" do
scenario "Index shows 3 tags with no plus link" do scenario "Index shows 3 tags with no plus link" do
tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"] tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"]
create :budget_investment, heading: heading, tag_list: tag_list create(:budget_investment, heading: heading, tag_list: tag_list)
visit budget_investments_path(budget, heading_id: heading.id) visit budget_investments_path(budget, heading_id: heading.id)
@@ -43,7 +43,7 @@ describe "Tags" do
scenario "Index shows up to 5 tags per investment" do scenario "Index shows up to 5 tags per investment" do
tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
create :budget_investment, heading: heading, tag_list: tag_list create(:budget_investment, heading: heading, tag_list: tag_list)
visit budget_investments_path(budget, heading_id: heading.id) visit budget_investments_path(budget, heading_id: heading.id)

View File

@@ -18,7 +18,7 @@ describe "Tags" do
scenario "Index shows up to 5 tags per proposal" do scenario "Index shows up to 5 tags per proposal" do
tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
create :debate, tag_list: tag_list create(:debate, tag_list: tag_list)
visit debates_path visit debates_path
@@ -29,7 +29,7 @@ describe "Tags" do
scenario "Index shows 3 tags with no plus link" do scenario "Index shows 3 tags with no plus link" do
tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"] tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"]
create :debate, tag_list: tag_list create(:debate, tag_list: tag_list)
visit debates_path visit debates_path

View File

@@ -18,7 +18,7 @@ describe "Tags" do
scenario "Index shows up to 5 tags per proposal" do scenario "Index shows up to 5 tags per proposal" do
tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"]
create :proposal, tag_list: tag_list create(:proposal, tag_list: tag_list)
visit proposals_path visit proposals_path
@@ -38,7 +38,7 @@ describe "Tags" do
scenario "Index shows 3 tags with no plus link" do scenario "Index shows 3 tags with no plus link" do
tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"] tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"]
create :proposal, tag_list: tag_list create(:proposal, tag_list: tag_list)
visit proposals_path visit proposals_path