diff --git a/.rubocop.yml b/.rubocop.yml index de96c2b1d..131ba2aa6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -464,6 +464,9 @@ Rails/WhereNotWithMultipleConditions: RSpec/AroundBlock: Enabled: true +RSpec/BeEq: + Enabled: true + RSpec/BeforeAfterAll: Enabled: true diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 7d952afba..27fb4ae0f 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -5,21 +5,21 @@ describe ApplicationHelper do it "is true if user is the author" do user = create(:user) proposal = create(:proposal, author: user) - expect(author_of?(proposal, user)).to eq true + expect(author_of?(proposal, user)).to be true end it "is false if user is not the author" do user = create(:user) proposal = create(:proposal) - expect(author_of?(proposal, user)).to eq false + expect(author_of?(proposal, user)).to be false end it "is false if user or authorable is nil" do user = create(:user) proposal = create(:proposal) - expect(author_of?(nil, user)).to eq false - expect(author_of?(proposal, nil)).to eq false + expect(author_of?(nil, user)).to be false + expect(author_of?(proposal, nil)).to be false end end end diff --git a/spec/helpers/legislation_helper_spec.rb b/spec/helpers/legislation_helper_spec.rb index 627155123..74b61992a 100644 --- a/spec/helpers/legislation_helper_spec.rb +++ b/spec/helpers/legislation_helper_spec.rb @@ -10,22 +10,22 @@ describe LegislationHelper do describe "banner colors presence" do it "background and font color exist" do @process = build(:legislation_process, background_color: "#944949", font_color: "#ffffff") - expect(banner_color?).to eq(true) + expect(banner_color?).to be true end it "background color exist and font color not exist" do @process = build(:legislation_process, background_color: "#944949", font_color: "") - expect(banner_color?).to eq(false) + expect(banner_color?).to be false end it "background color not exist and font color exist" do @process = build(:legislation_process, background_color: "", font_color: "#944949") - expect(banner_color?).to eq(false) + expect(banner_color?).to be false end it "background and font color not exist" do @process = build(:legislation_process, background_color: "", font_color: "") - expect(banner_color?).to eq(false) + expect(banner_color?).to be false end end end diff --git a/spec/helpers/settings_helper_spec.rb b/spec/helpers/settings_helper_spec.rb index e63ddb773..a28b5bd03 100644 --- a/spec/helpers/settings_helper_spec.rb +++ b/spec/helpers/settings_helper_spec.rb @@ -8,7 +8,7 @@ RSpec.describe SettingsHelper, type: :helper do expect(setting["key1"]).to eq("value1") expect(setting["key2"]).to eq("value2") - expect(setting["key3"]).to eq(nil) + expect(setting["key3"]).to be nil end end @@ -19,9 +19,9 @@ RSpec.describe SettingsHelper, type: :helper do Setting["feature.f3"] = nil expect(feature?("f1")).to eq("active") - expect(feature?("f2")).to eq(nil) - expect(feature?("f3")).to eq(nil) - expect(feature?("f4")).to eq(nil) + expect(feature?("f2")).to be nil + expect(feature?("f3")).to be nil + expect(feature?("f4")).to be nil end end diff --git a/spec/lib/email_digests_spec.rb b/spec/lib/email_digests_spec.rb index 0090ca097..5ca720424 100644 --- a/spec/lib/email_digests_spec.rb +++ b/spec/lib/email_digests_spec.rb @@ -129,7 +129,7 @@ describe EmailDigest do user = create(:user, email: "invalid_email@email..com") email_digest = EmailDigest.new(user) - expect(email_digest.valid_email?).to be(nil) + expect(email_digest.valid_email?).to be nil end it "returns false if email does not exist" do @@ -137,7 +137,7 @@ describe EmailDigest do user.email = nil email_digest = EmailDigest.new(user) - expect(email_digest.valid_email?).to be(false) + expect(email_digest.valid_email?).to be false end end end diff --git a/spec/lib/remote_translations/caller_spec.rb b/spec/lib/remote_translations/caller_spec.rb index 76bc49695..f4ffc92bf 100644 --- a/spec/lib/remote_translations/caller_spec.rb +++ b/spec/lib/remote_translations/caller_spec.rb @@ -34,9 +34,9 @@ describe RemoteTranslations::Caller, :remote_translations do caller.call - expect(remote_translation.error_message).to eq nil + expect(remote_translation.error_message).to be nil expect(debate.translations.count).to eq(2) - expect(debate.valid?).to eq true + expect(debate.valid?).to be true end it "when new translation locale is distinct to default_locale not skip presence validations" do @@ -47,7 +47,7 @@ describe RemoteTranslations::Caller, :remote_translations do expect(remote_translation.error_message).to include("can't be blank") expect(debate.translations.count).to eq(1) - expect(debate.valid?).to eq false + expect(debate.valid?).to be false end it "destroy remote translation instance" do @@ -83,9 +83,9 @@ describe RemoteTranslations::Caller, :remote_translations do caller.call - expect(remote_translation.error_message).to eq nil + expect(remote_translation.error_message).to be nil expect(proposal.translations.count).to eq(2) - expect(proposal.valid?).to eq true + expect(proposal.valid?).to be true end it "when new translation locale is distinct to default_locale do not skip presence validations" do @@ -96,7 +96,7 @@ describe RemoteTranslations::Caller, :remote_translations do expect(remote_translation.error_message).to include("can't be blank") expect(proposal.translations.count).to eq(1) - expect(proposal.valid?).to eq false + expect(proposal.valid?).to be false end it "destroy remote translation instance" do @@ -132,9 +132,9 @@ describe RemoteTranslations::Caller, :remote_translations do caller.call - expect(remote_translation.error_message).to eq nil + expect(remote_translation.error_message).to be nil expect(budget_investment.translations.count).to eq(2) - expect(budget_investment.valid?).to eq true + expect(budget_investment.valid?).to be true end it "when new translation locale is distinct to default_locale not skip presence validations" do @@ -145,7 +145,7 @@ describe RemoteTranslations::Caller, :remote_translations do expect(remote_translation.error_message).to include("can't be blank") expect(budget_investment.translations.count).to eq(1) - expect(budget_investment.valid?).to eq false + expect(budget_investment.valid?).to be false end it "destroy remote translation instance" do @@ -180,9 +180,9 @@ describe RemoteTranslations::Caller, :remote_translations do caller.call - expect(remote_translation.error_message).to eq nil + expect(remote_translation.error_message).to be nil expect(comment.translations.count).to eq(2) - expect(comment.valid?).to eq true + expect(comment.valid?).to be true end it "when new translation locale is distinct to default_locale not skip presence validations" do @@ -193,7 +193,7 @@ describe RemoteTranslations::Caller, :remote_translations do expect(remote_translation.error_message).to include("can't be blank") expect(comment.translations.count).to eq(1) - expect(comment.valid?).to eq false + expect(comment.valid?).to be false end it "destroy remote translation instance" do diff --git a/spec/models/budget/ballot_spec.rb b/spec/models/budget/ballot_spec.rb index 64cebae2e..21634b792 100644 --- a/spec/models/budget/ballot_spec.rb +++ b/spec/models/budget/ballot_spec.rb @@ -143,7 +143,7 @@ describe Budget::Ballot do 2.times { create(:budget_heading, group: group) } - expect(ballot.heading_for_group(group)).to eq nil + expect(ballot.heading_for_group(group)).to be nil end end end diff --git a/spec/models/budget/heading_spec.rb b/spec/models/budget/heading_spec.rb index 25d8646c2..8cd6c70ce 100644 --- a/spec/models/budget/heading_spec.rb +++ b/spec/models/budget/heading_spec.rb @@ -270,8 +270,8 @@ describe Budget::Heading do create(:budget_investment, heading: heading1) - expect(heading1.can_be_deleted?).to eq false - expect(heading2.can_be_deleted?).to eq true + expect(heading1.can_be_deleted?).to be false + expect(heading2.can_be_deleted?).to be true end end diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index c6bf06024..af55804c0 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -66,7 +66,7 @@ describe Budget::Investment do investment = create(:budget_investment, heading: heading_1) - expect(investment.previous_heading_id).to eq nil + expect(investment.previous_heading_id).to be nil investment.update!(heading: heading_2) @@ -156,7 +156,7 @@ describe Budget::Investment do budget = create(:budget, :selecting) investment = create(:budget_investment, budget: budget) - expect(investment.should_show_votes?).to eq(true) + expect(investment.should_show_votes?).to be true end it "returns false in any other phase" do @@ -164,7 +164,7 @@ describe Budget::Investment do budget = create(:budget, phase: phase) investment = create(:budget_investment, budget: budget) - expect(investment.should_show_votes?).to eq(false) + expect(investment.should_show_votes?).to be false end end end @@ -174,7 +174,7 @@ describe Budget::Investment do budget = create(:budget, :valuating) investment = create(:budget_investment, budget: budget) - expect(investment.should_show_vote_count?).to eq(true) + expect(investment.should_show_vote_count?).to be true end it "returns false in any other phase" do @@ -182,7 +182,7 @@ describe Budget::Investment do budget = create(:budget, phase: phase) investment = create(:budget_investment, budget: budget) - expect(investment.should_show_vote_count?).to eq(false) + expect(investment.should_show_vote_count?).to be false end end end @@ -192,14 +192,14 @@ describe Budget::Investment do budget = create(:budget, :balloting) investment = create(:budget_investment, :selected, budget: budget) - expect(investment.should_show_ballots?).to eq(true) + expect(investment.should_show_ballots?).to be true end it "returns false for unselected investments" do budget = create(:budget, :balloting) investment = create(:budget_investment, :unselected, budget: budget) - expect(investment.should_show_ballots?).to eq(false) + expect(investment.should_show_ballots?).to be false end it "returns false in any other phase" do @@ -207,7 +207,7 @@ describe Budget::Investment do budget = create(:budget, phase: phase) investment = create(:budget_investment, :selected, budget: budget) - expect(investment.should_show_ballots?).to eq(false) + expect(investment.should_show_ballots?).to be false end end end @@ -222,7 +222,7 @@ describe Budget::Investment do Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase| budget.update!(phase: phase) - expect(investment.should_show_price?).to eq(true) + expect(investment.should_show_price?).to be true end end @@ -230,26 +230,26 @@ describe Budget::Investment do (Budget::Phase::PHASE_KINDS - Budget::Phase::PUBLISHED_PRICES_PHASES).each do |phase| budget.update!(phase: phase) - expect(investment.should_show_price?).to eq(false) + expect(investment.should_show_price?).to be false end end it "returns false if investment is not selected" do investment.selected = false - expect(investment.should_show_price?).to eq(false) + expect(investment.should_show_price?).to be false end it "returns false if price is not present" do investment.price = nil - expect(investment.should_show_price?).to eq(false) + expect(investment.should_show_price?).to be false end it "returns false if budget hide money is active" do budget.update!(hide_money: true) - expect(investment.should_show_price?).to eq(false) + expect(investment.should_show_price?).to be false end end @@ -263,7 +263,7 @@ describe Budget::Investment do Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase| budget.update!(phase: phase) - expect(investment.should_show_price_explanation?).to eq(true) + expect(investment.should_show_price_explanation?).to be true end end @@ -271,20 +271,20 @@ describe Budget::Investment do (Budget::Phase::PHASE_KINDS - Budget::Phase::PUBLISHED_PRICES_PHASES).each do |phase| budget.update!(phase: phase) - expect(investment.should_show_price_explanation?).to eq(false) + expect(investment.should_show_price_explanation?).to be false end end it "returns false if investment is not selected" do investment.selected = false - expect(investment.should_show_price_explanation?).to eq(false) + expect(investment.should_show_price_explanation?).to be false end it "returns false if price_explanation is not present" do investment.price_explanation = "" - expect(investment.should_show_price_explanation?).to eq(false) + expect(investment.should_show_price_explanation?).to be false end end @@ -298,7 +298,7 @@ describe Budget::Investment do Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase| budget.update!(phase: phase) - expect(investment.should_show_unfeasibility_explanation?).to eq(true) + expect(investment.should_show_unfeasibility_explanation?).to be true end end @@ -307,7 +307,7 @@ describe Budget::Investment do Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase| budget.update!(phase: phase) - expect(investment.should_show_unfeasibility_explanation?).to eq(false) + expect(investment.should_show_unfeasibility_explanation?).to be false end end @@ -316,7 +316,7 @@ describe Budget::Investment do Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase| budget.update!(phase: phase) - expect(investment.should_show_unfeasibility_explanation?).to eq(false) + expect(investment.should_show_unfeasibility_explanation?).to be false end end @@ -325,7 +325,7 @@ describe Budget::Investment do Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase| budget.update!(phase: phase) - expect(investment.should_show_unfeasibility_explanation?).to eq(false) + expect(investment.should_show_unfeasibility_explanation?).to be false end end end @@ -967,7 +967,7 @@ describe Budget::Investment do salamanca_investment = create(:budget_investment, heading: salamanca) - expect(salamanca_investment.valid_heading?(user)).to eq(false) + expect(salamanca_investment.valid_heading?(user)).to be false end it "accepts votes in multiple headings of the same group" do @@ -979,7 +979,7 @@ describe Budget::Investment do salamanca_investment = create(:budget_investment, heading: salamanca) - expect(salamanca_investment.valid_heading?(user)).to eq(true) + expect(salamanca_investment.valid_heading?(user)).to be true end it "accepts votes in any heading previously voted in" do @@ -991,14 +991,14 @@ describe Budget::Investment do carabanchel_investment = create(:budget_investment, heading: carabanchel, voters: [user]) salamanca_investment = create(:budget_investment, heading: salamanca, voters: [user]) - expect(carabanchel_investment.valid_heading?(user)).to eq(true) - expect(salamanca_investment.valid_heading?(user)).to eq(true) + expect(carabanchel_investment.valid_heading?(user)).to be true + expect(salamanca_investment.valid_heading?(user)).to be true end it "allows votes in a group with a single heading" do all_city_investment = create(:budget_investment, heading: heading) - expect(all_city_investment.valid_heading?(user)).to eq(true) + expect(all_city_investment.valid_heading?(user)).to be true end it "allows votes in a group with a single heading after voting in that heading" do @@ -1006,7 +1006,7 @@ describe Budget::Investment do investment_for_same_heading = create(:budget_investment, heading: heading) - expect(investment_for_same_heading.valid_heading?(user)).to eq(true) + expect(investment_for_same_heading.valid_heading?(user)).to be true end it "allows votes in a group with a single heading after voting in another group" do @@ -1017,7 +1017,7 @@ describe Budget::Investment do investment_from_different_group = create(:budget_investment, heading: heading) - expect(investment_from_different_group.valid_heading?(user)).to eq(true) + expect(investment_from_different_group.valid_heading?(user)).to be true end it "allows votes in a group with multiple headings after voting in group with a single heading" do @@ -1028,7 +1028,7 @@ describe Budget::Investment do investment = create(:budget_investment, heading: districts.headings.sample) - expect(investment.valid_heading?(user)).to eq(true) + expect(investment.valid_heading?(user)).to be true end describe "#can_vote_in_another_heading?" do @@ -1046,7 +1046,7 @@ describe Budget::Investment do create(:vote, votable: carabanchel_investment, voter: user) - expect(salamanca_investment.can_vote_in_another_heading?(user)).to eq(true) + expect(salamanca_investment.can_vote_in_another_heading?(user)).to be true end it "returns false if the user has already voted in the maximum number of headings" do @@ -1055,7 +1055,7 @@ describe Budget::Investment do create(:vote, votable: carabanchel_investment, voter: user) create(:vote, votable: salamanca_investment, voter: user) - expect(latina_investment.can_vote_in_another_heading?(user)).to eq(false) + expect(latina_investment.can_vote_in_another_heading?(user)).to be false end end end @@ -1068,11 +1068,11 @@ describe Budget::Investment do it "returns true if the user has voted in this heading" do create(:vote, votable: investment, voter: user) - expect(investment.voted_in?(investment.heading, user)).to eq(true) + expect(investment.voted_in?(investment.heading, user)).to be true end it "returns false if the user has not voted in this heading" do - expect(investment.voted_in?(investment.heading, user)).to eq(false) + expect(investment.voted_in?(investment.heading, user)).to be false end end @@ -1246,14 +1246,14 @@ describe Budget::Investment do investment = create(:budget_investment, heading: heading1) investment.update!(heading: heading2) - expect(investment.saved_change_to_heading?).to eq(true) + expect(investment.saved_change_to_heading?).to be true end it "returns false if heading has not changed" do investment = create(:budget_investment, heading: heading1) investment.update!(heading: heading1) - expect(investment.saved_change_to_heading?).to eq(false) + expect(investment.saved_change_to_heading?).to be false end it "returns false if budget is not balloting phase" do @@ -1263,7 +1263,7 @@ describe Budget::Investment do investment.update!(heading: heading2) - expect(investment.saved_change_to_heading?).to eq(false) + expect(investment.saved_change_to_heading?).to be false end end end @@ -1273,7 +1273,7 @@ describe Budget::Investment do investment = create(:budget_investment, heading: heading1) expect(investment.heading_id).to eq(heading1.id) - expect(investment.previous_heading_id).to eq(nil) + expect(investment.previous_heading_id).to be nil investment.heading = heading2 investment.save! diff --git a/spec/models/budget/phase_spec.rb b/spec/models/budget/phase_spec.rb index 0e13d11ab..cd04b2530 100644 --- a/spec/models/budget/phase_spec.rb +++ b/spec/models/budget/phase_spec.rb @@ -238,13 +238,13 @@ describe Budget::Phase do it "returns the right next enabled phase" do expect(informing_phase.reload.next_enabled_phase).to eq(reviewing_phase) expect(reviewing_phase.reload.next_enabled_phase).to eq(finished_phase) - expect(finished_phase.reload.next_enabled_phase).to eq(nil) + expect(finished_phase.reload.next_enabled_phase).to be nil end end describe "#prev_enabled_phase" do it "returns the right previous enabled phase" do - expect(informing_phase.reload.prev_enabled_phase).to eq(nil) + expect(informing_phase.reload.prev_enabled_phase).to be nil expect(reviewing_phase.reload.prev_enabled_phase).to eq(informing_phase) expect(finished_phase.reload.prev_enabled_phase).to eq(reviewing_phase) end diff --git a/spec/models/budget_spec.rb b/spec/models/budget_spec.rb index e7995224e..9f135e97f 100644 --- a/spec/models/budget_spec.rb +++ b/spec/models/budget_spec.rb @@ -241,7 +241,7 @@ describe Budget do it "returns nil if there is only one budget and it is still in drafting phase" do create(:budget, :drafting) - expect(Budget.current).to eq(nil) + expect(Budget.current).to be nil end it "returns the budget if there is only one and not in drafting phase" do @@ -340,11 +340,11 @@ describe Budget do it "returns true if there is a winner investment" do budget.investments << build(:budget_investment, :winner, price: 3, ballot_lines_count: 2) - expect(budget.has_winning_investments?).to eq true + expect(budget.has_winning_investments?).to be true end it "hould return false if there is not a winner investment" do - expect(budget.has_winning_investments?).to eq false + expect(budget.has_winning_investments?).to be false end end @@ -370,9 +370,9 @@ describe Budget do expect(publishing_prices_phase.next_phase).to eq(balloting_phase) expect(balloting_phase.next_phase).to eq(reviewing_ballots_phase) expect(reviewing_ballots_phase.next_phase).to eq(finished_phase) - expect(finished_phase.next_phase).to eq(nil) + expect(finished_phase.next_phase).to be nil - expect(informing_phase.prev_phase).to eq(nil) + expect(informing_phase.prev_phase).to be nil expect(accepting_phase.prev_phase).to eq(informing_phase) expect(reviewing_phase.prev_phase).to eq(accepting_phase) expect(selecting_phase.prev_phase).to eq(reviewing_phase) diff --git a/spec/models/flag_spec.rb b/spec/models/flag_spec.rb index 4878133dc..c3105fa61 100644 --- a/spec/models/flag_spec.rb +++ b/spec/models/flag_spec.rb @@ -13,7 +13,7 @@ describe Flag do it "does nothing if the flag already exists" do Flag.flag(user, comment) - expect(Flag.flag(user, comment)).to eq(false) + expect(Flag.flag(user, comment)).to be false expect(Flag.by_user_and_flaggable(user, comment).count).to eq(1) end @@ -24,7 +24,7 @@ describe Flag do describe ".unflag" do it "raises an error if the flag does not exist" do - expect(Flag.unflag(user, comment)).to eq(false) + expect(Flag.unflag(user, comment)).to be false end describe "when the flag already exists" do diff --git a/spec/models/i18n_content_spec.rb b/spec/models/i18n_content_spec.rb index 5d2c085c1..7021a75ce 100644 --- a/spec/models/i18n_content_spec.rb +++ b/spec/models/i18n_content_spec.rb @@ -32,8 +32,8 @@ RSpec.describe I18nContent, type: :model do it "returns nil if translations are not available" do expect(i18n_content.value_en).to eq("Text in english") expect(i18n_content.value_es).to eq("Texto en espaƱol") - expect(i18n_content.value_nl).to be(nil) - expect(i18n_content.value_fr).to be(nil) + expect(i18n_content.value_nl).to be nil + expect(i18n_content.value_fr).to be nil end it "responds accordingly to the current locale" do diff --git a/spec/models/map_location_spec.rb b/spec/models/map_location_spec.rb index 7b4711448..0f4922056 100644 --- a/spec/models/map_location_spec.rb +++ b/spec/models/map_location_spec.rb @@ -27,25 +27,25 @@ describe MapLocation do describe "#available?" do it "returns true when latitude, longitude and zoom defined" do - expect(map_location.available?).to be(true) + expect(map_location.available?).to be true end it "returns false when longitude is nil" do map_location.longitude = nil - expect(map_location.available?).to be(false) + expect(map_location.available?).to be false end it "returns false when latitude is nil" do map_location.latitude = nil - expect(map_location.available?).to be(false) + expect(map_location.available?).to be false end it "returns false when zoom is nil" do map_location.zoom = nil - expect(map_location.available?).to be(false) + expect(map_location.available?).to be false end end end diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index fc60dfd91..27cb7b8eb 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -103,7 +103,7 @@ describe Notification do create(:notification, user: user, notifiable: comment1) - expect(Notification.existent(user, comment2)).to eq(nil) + expect(Notification.existent(user, comment2)).to be nil end it "returns nil when there are notifications of a notifiable for another user" do @@ -113,7 +113,7 @@ describe Notification do create(:notification, user: user1, notifiable: comment) - expect(Notification.existent(user2, comment)).to eq(nil) + expect(Notification.existent(user2, comment)).to be nil end end diff --git a/spec/models/poll/answer_spec.rb b/spec/models/poll/answer_spec.rb index 691a09943..ac5acb402 100644 --- a/spec/models/poll/answer_spec.rb +++ b/spec/models/poll/answer_spec.rb @@ -76,7 +76,7 @@ describe Poll::Answer do expect(voter.document_number).to eq(answer.author.document_number) expect(voter.poll_id).to eq(answer.poll.id) - expect(voter.officer_id).to eq(nil) + expect(voter.officer_id).to be nil end it "updates a poll_voter with user and poll data" do diff --git a/spec/models/poll/ballot_spec.rb b/spec/models/poll/ballot_spec.rb index 81f8cc9f0..981b7ba20 100644 --- a/spec/models/poll/ballot_spec.rb +++ b/spec/models/poll/ballot_spec.rb @@ -53,43 +53,43 @@ describe Poll::Ballot do describe "Money" do it "is not valid if insufficient funds" do investment.update!(price: heading.price + 1) - expect(poll_ballot.add_investment(investment.id)).to be(false) + expect(poll_ballot.add_investment(investment.id)).to be false end it "is valid if sufficient funds" do investment.update!(price: heading.price - 1) - expect(poll_ballot.add_investment(investment.id)).to be(true) + expect(poll_ballot.add_investment(investment.id)).to be true end end describe "Heading" do it "is not valid if investment heading is not valid" do - expect(poll_ballot.add_investment(investment.id)).to be(true) + expect(poll_ballot.add_investment(investment.id)).to be true other_heading = create(:budget_heading, group: group, price: 10000000) other_investment = create(:budget_investment, :selected, price: 1000000, heading: other_heading) - expect(poll_ballot.add_investment(other_investment.id)).to be(false) + expect(poll_ballot.add_investment(other_investment.id)).to be false end it "is valid if investment heading is valid" do - expect(poll_ballot.add_investment(investment.id)).to be(true) + expect(poll_ballot.add_investment(investment.id)).to be true other_investment = create(:budget_investment, :selected, price: 1000000, heading: heading) - expect(poll_ballot.add_investment(other_investment.id)).to be(true) + expect(poll_ballot.add_investment(other_investment.id)).to be true end end describe "Selectibility" do it "is not valid if investment is unselected" do investment.update!(selected: false) - expect(poll_ballot.add_investment(investment.id)).to be(false) + expect(poll_ballot.add_investment(investment.id)).to be false end it "is valid if investment is selected" do investment.update!(selected: true, price: 20000) - expect(poll_ballot.add_investment(investment.id)).to be(true) + expect(poll_ballot.add_investment(investment.id)).to be true end end @@ -97,22 +97,22 @@ describe Poll::Ballot do it "is not valid if investment belongs to a different budget" do other_budget = create(:budget) investment.update!(budget: other_budget) - expect(poll_ballot.add_investment(investment.id)).to be(nil) + expect(poll_ballot.add_investment(investment.id)).to be nil end it "is valid if investment belongs to the poll's budget" do - expect(poll_ballot.add_investment(investment.id)).to be(true) + expect(poll_ballot.add_investment(investment.id)).to be true end end describe "Already added" do it "is not valid if already exists" do poll_ballot.add_investment(investment.id) - expect(poll_ballot.add_investment(investment.id)).to be(nil) + expect(poll_ballot.add_investment(investment.id)).to be nil end it "is valid if does not already exist" do - expect(poll_ballot.add_investment(investment.id)).to be(true) + expect(poll_ballot.add_investment(investment.id)).to be true end end end diff --git a/spec/models/poll/booth_assignment_spec.rb b/spec/models/poll/booth_assignment_spec.rb index 2dafa0c1d..e42e637ad 100644 --- a/spec/models/poll/booth_assignment_spec.rb +++ b/spec/models/poll/booth_assignment_spec.rb @@ -12,8 +12,8 @@ describe Poll::BoothAssignment do create(:poll_officer_assignment, officer: officer, booth_assignment: assignment_with_shifts) create(:poll_shift, booth: booth, officer: officer) - expect(assignment_with_shifts.shifts?).to eq(true) - expect(assignment_without_shifts.shifts?).to eq(false) + expect(assignment_with_shifts.shifts?).to be true + expect(assignment_without_shifts.shifts?).to be false end it "deletes shifts associated to booth assignments" do diff --git a/spec/models/poll/poll_spec.rb b/spec/models/poll/poll_spec.rb index 2eaac6859..ac43f2c1e 100644 --- a/spec/models/poll/poll_spec.rb +++ b/spec/models/poll/poll_spec.rb @@ -290,7 +290,7 @@ describe Poll do create(:poll_voter, user: user, poll: poll) - expect(poll.votable_by?(user)).to eq(false) + expect(poll.votable_by?(user)).to be false end it "returns false if the poll is not answerable by the user" do @@ -299,7 +299,7 @@ describe Poll do allow_any_instance_of(Poll).to receive(:answerable_by?).and_return(false) - expect(poll.votable_by?(user)).to eq(false) + expect(poll.votable_by?(user)).to be false end it "return true if a poll is answerable and has not been voted by the user" do @@ -308,7 +308,7 @@ describe Poll do allow_any_instance_of(Poll).to receive(:answerable_by?).and_return(true) - expect(poll.votable_by?(user)).to eq(true) + expect(poll.votable_by?(user)).to be true end end @@ -317,7 +317,7 @@ describe Poll do user = create(:user, :level_two) poll = create(:poll) - expect(poll.voted_by?(user)).to eq(false) + expect(poll.voted_by?(user)).to be false end it "returns true if the user has voted for this poll" do @@ -326,7 +326,7 @@ describe Poll do create(:poll_voter, user: user, poll: poll) - expect(poll.voted_by?(user)).to eq(true) + expect(poll.voted_by?(user)).to be true end end diff --git a/spec/models/proposal_notification_spec.rb b/spec/models/proposal_notification_spec.rb index ae91fd3dd..2279ab542 100644 --- a/spec/models/proposal_notification_spec.rb +++ b/spec/models/proposal_notification_spec.rb @@ -116,7 +116,7 @@ describe ProposalNotification do it "returns true when the proposal is available" do notification = create(:notification, notifiable: notifiable) - expect(notification.notifiable_available?).to be(true) + expect(notification.notifiable_available?).to be true end it "returns false when the proposal is not available" do @@ -124,7 +124,7 @@ describe ProposalNotification do notifiable.proposal.destroy! - expect(notification.notifiable_available?).to be(false) + expect(notification.notifiable_available?).to be false end end @@ -132,21 +132,21 @@ describe ProposalNotification do it "returns true if the resource is present, not hidden, nor retired" do notification = create(:notification, notifiable: notifiable) - expect(notification.check_availability(proposal)).to be(true) + expect(notification.check_availability(proposal)).to be true end it "returns false if the resource is not present" do notification = create(:notification, notifiable: notifiable) notifiable.proposal.really_destroy! - expect(notification.check_availability(proposal)).to be(false) + expect(notification.check_availability(proposal)).to be false end it "returns false if the resource is hidden" do notification = create(:notification, notifiable: notifiable) notifiable.proposal.hide - expect(notification.check_availability(proposal)).to be(false) + expect(notification.check_availability(proposal)).to be false end it "returns false if the resource is retired" do @@ -155,7 +155,7 @@ describe ProposalNotification do notifiable.proposal.update!(retired_at: Time.current, retired_explanation: "Unfeasible reason explanation", retired_reason: "unfeasible") - expect(notification.check_availability(proposal)).to be(false) + expect(notification.check_availability(proposal)).to be false end end diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 90e5dc19b..d30329213 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -272,7 +272,7 @@ describe Proposal do tag_list = ["tag1", "tag2", "tag3", "tag4", "tag5", "tag6", "tag7"] proposal.update!(tag_list: tag_list) - expect(proposal.update_cached_votes).to eq(true) + expect(proposal.update_cached_votes).to be true end end end @@ -846,8 +846,8 @@ describe Proposal do let!(:proposal2) { create(:proposal, :retired) } it "retired? is true" do - expect(proposal1.retired?).to eq false - expect(proposal2.retired?).to eq true + expect(proposal1.retired?).to be false + expect(proposal2.retired?).to be true end it "scope retired" do @@ -864,8 +864,8 @@ describe Proposal do let!(:archived_proposal) { create(:proposal, :archived) } it "archived? is true only for proposals created more than n (configured months) ago" do - expect(new_proposal.archived?).to eq false - expect(archived_proposal.archived?).to eq true + expect(new_proposal.archived?).to be false + expect(archived_proposal.archived?).to be true end it "scope archived" do diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index fafd06481..e60642501 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -10,7 +10,7 @@ describe Setting do end it "returns nil" do - expect(Setting["undefined_key"]).to eq(nil) + expect(Setting["undefined_key"]).to be nil end it "persists a setting on the db" do @@ -83,21 +83,21 @@ describe Setting do describe "#enabled?" do it "is true if value is present" do setting = Setting.create!(key: "feature.whatever", value: 1) - expect(setting.enabled?).to eq true + expect(setting.enabled?).to be true setting.value = "true" - expect(setting.enabled?).to eq true + expect(setting.enabled?).to be true setting.value = "whatever" - expect(setting.enabled?).to eq true + expect(setting.enabled?).to be true end it "is false if value is blank" do setting = Setting.create!(key: "feature.whatever") - expect(setting.enabled?).to eq false + expect(setting.enabled?).to be false setting.value = "" - expect(setting.enabled?).to eq false + expect(setting.enabled?).to be false end end @@ -282,21 +282,21 @@ describe Setting do it "return false when feature remote_census is not active" do Setting["feature.remote_census"] = false - expect(Setting.force_presence_date_of_birth?).to eq false + expect(Setting.force_presence_date_of_birth?).to be false end it "return false when feature remote_census is active and date_of_birth is nil" do Setting["feature.remote_census"] = true Setting["remote_census.request.date_of_birth"] = nil - expect(Setting.force_presence_date_of_birth?).to eq false + expect(Setting.force_presence_date_of_birth?).to be false end it "return true when feature remote_census is active and date_of_birth is empty" do Setting["feature.remote_census"] = true Setting["remote_census.request.date_of_birth"] = "some.value" - expect(Setting.force_presence_date_of_birth?).to eq true + expect(Setting.force_presence_date_of_birth?).to be true end end @@ -304,21 +304,21 @@ describe Setting do it "return false when feature remote_census is not active" do Setting["feature.remote_census"] = false - expect(Setting.force_presence_postal_code?).to eq false + expect(Setting.force_presence_postal_code?).to be false end it "return false when feature remote_census is active and postal_code is nil" do Setting["feature.remote_census"] = true Setting["remote_census.request.postal_code"] = nil - expect(Setting.force_presence_postal_code?).to eq false + expect(Setting.force_presence_postal_code?).to be false end it "return true when feature remote_census is active and postal_code is empty" do Setting["feature.remote_census"] = true Setting["remote_census.request.postal_code"] = "some.value" - expect(Setting.force_presence_postal_code?).to eq true + expect(Setting.force_presence_postal_code?).to be true end end end diff --git a/spec/models/signature_sheet_spec.rb b/spec/models/signature_sheet_spec.rb index 39caa34a0..422c78bb7 100644 --- a/spec/models/signature_sheet_spec.rb +++ b/spec/models/signature_sheet_spec.rb @@ -108,18 +108,18 @@ describe SignatureSheet do expect(Signature.count).to eq(2) expect(Signature.first.document_number).to eq("123A") - expect(Signature.first.date_of_birth).to eq(nil) - expect(Signature.first.postal_code).to eq(nil) + expect(Signature.first.date_of_birth).to be nil + expect(Signature.first.postal_code).to be nil expect(Signature.last.document_number).to eq("456B") - expect(Signature.last.date_of_birth).to eq(nil) - expect(Signature.last.postal_code).to eq(nil) + expect(Signature.last.date_of_birth).to be nil + expect(Signature.last.postal_code).to be nil end it "marks signature sheet as processed" do signature_sheet = create(:signature_sheet) signature_sheet.verify_signatures - expect(signature_sheet.processed).to eq(true) + expect(signature_sheet.processed).to be true end context "with remote census active", :remote_census do @@ -135,11 +135,11 @@ describe SignatureSheet do expect(Signature.count).to eq(2) expect(Signature.first.document_number).to eq("123A") - expect(Signature.first.date_of_birth).to eq(nil) - expect(Signature.first.postal_code).to eq(nil) + expect(Signature.first.date_of_birth).to be nil + expect(Signature.first.postal_code).to be nil expect(Signature.last.document_number).to eq("456B") - expect(Signature.last.date_of_birth).to eq(nil) - expect(Signature.last.postal_code).to eq(nil) + expect(Signature.last.date_of_birth).to be nil + expect(Signature.last.postal_code).to be nil end it "creates signatures for each group with document_number and date_of_birth" do @@ -154,10 +154,10 @@ describe SignatureSheet do expect(Signature.count).to eq(2) expect(Signature.first.document_number).to eq("123A") expect(Signature.first.date_of_birth).to eq(Date.parse("01/01/1980")) - expect(Signature.first.postal_code).to eq(nil) + expect(Signature.first.postal_code).to be nil expect(Signature.last.document_number).to eq("456B") expect(Signature.last.date_of_birth).to eq(Date.parse("01/02/1980")) - expect(Signature.last.postal_code).to eq(nil) + expect(Signature.last.postal_code).to be nil end it "creates signatures for each group with document_number and postal_code" do @@ -171,10 +171,10 @@ describe SignatureSheet do expect(Signature.count).to eq(2) expect(Signature.first.document_number).to eq("123A") - expect(Signature.first.date_of_birth).to eq(nil) + expect(Signature.first.date_of_birth).to be nil expect(Signature.first.postal_code).to eq("28001") expect(Signature.last.document_number).to eq("456B") - expect(Signature.last.date_of_birth).to eq(nil) + expect(Signature.last.date_of_birth).to be nil expect(Signature.last.postal_code).to eq("28002") end diff --git a/spec/models/signature_spec.rb b/spec/models/signature_spec.rb index ac237ca76..57ff5ba78 100644 --- a/spec/models/signature_spec.rb +++ b/spec/models/signature_spec.rb @@ -184,7 +184,7 @@ describe Signature do user = User.last expect(user.document_number).to eq("12345678Z") - expect(user.created_from_signature).to eq(true) + expect(user.created_from_signature).to be true expect(user.verified_at).to be expect(user.erased_at).to be expect(user.geozone).to be diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index a46e104e0..d9ce655ad 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -84,37 +84,37 @@ describe User do describe "preferences" do describe "email_on_comment" do it "is false by default" do - expect(subject.email_on_comment).to eq(false) + expect(subject.email_on_comment).to be false end end describe "email_on_comment_reply" do it "is false by default" do - expect(subject.email_on_comment_reply).to eq(false) + expect(subject.email_on_comment_reply).to be false end end describe "subscription_to_website_newsletter" do it "is true by default" do - expect(subject.newsletter).to eq(true) + expect(subject.newsletter).to be true end end describe "email_digest" do it "is true by default" do - expect(subject.email_digest).to eq(true) + expect(subject.email_digest).to be true end end describe "email_on_direct_message" do it "is true by default" do - expect(subject.email_on_direct_message).to eq(true) + expect(subject.email_on_direct_message).to be true end end describe "official_position_badge" do it "is false by default" do - expect(subject.official_position_badge).to eq(false) + expect(subject.official_position_badge).to be false end end end @@ -319,10 +319,10 @@ describe User do user3 = create(:user, email: "john@unofficials.madrid.es", confirmed_at: Time.current) user4 = create(:user, email: "john@example.org", confirmed_at: Time.current) - expect(user1.has_official_email?).to eq(true) - expect(user2.has_official_email?).to eq(true) - expect(user3.has_official_email?).to eq(false) - expect(user4.has_official_email?).to eq(false) + expect(user1.has_official_email?).to be true + expect(user2.has_official_email?).to be true + expect(user3.has_official_email?).to be false + expect(user4.has_official_email?).to be false # We reset the officials' domain setting Setting.find_by(key: "email_domain_for_officials").update!(value: "") @@ -334,13 +334,13 @@ describe User do it "displays the badge if set in preferences" do user = create(:user, official_level: 1, official_position_badge: true) - expect(user.display_official_position_badge?).to eq true + expect(user.display_official_position_badge?).to be true end it "does not display the badge if set in preferences" do user = create(:user, official_level: 1, official_position_badge: false) - expect(user.display_official_position_badge?).to eq false + expect(user.display_official_position_badge?).to be false end end @@ -351,10 +351,10 @@ describe User do user3 = create(:user, official_level: 4, official_position_badge: false) user4 = create(:user, official_level: 5, official_position_badge: false) - expect(user1.display_official_position_badge?).to eq true - expect(user2.display_official_position_badge?).to eq true - expect(user3.display_official_position_badge?).to eq true - expect(user4.display_official_position_badge?).to eq true + expect(user1.display_official_position_badge?).to be true + expect(user2.display_official_position_badge?).to be true + expect(user3.display_official_position_badge?).to be true + expect(user4.display_official_position_badge?).to be true end end end @@ -684,8 +684,8 @@ describe User do describe "email_required?" do it "is true for regular users" do - expect(subject.email_required?).to eq(true) - expect(create(:user, :hidden).email_required?).to eq(true) + expect(subject.email_required?).to be true + expect(create(:user, :hidden).email_required?).to be true end it "is false for erased users" do @@ -693,14 +693,14 @@ describe User do user.erase user.reload - expect(user.email_required?).to eq(false) + expect(user.email_required?).to be false end it "is false for verified users with no email" do user = create(:user, username: "Lois", email: "", verified_at: Time.current) expect(user).to be_valid - expect(user.email_required?).to eq(false) + expect(user.email_required?).to be false end end diff --git a/spec/models/verification/letter_spec.rb b/spec/models/verification/letter_spec.rb index 110dcc401..6bfdbd652 100644 --- a/spec/models/verification/letter_spec.rb +++ b/spec/models/verification/letter_spec.rb @@ -31,7 +31,7 @@ describe Verification::Letter do letter.user.update!(letter_verification_code: "123456") letter.verification_code = "5555" - expect(letter.valid?).to eq(false) + expect(letter.valid?).to be false expect(letter.errors[:verification_code].first).to eq("Verification code incorrect") end @@ -39,7 +39,7 @@ describe Verification::Letter do letter.user.update!(letter_verification_code: "123456") letter.verification_code = "123456" - expect(letter.valid?).to eq(true) + expect(letter.valid?).to be true expect(letter.errors).to be_empty end @@ -47,7 +47,7 @@ describe Verification::Letter do letter.user.update!(letter_verification_code: "003456") letter.verification_code = "3456" - expect(letter.valid?).to eq(true) + expect(letter.valid?).to be true expect(letter.errors).to be_empty end end diff --git a/spec/models/verification/management/email_spec.rb b/spec/models/verification/management/email_spec.rb index 4921a5021..0a97daa4f 100644 --- a/spec/models/verification/management/email_spec.rb +++ b/spec/models/verification/management/email_spec.rb @@ -44,7 +44,7 @@ describe Verification::Management::Email do document_number: "1234", email: "inexisting@gmail.com") - expect(email.save).to eq(false) + expect(email.save).to be false end it "updates the user and sends an email" do diff --git a/spec/models/vote_spec.rb b/spec/models/vote_spec.rb index f6bcee901..18d9d6fde 100644 --- a/spec/models/vote_spec.rb +++ b/spec/models/vote_spec.rb @@ -14,10 +14,10 @@ describe Vote do describe "#value" do it "returns vote flag" do vote = create(:vote, vote_flag: true) - expect(vote.value).to eq(true) + expect(vote.value).to be true vote = create(:vote, vote_flag: false) - expect(vote.value).to eq(false) + expect(vote.value).to be false end end diff --git a/spec/shared/models/notifiable.rb b/spec/shared/models/notifiable.rb index a227fa6e4..ac40462a0 100644 --- a/spec/shared/models/notifiable.rb +++ b/spec/shared/models/notifiable.rb @@ -20,14 +20,14 @@ shared_examples "notifiable" do it "returns true when it's a root comment and the notifiable is available" do notification = create(:notification, notifiable: notifiable) - expect(notification.notifiable_available?).to be(true) + expect(notification.notifiable_available?).to be true end it "returns true when it's a reply to comment and the notifiable is available" do comment = create(:comment, commentable: notifiable) notification = create(:notification, notifiable: comment) - expect(notification.notifiable_available?).to be(true) + expect(notification.notifiable_available?).to be true end it "returns false when it's a root comment and the notifiable has been hidden" do @@ -36,7 +36,7 @@ shared_examples "notifiable" do notifiable.hide notification.reload - expect(notification.notifiable_available?).not_to be(true) + expect(notification.notifiable_available?).not_to be true end it "returns false when it's a reply to comment and the commentable has been hidden" do @@ -46,26 +46,26 @@ shared_examples "notifiable" do notifiable.hide notification.reload - expect(notification.notifiable_available?).to be(false) + expect(notification.notifiable_available?).to be false end end describe "check_availability" do it "returns true if the resource is present, not hidden, nor retired" do notification = create(:notification, notifiable: notifiable) - expect(notification.check_availability(notifiable)).to be(true) + expect(notification.check_availability(notifiable)).to be true end it "returns false if the resource is not present" do notification = create(:notification, notifiable: notifiable) notifiable.really_destroy! - expect(notification.check_availability(notifiable)).to be(false) + expect(notification.check_availability(notifiable)).to be false end it "returns false if the resource is not hidden" do notification = create(:notification, notifiable: notifiable) notifiable.hide - expect(notification.check_availability(notifiable)).to be(false) + expect(notification.check_availability(notifiable)).to be false end it "returns false if the resource is retired" do @@ -74,7 +74,7 @@ shared_examples "notifiable" do if notifiable.respond_to?(:retired_at) notifiable.update!(retired_at: Time.current, retired_reason: "unfeasible", retired_explanation: "Unfeasibility explanation ...") - expect(notification.check_availability(notifiable)).to be(false) + expect(notification.check_availability(notifiable)).to be false end end end diff --git a/spec/support/verifiable.rb b/spec/support/verifiable.rb index cf34c14fe..c41bd2e10 100644 --- a/spec/support/verifiable.rb +++ b/spec/support/verifiable.rb @@ -77,99 +77,99 @@ shared_examples_for "verifiable" do describe "#methods" do it "residence_verified? is true only if residence_verified_at" do user = create(:user, residence_verified_at: Time.current) - expect(user.residence_verified?).to eq(true) + expect(user.residence_verified?).to be true user = create(:user, residence_verified_at: nil) - expect(user.residence_verified?).to eq(false) + expect(user.residence_verified?).to be false end end describe "#sms_verified?" do it "is true only if confirmed_phone" do user = create(:user, confirmed_phone: "123456789") - expect(user.sms_verified?).to eq(true) + expect(user.sms_verified?).to be true user = create(:user, confirmed_phone: nil) - expect(user.sms_verified?).to eq(false) + expect(user.sms_verified?).to be false end end describe "#level_two_verified?" do it "is true if manually set, or if residence_verified_at and confirmed_phone" do user = create(:user, level_two_verified_at: Time.current) - expect(user.level_two_verified?).to eq(true) + expect(user.level_two_verified?).to be true user = create(:user, confirmed_phone: "123456789", residence_verified_at: Time.current) - expect(user.level_two_verified?).to eq(true) + expect(user.level_two_verified?).to be true user = create(:user, confirmed_phone: nil, residence_verified_at: Time.current) - expect(user.level_two_verified?).to eq(false) + expect(user.level_two_verified?).to be false user = create(:user, confirmed_phone: "123456789", residence_verified_at: nil) - expect(user.level_two_verified?).to eq(false) + expect(user.level_two_verified?).to be false end end describe "#level_three_verified?" do it "is true only if verified_at" do user = create(:user, verified_at: Time.current) - expect(user.level_three_verified?).to eq(true) + expect(user.level_three_verified?).to be true user = create(:user, verified_at: nil) - expect(user.level_three_verified?).to eq(false) + expect(user.level_three_verified?).to be false end end describe "#unverified?" do it "is true only if not level_three_verified and not level_two_verified" do user = create(:user, verified_at: nil, confirmed_phone: nil) - expect(user.unverified?).to eq(true) + expect(user.unverified?).to be true user = create(:user, verified_at: Time.current, confirmed_phone: "123456789", residence_verified_at: Time.current) - expect(user.unverified?).to eq(false) + expect(user.unverified?).to be false end end describe "#verification_email_sent?" do it "is true only if user has email_verification_token" do user = create(:user, email_verification_token: "xxxxxxx") - expect(user.verification_email_sent?).to eq(true) + expect(user.verification_email_sent?).to be true user = create(:user, email_verification_token: nil) - expect(user.verification_email_sent?).to eq(false) + expect(user.verification_email_sent?).to be false end end describe "#verification_sms_sent?" do it "is true if user has unconfirmed_phone & sms_confirmation_code" do user = create(:user, unconfirmed_phone: "666666666", sms_confirmation_code: "666") - expect(user.verification_sms_sent?).to eq(true) + expect(user.verification_sms_sent?).to be true user = create(:user, unconfirmed_phone: nil, sms_confirmation_code: "666") - expect(user.verification_sms_sent?).to eq(false) + expect(user.verification_sms_sent?).to be false user = create(:user, unconfirmed_phone: "666666666", sms_confirmation_code: nil) - expect(user.verification_sms_sent?).to eq(false) + expect(user.verification_sms_sent?).to be false user = create(:user, unconfirmed_phone: nil, sms_confirmation_code: nil) - expect(user.verification_sms_sent?).to eq(false) + expect(user.verification_sms_sent?).to be false end end describe "#verification_letter_sent?" do it "is true if user has letter_requested_at & letter_verification_code" do user = create(:user, letter_requested_at: Time.current, letter_verification_code: "666") - expect(user.verification_letter_sent?).to eq(true) + expect(user.verification_letter_sent?).to be true user = create(:user, letter_requested_at: nil, letter_verification_code: "666") - expect(user.verification_letter_sent?).to eq(false) + expect(user.verification_letter_sent?).to be false user = create(:user, letter_requested_at: Time.current, letter_verification_code: nil) - expect(user.verification_letter_sent?).to eq(false) + expect(user.verification_letter_sent?).to be false user = create(:user, letter_requested_at: nil, letter_verification_code: nil) - expect(user.verification_letter_sent?).to eq(false) + expect(user.verification_letter_sent?).to be false end end @@ -182,63 +182,63 @@ shared_examples_for "verifiable" do describe "#residence_verified?" do it "is true if skipped" do - expect(user.residence_verified?).to eq(true) + expect(user.residence_verified?).to be true end end describe "#sms_verified?" do it "is true if skipped" do - expect(user.sms_verified?).to eq(true) + expect(user.sms_verified?).to be true end end describe "#level_two_verified?" do it "is true if skipped" do - expect(user.level_two_verified?).to eq(true) + expect(user.level_two_verified?).to be true user.update!(residence_verified_at: Time.current) - expect(user.level_two_verified?).to eq(true) + expect(user.level_two_verified?).to be true user.update!(confirmed_phone: "123456789", residence_verified_at: false) - expect(user.level_two_verified?).to eq(true) + expect(user.level_two_verified?).to be true end end describe "#level_three_verified?" do it "is true if skipped" do - expect(user.level_three_verified?).to eq(true) + expect(user.level_three_verified?).to be true end end describe "#verification_email_sent?" do it "is true if skipped" do - expect(user.verification_email_sent?).to eq(true) + expect(user.verification_email_sent?).to be true end end describe "#verification_sms_sent?" do it "is true if skipped" do user.update!(unconfirmed_phone: nil, sms_confirmation_code: "666") - expect(user.verification_sms_sent?).to eq(true) + expect(user.verification_sms_sent?).to be true user.update!(unconfirmed_phone: "666666666", sms_confirmation_code: nil) - expect(user.verification_sms_sent?).to eq(true) + expect(user.verification_sms_sent?).to be true user.update!(unconfirmed_phone: nil, sms_confirmation_code: nil) - expect(user.verification_sms_sent?).to eq(true) + expect(user.verification_sms_sent?).to be true end end describe "#verification_letter_sent?" do it "is true if skipped" do user.update!(letter_requested_at: nil, letter_verification_code: "666") - expect(user.verification_letter_sent?).to eq(true) + expect(user.verification_letter_sent?).to be true user.update!(letter_requested_at: Time.current, letter_verification_code: nil) - expect(user.verification_letter_sent?).to eq(true) + expect(user.verification_letter_sent?).to be true user.update!(letter_requested_at: nil, letter_verification_code: nil) - expect(user.verification_letter_sent?).to eq(true) + expect(user.verification_letter_sent?).to be true end end end diff --git a/spec/system/admin/budget_phases_spec.rb b/spec/system/admin/budget_phases_spec.rb index efc2638e1..42faabae8 100644 --- a/spec/system/admin/budget_phases_spec.rb +++ b/spec/system/admin/budget_phases_spec.rb @@ -24,7 +24,7 @@ describe "Admin budget phases" do expect(budget.current_phase.starts_at.to_date).to eq((Date.current + 1.day).to_date) expect(budget.current_phase.ends_at.to_date).to eq((Date.current + 12.days).to_date) expect(budget.current_phase.description).to include("New description of the phase.") - expect(budget.current_phase.enabled).to be(false) + expect(budget.current_phase.enabled).to be false end scenario "Show default phase name or custom if present" do