Remove isolated useless assignments

These variables are not surrounded by other assignments, and so they can
safely be removed without making it harder to read the code vertically.
This commit is contained in:
Javi Martín
2019-09-23 01:43:12 +02:00
parent 5cbd160f11
commit 7b0771106e
31 changed files with 118 additions and 114 deletions

View File

@@ -67,7 +67,7 @@ describe "Account" do
" complete the confirmation of your new email address." " complete the confirmation of your new email address."
expect(page).to have_content notice expect(page).to have_content notice
email = open_last_email open_last_email
visit_in_email("Confirm my account") visit_in_email("Confirm my account")
logout logout

View File

@@ -36,7 +36,7 @@ describe "Admin legislation draft versions" do
context "Create" do context "Create" do
scenario "Valid legislation draft version" do scenario "Valid legislation draft version" do
process = create(:legislation_process, title: "An example legislation process") create(:legislation_process, title: "An example legislation process")
visit admin_root_path visit admin_root_path

View File

@@ -24,8 +24,8 @@ describe "Admin legislation questions" do
context "Index" do context "Index" do
scenario "Displaying legislation process questions" do scenario "Displaying legislation process questions" do
question = create(:legislation_question, process: process, title: "Question 1") create(:legislation_question, process: process, title: "Question 1")
question = create(:legislation_question, process: process, title: "Question 2") create(:legislation_question, process: process, title: "Question 2")
visit admin_legislation_processes_path(filter: "all") visit admin_legislation_processes_path(filter: "all")
@@ -63,7 +63,7 @@ describe "Admin legislation questions" do
context "Update" do context "Update" do
scenario "Valid legislation question", :js do scenario "Valid legislation question", :js do
question = create(:legislation_question, title: "Question 2", process: process) create(:legislation_question, title: "Question 2", process: process)
visit admin_root_path visit admin_root_path

View File

@@ -79,7 +79,7 @@ describe "Admin booths assignments" do
end end
scenario "Unassign booth from poll", :js do scenario "Unassign booth from poll", :js do
assignment = create(:poll_booth_assignment, poll: poll, booth: booth) create(:poll_booth_assignment, poll: poll, booth: booth)
visit admin_poll_path(poll) visit admin_poll_path(poll)
within("#poll-resources") do within("#poll-resources") do

View File

@@ -42,7 +42,7 @@ describe "Admin custom content blocks" do
end end
scenario "Invalid custom block" do scenario "Invalid custom block" do
block = create(:site_customization_content_block) create(:site_customization_content_block)
visit admin_root_path visit admin_root_path
@@ -68,7 +68,8 @@ describe "Admin custom content blocks" do
context "Update" do context "Update" do
scenario "Valid custom block" do scenario "Valid custom block" do
block = create(:site_customization_content_block) create(:site_customization_content_block)
visit admin_root_path visit admin_root_path
within("#side_menu") do within("#side_menu") do

View File

@@ -357,7 +357,7 @@ describe "Stats" do
context "Polls" do context "Polls" do
scenario "Total participants by origin" do scenario "Total participants by origin" do
oa = create(:poll_officer_assignment) create(:poll_officer_assignment)
3.times { create(:poll_voter, origin: "web") } 3.times { create(:poll_voter, origin: "web") }
visit admin_stats_path visit admin_stats_path

View File

@@ -69,7 +69,8 @@ describe "Admin tags" do
context "Manage only tags of kind category" do context "Manage only tags of kind category" do
scenario "Index shows only categories" do scenario "Index shows only categories" do
not_category_tag = create(:tag, name: "Not a category") create(:tag, name: "Not a category")
visit admin_tags_path visit admin_tags_path
expect(page).to have_content @tag1.name expect(page).to have_content @tag1.name

View File

@@ -57,7 +57,7 @@ describe "Valuator groups" do
end end
scenario "Update" do scenario "Update" do
group = create(:valuator_group, name: "Health") create(:valuator_group, name: "Health")
visit admin_valuator_groups_path visit admin_valuator_groups_path
click_link "Edit" click_link "Edit"
@@ -70,7 +70,7 @@ describe "Valuator groups" do
end end
scenario "Delete" do scenario "Delete" do
group = create(:valuator_group) create(:valuator_group)
visit admin_valuator_groups_path visit admin_valuator_groups_path
click_link "Delete" click_link "Delete"

View File

@@ -22,9 +22,9 @@ describe "Incomplete verifications" do
end end
scenario "Search" do scenario "Search" do
verified_user = create(:user, :level_two, username: "Juan Carlos") create(:user, :level_two, username: "Juan Carlos")
unverified_user = create(:user, :incomplete_verification, username: "Juan_anonymous") create(:user, :incomplete_verification, username: "Juan_anonymous")
unverified_user = create(:user, :incomplete_verification, username: "Isabel_anonymous") create(:user, :incomplete_verification, username: "Isabel_anonymous")
visit admin_verifications_path visit admin_verifications_path

View File

@@ -17,10 +17,7 @@ describe "Budget Poll Officing" do
expect(page).not_to have_content("Total recounts and results") expect(page).not_to have_content("Total recounts and results")
create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :recount_scrutiny) create(:poll_shift, officer: officer, booth: booth, date: Date.current, task: :recount_scrutiny)
create(:poll_officer_assignment, booth_assignment: booth_assignment, officer: officer)
officer_assignment = create(:poll_officer_assignment,
booth_assignment: booth_assignment,
officer: officer)
visit officing_root_path visit officing_root_path

View File

@@ -8,8 +8,8 @@ describe "Poll Questions" do
end end
scenario "Do not display polls associated to a budget" do scenario "Do not display polls associated to a budget" do
poll1 = create(:poll, name: "Citizen Proposal Poll") create(:poll, name: "Citizen Proposal Poll")
poll2 = create(:poll, :for_budget, name: "Participatory Budget Poll") create(:poll, :for_budget, name: "Participatory Budget Poll")
visit admin_questions_path visit admin_questions_path

View File

@@ -77,10 +77,10 @@ describe "Ballots" do
end end
scenario "Headings" do scenario "Headings" do
city_heading1 = create(:budget_heading, group: city, name: "Investments Type1") create(:budget_heading, group: city, name: "Investments Type1")
city_heading2 = create(:budget_heading, group: city, name: "Investments Type2") create(:budget_heading, group: city, name: "Investments Type2")
district_heading1 = create(:budget_heading, group: districts, name: "District 1") create(:budget_heading, group: districts, name: "District 1")
district_heading2 = create(:budget_heading, group: districts, name: "District 2") create(:budget_heading, group: districts, name: "District 2")
visit budget_path(budget) visit budget_path(budget)
click_link "City" click_link "City"

View File

@@ -367,8 +367,8 @@ describe "Budgets" do
context "Show" do context "Show" do
scenario "List all groups" do scenario "List all groups" do
group1 = create(:budget_group, budget: budget) create(:budget_group, budget: budget)
group2 = create(:budget_group, budget: budget) create(:budget_group, budget: budget)
visit budget_path(budget) visit budget_path(budget)

View File

@@ -7,7 +7,7 @@ describe "Commenting Budget::Investments" do
scenario "Index" do scenario "Index" do
3.times { create(:comment, commentable: investment) } 3.times { create(:comment, commentable: investment) }
valuation_comment = create(:comment, :valuation, commentable: investment, subject: "Not viable") create(:comment, :valuation, commentable: investment, subject: "Not viable")
visit budget_investment_path(investment.budget, investment) visit budget_investment_path(investment.budget, investment)

View File

@@ -922,9 +922,9 @@ describe "Debates" do
end end
scenario "Order by relevance by default", :js do scenario "Order by relevance by default", :js do
debate1 = create(:debate, title: "Show you got", cached_votes_up: 10) create(:debate, title: "Show you got", cached_votes_up: 10)
debate2 = create(:debate, title: "Show what you got", cached_votes_up: 1) create(:debate, title: "Show what you got", cached_votes_up: 1)
debate3 = create(:debate, title: "Show you got", cached_votes_up: 100) create(:debate, title: "Show you got", cached_votes_up: 100)
visit debates_path visit debates_path
fill_in "search", with: "Show you got" fill_in "search", with: "Show you got"
@@ -940,10 +940,10 @@ describe "Debates" do
end end
scenario "Reorder results maintaing search", :js do scenario "Reorder results maintaing search", :js do
debate1 = create(:debate, title: "Show you got", cached_votes_up: 10, created_at: 1.week.ago) create(:debate, title: "Show you got", cached_votes_up: 10, created_at: 1.week.ago)
debate2 = create(:debate, title: "Show what you got", cached_votes_up: 1, created_at: 1.month.ago) create(:debate, title: "Show what you got", cached_votes_up: 1, created_at: 1.month.ago)
debate3 = create(:debate, title: "Show you got", cached_votes_up: 100, created_at: Time.current) create(:debate, title: "Show you got", cached_votes_up: 100, created_at: Time.current)
debate4 = create(:debate, title: "Do not display", cached_votes_up: 1, created_at: 1.week.ago) create(:debate, title: "Do not display", cached_votes_up: 1, created_at: 1.week.ago)
visit debates_path visit debates_path
fill_in "search", with: "Show you got" fill_in "search", with: "Show you got"
@@ -1088,13 +1088,13 @@ describe "Debates" do
context "Suggesting debates" do context "Suggesting debates" do
scenario "Shows up to 5 suggestions", :js do scenario "Shows up to 5 suggestions", :js do
debate1 = create(:debate, title: "First debate has 1 vote", cached_votes_up: 1) create(:debate, title: "First debate has 1 vote", cached_votes_up: 1)
debate2 = create(:debate, title: "Second debate has 2 votes", cached_votes_up: 2) create(:debate, title: "Second debate has 2 votes", cached_votes_up: 2)
debate3 = create(:debate, title: "Third debate has 3 votes", cached_votes_up: 3) create(:debate, title: "Third debate has 3 votes", cached_votes_up: 3)
debate4 = create(:debate, title: "This one has 4 votes", description: "This is the fourth debate", cached_votes_up: 4) create(:debate, title: "This one has 4 votes", description: "This is the fourth debate", cached_votes_up: 4)
debate5 = create(:debate, title: "Fifth debate has 5 votes", cached_votes_up: 5) create(:debate, title: "Fifth debate has 5 votes", cached_votes_up: 5)
debate6 = create(:debate, title: "Sixth debate has 6 votes", description: "This is the sixth debate", cached_votes_up: 6) create(:debate, title: "Sixth debate has 6 votes", description: "This is the sixth debate", cached_votes_up: 6)
debate7 = create(:debate, title: "This has seven votes, and is not suggest", description: "This is the seven", cached_votes_up: 7) create(:debate, title: "This has seven votes, and is not suggest", description: "This is the seven", cached_votes_up: 7)
login_as(create(:user)) login_as(create(:user))
visit new_debate_path visit new_debate_path
@@ -1107,8 +1107,8 @@ describe "Debates" do
end end
scenario "No found suggestions", :js do scenario "No found suggestions", :js do
debate1 = create(:debate, title: "First debate has 10 vote", cached_votes_up: 10) create(:debate, title: "First debate has 10 vote", cached_votes_up: 10)
debate2 = create(:debate, title: "Second debate has 2 votes", cached_votes_up: 2) create(:debate, title: "Second debate has 2 votes", cached_votes_up: 2)
login_as(create(:user)) login_as(create(:user))
visit new_debate_path visit new_debate_path
@@ -1153,8 +1153,8 @@ describe "Debates" do
end end
scenario "Index include featured debates" do scenario "Index include featured debates" do
debate1 = create(:debate, featured_at: Time.current) create(:debate, featured_at: Time.current)
debate2 = create(:debate) create(:debate)
login_as(create(:administrator).user) login_as(create(:administrator).user)
visit debates_path visit debates_path
@@ -1164,8 +1164,8 @@ describe "Debates" do
end end
scenario "Index do not show featured debates if none is marked as featured" do scenario "Index do not show featured debates if none is marked as featured" do
debate1 = create(:debate) create(:debate)
debate2 = create(:debate) create(:debate)
login_as(create(:administrator).user) login_as(create(:administrator).user)
visit debates_path visit debates_path

View File

@@ -11,7 +11,7 @@ describe "Home" do
end end
scenario "Not display recommended section" do scenario "Not display recommended section" do
debate = create(:debate) create(:debate)
visit root_path visit root_path
@@ -32,13 +32,15 @@ describe "Home" do
end end
scenario "Display recommended section when feature flag recommended is active" do scenario "Display recommended section when feature flag recommended is active" do
debate = create(:debate, tag_list: "Sport") create(:debate, tag_list: "Sport")
visit root_path visit root_path
expect(page).to have_content "Recommendations that may interest you" expect(page).to have_content "Recommendations that may interest you"
end end
scenario "Not display recommended section when feature flag recommended is not active" do scenario "Not display recommended section when feature flag recommended is not active" do
debate = create(:debate, tag_list: "Sport") create(:debate, tag_list: "Sport")
Setting["feature.user.recommendations"] = false Setting["feature.user.recommendations"] = false
visit root_path visit root_path
@@ -56,8 +58,10 @@ describe "Home" do
end end
scenario "Display all recommended debates link" do scenario "Display all recommended debates link" do
debate = create(:debate, tag_list: "Sport") create(:debate, tag_list: "Sport")
visit root_path visit root_path
expect(page).to have_link("All recommended debates", href: debates_path(order: "recommendations")) expect(page).to have_link("All recommended debates", href: debates_path(order: "recommendations"))
end end
@@ -71,8 +75,10 @@ describe "Home" do
end end
scenario "Display all recommended proposals link" do scenario "Display all recommended proposals link" do
debate = create(:proposal, tag_list: "Sport") create(:proposal, tag_list: "Sport")
visit root_path visit root_path
expect(page).to have_link("All recommended proposals", href: proposals_path(order: "recommendations")) expect(page).to have_link("All recommended proposals", href: proposals_path(order: "recommendations"))
end end
@@ -140,7 +146,7 @@ describe "Home" do
end end
scenario "if there are cards, the 'featured' title will render" do scenario "if there are cards, the 'featured' title will render" do
card = create(:widget_card, create(:widget_card,
title: "Card text", title: "Card text",
description: "Card description", description: "Card description",
link_text: "Link text", link_text: "Link text",

View File

@@ -69,8 +69,7 @@ describe "Notifications" do
end end
scenario "Mark all as read" do scenario "Mark all as read" do
notification1 = create(:notification, user: user) 2.times { create(:notification, user: user) }
notification2 = create(:notification, user: user)
click_notifications_icon click_notifications_icon

View File

@@ -123,19 +123,20 @@ describe "Officing Results", :with_frozen_time do
end end
scenario "Index lists all questions and answers" do scenario "Index lists all questions and answers" do
partial_result = create(:poll_partial_result, create(:poll_partial_result,
officer_assignment: poll_officer.officer_assignments.first, officer_assignment: poll_officer.officer_assignments.first,
booth_assignment: poll_officer.officer_assignments.first.booth_assignment, booth_assignment: poll_officer.officer_assignments.first.booth_assignment,
date: poll.ends_at, date: poll.ends_at,
question: @question_1, question: @question_1,
amount: 33) amount: 33)
poll_recount = create(:poll_recount,
officer_assignment: poll_officer.officer_assignments.first, create(:poll_recount,
booth_assignment: poll_officer.officer_assignments.first.booth_assignment, officer_assignment: poll_officer.officer_assignments.first,
date: poll.ends_at, booth_assignment: poll_officer.officer_assignments.first.booth_assignment,
white_amount: 21, date: poll.ends_at,
null_amount: 44, white_amount: 21,
total_amount: 66) null_amount: 44,
total_amount: 66)
visit officing_poll_results_path(poll, visit officing_poll_results_path(poll,
date: I18n.l(poll.ends_at.to_date), date: I18n.l(poll.ends_at.to_date),

View File

@@ -135,8 +135,8 @@ describe "Poll Officing" do
create(:poll_shift, officer: officer1, booth: booth, date: Date.current, task: :vote_collection) create(:poll_shift, officer: officer1, booth: booth, date: Date.current, task: :vote_collection)
create(:poll_shift, officer: officer2, booth: booth, date: Date.current, task: :vote_collection) create(:poll_shift, officer: officer2, booth: booth, date: Date.current, task: :vote_collection)
officer_assignment_1 = create(:poll_officer_assignment, booth_assignment: booth_assignment, officer: officer1) create(:poll_officer_assignment, booth_assignment: booth_assignment, officer: officer1)
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment, officer: officer2) create(:poll_officer_assignment, booth_assignment: booth_assignment, officer: officer2)
in_browser(:one) do in_browser(:one) do
login_as officer1.user login_as officer1.user

View File

@@ -70,7 +70,7 @@ describe "Polls" do
end end
scenario "Displays icon correctly", :js do scenario "Displays icon correctly", :js do
polls = create_list(:poll, 3) create_list(:poll, 3)
visit polls_path visit polls_path

View File

@@ -483,10 +483,9 @@ describe "Proposals" do
end end
scenario "Specific geozone" do scenario "Specific geozone" do
geozone = create(:geozone, name: "California") create(:geozone, name: "California")
geozone = create(:geozone, name: "New York") create(:geozone, name: "New York")
author = create(:user) login_as(create(:user))
login_as(author)
visit new_proposal_path visit new_proposal_path
@@ -1438,9 +1437,9 @@ describe "Proposals" do
end end
scenario "Order by relevance by default", :js do scenario "Order by relevance by default", :js do
proposal1 = create(:proposal, title: "Show you got", cached_votes_up: 10) create(:proposal, title: "Show you got", cached_votes_up: 10)
proposal2 = create(:proposal, title: "Show what you got", cached_votes_up: 1) create(:proposal, title: "Show what you got", cached_votes_up: 1)
proposal3 = create(:proposal, title: "Show you got", cached_votes_up: 100) create(:proposal, title: "Show you got", cached_votes_up: 100)
visit proposals_path visit proposals_path
fill_in "search", with: "Show what you got" fill_in "search", with: "Show what you got"
@@ -1456,10 +1455,10 @@ describe "Proposals" do
end end
scenario "Reorder results maintaing search", :js do scenario "Reorder results maintaing search", :js do
proposal1 = create(:proposal, title: "Show you got", cached_votes_up: 10, created_at: 1.week.ago) create(:proposal, title: "Show you got", cached_votes_up: 10, created_at: 1.week.ago)
proposal2 = create(:proposal, title: "Show what you got", cached_votes_up: 1, created_at: 1.month.ago) create(:proposal, title: "Show what you got", cached_votes_up: 1, created_at: 1.month.ago)
proposal3 = create(:proposal, title: "Show you got", cached_votes_up: 100, created_at: Time.current) create(:proposal, title: "Show you got", cached_votes_up: 100, created_at: Time.current)
proposal4 = create(:proposal, title: "Do not display", cached_votes_up: 1, created_at: 1.week.ago) create(:proposal, title: "Do not display", cached_votes_up: 1, created_at: 1.week.ago)
visit proposals_path visit proposals_path
fill_in "search", with: "Show what you got" fill_in "search", with: "Show what you got"

View File

@@ -73,7 +73,7 @@ describe "Custom Pages" do
end end
scenario "Listed in more information page" do scenario "Listed in more information page" do
custom_page = create(:site_customization_page, :published, create(:site_customization_page, :published,
slug: "another-slug", slug: "another-slug",
title_en: "Another custom page", title_en: "Another custom page",
subtitle_en: "Subtitle for custom page", subtitle_en: "Subtitle for custom page",

View File

@@ -101,8 +101,8 @@ describe "Tags" do
end end
scenario "Turbolinks sanity check from budget's show", :js do scenario "Turbolinks sanity check from budget's show", :js do
education = create(:tag, name: "Education", kind: "category") create(:tag, name: "Education", kind: "category")
health = create(:tag, name: "Health", kind: "category") create(:tag, name: "Health", kind: "category")
login_as(author) login_as(author)
visit budget_path(budget) visit budget_path(budget)
@@ -125,8 +125,8 @@ describe "Tags" do
end end
scenario "Turbolinks sanity check from budget heading's show", :js do scenario "Turbolinks sanity check from budget heading's show", :js do
education = create(:tag, name: "Education", kind: "category") create(:tag, name: "Education", kind: "category")
health = create(:tag, name: "Health", kind: "category") create(:tag, name: "Health", kind: "category")
login_as(author) login_as(author)
visit budget_investments_path(budget, heading_id: heading.id) visit budget_investments_path(budget, heading_id: heading.id)

View File

@@ -43,8 +43,8 @@ describe "Tags" do
end end
scenario "Index tag does not show featured debates" do scenario "Index tag does not show featured debates" do
featured_debates = create_featured_debates create_featured_debates
debates = create(:debate, tag_list: "123") create(:debate, tag_list: "123")
visit debates_path(tag: "123") visit debates_path(tag: "123")
@@ -186,8 +186,8 @@ describe "Tags" do
context "Tag cloud" do context "Tag cloud" do
scenario "Display user tags" do scenario "Display user tags" do
earth = create(:debate, tag_list: "Medio Ambiente") create(:debate, tag_list: "Medio Ambiente")
money = create(:debate, tag_list: "Economía") create(:debate, tag_list: "Economía")
visit debates_path visit debates_path

View File

@@ -29,7 +29,7 @@ describe "Tags" do
end end
scenario "Index featured proposals does not show tags" do scenario "Index featured proposals does not show tags" do
proposal = create(:proposal, tag_list: "123") create(:proposal, tag_list: "123")
visit proposals_path(tag: "123") visit proposals_path(tag: "123")
@@ -83,8 +83,8 @@ describe "Tags" do
end end
scenario "Category with category tags", :js do scenario "Category with category tags", :js do
education = create(:tag, :category, name: "Education") create(:tag, :category, name: "Education")
health = create(:tag, :category, name: "Health") create(:tag, :category, name: "Health")
login_as(create(:user)) login_as(create(:user))
visit new_proposal_path visit new_proposal_path
@@ -220,8 +220,8 @@ describe "Tags" do
context "Tag cloud" do context "Tag cloud" do
scenario "Display user tags" do scenario "Display user tags" do
earth = create(:proposal, tag_list: "Medio Ambiente") create(:proposal, tag_list: "Medio Ambiente")
money = create(:proposal, tag_list: "Economía") create(:proposal, tag_list: "Economía")
visit proposals_path visit proposals_path
@@ -256,8 +256,8 @@ describe "Tags" do
create(:tag, :category, name: "Medio Ambiente") create(:tag, :category, name: "Medio Ambiente")
create(:tag, :category, name: "Economía") create(:tag, :category, name: "Economía")
earth = create(:proposal, tag_list: "Medio Ambiente") create(:proposal, tag_list: "Medio Ambiente")
money = create(:proposal, tag_list: "Economía") create(:proposal, tag_list: "Economía")
visit proposals_path visit proposals_path

View File

@@ -124,8 +124,8 @@ describe "Tags" do
context "Tag cloud" do context "Tag cloud" do
scenario "Proposals" do scenario "Proposals" do
earth = create(:proposal, tag_list: "Medio Ambiente") create(:proposal, tag_list: "Medio Ambiente")
money = create(:proposal, tag_list: "Economía") create(:proposal, tag_list: "Economía")
visit proposals_path visit proposals_path
@@ -136,8 +136,8 @@ describe "Tags" do
end end
scenario "Debates" do scenario "Debates" do
earth = create(:debate, tag_list: "Medio Ambiente") create(:debate, tag_list: "Medio Ambiente")
money = create(:debate, tag_list: "Economía") create(:debate, tag_list: "Economía")
visit debates_path visit debates_path
@@ -151,8 +151,8 @@ describe "Tags" do
create(:tag, :category, name: "Medio Ambiente") create(:tag, :category, name: "Medio Ambiente")
create(:tag, :category, name: "Economía") create(:tag, :category, name: "Economía")
earth = create(:proposal, tag_list: "Medio Ambiente, Agua") create(:proposal, tag_list: "Medio Ambiente, Agua")
money = create(:proposal, tag_list: "Economía, Corrupción") create(:proposal, tag_list: "Economía, Corrupción")
visit proposals_path(search: "Economía") visit proposals_path(search: "Economía")
@@ -167,8 +167,8 @@ describe "Tags" do
create(:geozone, name: "Madrid") create(:geozone, name: "Madrid")
create(:geozone, name: "Barcelona") create(:geozone, name: "Barcelona")
earth = create(:proposal, tag_list: "Madrid, Agua") create(:proposal, tag_list: "Madrid, Agua")
money = create(:proposal, tag_list: "Barcelona, Playa") create(:proposal, tag_list: "Barcelona, Playa")
visit proposals_path(search: "Barcelona") visit proposals_path(search: "Barcelona")

View File

@@ -85,8 +85,8 @@ describe DirectMessage do
end end
it "does not return direct messages created another day" do it "does not return direct messages created another day" do
direct_message1 = create(:direct_message, created_at: 1.day.ago) create(:direct_message, created_at: 1.day.ago)
direct_message2 = create(:direct_message, created_at: 1.day.from_now) create(:direct_message, created_at: 1.day.from_now)
expect(DirectMessage.today.count).to eq 0 expect(DirectMessage.today.count).to eq 0
end end

View File

@@ -186,12 +186,12 @@ describe Legislation::Process do
it "invalid format colors" do it "invalid format colors" do
expect { expect {
process = create(:legislation_process, background_color: "#123ghi", font_color: "#fff") create(:legislation_process, background_color: "#123ghi", font_color: "#fff")
}.to raise_error(ActiveRecord::RecordInvalid, }.to raise_error(ActiveRecord::RecordInvalid,
"Validation failed: Background color is invalid") "Validation failed: Background color is invalid")
expect { expect {
process = create(:legislation_process, background_color: "#fff", font_color: "ggg") create(:legislation_process, background_color: "#fff", font_color: "ggg")
}.to raise_error(ActiveRecord::RecordInvalid, }.to raise_error(ActiveRecord::RecordInvalid,
"Validation failed: Font color is invalid") "Validation failed: Font color is invalid")
end end

View File

@@ -38,7 +38,7 @@ describe ProposalNotification do
end end
it "blocks proposal notifications without proposal" do it "blocks proposal notifications without proposal" do
proposal = build(:proposal_notification, proposal: nil).save!(validate: false) build(:proposal_notification, proposal: nil).save!(validate: false)
expect(ProposalNotification.public_for_api).not_to include(notification) expect(ProposalNotification.public_for_api).not_to include(notification)
end end

View File

@@ -4,7 +4,7 @@ shared_examples "notifiable in-app" do |described_class|
let!(:notifiable) { create(model_name(described_class), author: author) } let!(:notifiable) { create(model_name(described_class), author: author) }
scenario "Notification icon is shown" do scenario "Notification icon is shown" do
notification = create(:notification, notifiable: notifiable, user: author) create(:notification, notifiable: notifiable, user: author)
login_as author login_as author
visit root_path visit root_path

View File

@@ -6,7 +6,7 @@ shared_examples "relationable" do |relationable_model_name|
let(:user) { create(:user) } let(:user) { create(:user) }
scenario "related contents are listed" do scenario "related contents are listed" do
related_content = create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user)) create(:related_content, parent_relationable: relationable, child_relationable: related1, author: build(:user))
visit relationable.url visit relationable.url
within("#related-content-list") do within("#related-content-list") do