Apply explict RSpec/DescribedClass rubocop rule
We settled on using this style in commit 4cbe81a1, but didn't add the
rule enforcing this style and we didn't apply it to existing code.
This commit is contained in:
@@ -3,56 +3,56 @@ require "rails_helper"
|
||||
describe Age do
|
||||
describe ".in_years" do
|
||||
it "handles nils" do
|
||||
expect(described_class.in_years(nil)).to be_nil
|
||||
expect(Age.in_years(nil)).to be_nil
|
||||
end
|
||||
|
||||
it "calculates age correctly for common dates" do
|
||||
d = Date.new(1980, 3, 13)
|
||||
expect(described_class.in_years(d, Date.new(2000, 3, 12))).to eq(19)
|
||||
expect(described_class.in_years(d, Date.new(2000, 3, 13))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2000, 3, 14))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2000, 3, 12))).to eq(19)
|
||||
expect(Age.in_years(d, Date.new(2000, 3, 13))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2000, 3, 14))).to eq(20)
|
||||
end
|
||||
|
||||
it "calculates age correctly for people born near a year's limit" do
|
||||
d = Date.new(1980, 12, 31)
|
||||
expect(described_class.in_years(d, Date.new(2000, 12, 30))).to eq(19)
|
||||
expect(described_class.in_years(d, Date.new(2000, 12, 31))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 1, 1))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2000, 12, 30))).to eq(19)
|
||||
expect(Age.in_years(d, Date.new(2000, 12, 31))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 1, 1))).to eq(20)
|
||||
|
||||
d = Date.new(1980, 1, 1)
|
||||
expect(described_class.in_years(d, Date.new(2000, 12, 31))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 1, 1))).to eq(21)
|
||||
expect(described_class.in_years(d, Date.new(2001, 1, 2))).to eq(21)
|
||||
expect(Age.in_years(d, Date.new(2000, 12, 31))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 1, 1))).to eq(21)
|
||||
expect(Age.in_years(d, Date.new(2001, 1, 2))).to eq(21)
|
||||
end
|
||||
|
||||
it "calculates age correctly for people born around February the 29th" do
|
||||
# 1980 and 2000 are leap years. 2001 is a regular year
|
||||
d = Date.new(1980, 2, 29)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 27))).to eq(19)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 28))).to eq(19)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 29))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2000, 3, 1))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 2, 27))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 2, 28))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 3, 1))).to eq(21)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 27))).to eq(19)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 28))).to eq(19)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 29))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2000, 3, 1))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 2, 27))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 2, 28))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 3, 1))).to eq(21)
|
||||
|
||||
d = Date.new(1980, 2, 28)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 27))).to eq(19)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 28))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 29))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2000, 3, 1))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 2, 27))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 2, 28))).to eq(21)
|
||||
expect(described_class.in_years(d, Date.new(2001, 3, 1))).to eq(21)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 27))).to eq(19)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 28))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 29))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2000, 3, 1))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 2, 27))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 2, 28))).to eq(21)
|
||||
expect(Age.in_years(d, Date.new(2001, 3, 1))).to eq(21)
|
||||
|
||||
d = Date.new(1980, 3, 1)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 27))).to eq(19)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 28))).to eq(19)
|
||||
expect(described_class.in_years(d, Date.new(2000, 2, 29))).to eq(19)
|
||||
expect(described_class.in_years(d, Date.new(2000, 3, 1))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 2, 27))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 2, 28))).to eq(20)
|
||||
expect(described_class.in_years(d, Date.new(2001, 3, 1))).to eq(21)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 27))).to eq(19)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 28))).to eq(19)
|
||||
expect(Age.in_years(d, Date.new(2000, 2, 29))).to eq(19)
|
||||
expect(Age.in_years(d, Date.new(2000, 3, 1))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 2, 27))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 2, 28))).to eq(20)
|
||||
expect(Age.in_years(d, Date.new(2001, 3, 1))).to eq(21)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe CensusApi do
|
||||
let(:api) { described_class.new }
|
||||
let(:api) { CensusApi.new }
|
||||
|
||||
describe "#call" do
|
||||
let(:invalid_body) { { get_habita_datos_response: { get_habita_datos_return: { datos_habitante: {}}}} }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe CensusCaller do
|
||||
let(:api) { described_class.new }
|
||||
let(:api) { CensusCaller.new }
|
||||
|
||||
describe "#call" do
|
||||
it "returns data from local_census_records if census API is not available" do
|
||||
|
||||
@@ -12,7 +12,7 @@ describe EmailDigest do
|
||||
notification1 = create(:notification, notifiable: proposal_notification, user: user1)
|
||||
notification2 = create(:notification, notifiable: proposal_notification, user: user2)
|
||||
|
||||
email_digest = described_class.new(user1)
|
||||
email_digest = EmailDigest.new(user1)
|
||||
|
||||
expect(email_digest.notifications).to include(notification1)
|
||||
expect(email_digest.notifications).not_to include(notification2)
|
||||
@@ -27,7 +27,7 @@ describe EmailDigest do
|
||||
notification1 = create(:notification, notifiable: proposal_notification, user: user)
|
||||
notification2 = create(:notification, notifiable: comment, user: user)
|
||||
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
|
||||
expect(email_digest.notifications).to include(notification1)
|
||||
expect(email_digest.notifications).not_to include(notification2)
|
||||
@@ -43,7 +43,7 @@ describe EmailDigest do
|
||||
proposal_notification = create(:proposal_notification)
|
||||
notification = create(:notification, notifiable: proposal_notification, user: user)
|
||||
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
expect(email_digest.pending_notifications?).to be
|
||||
end
|
||||
|
||||
@@ -53,13 +53,13 @@ describe EmailDigest do
|
||||
proposal_notification = create(:proposal_notification)
|
||||
notification = create(:notification, notifiable: proposal_notification, user: user, emailed_at: Time.current)
|
||||
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
expect(email_digest.pending_notifications?).not_to be
|
||||
end
|
||||
|
||||
it "returns false when there are no notifications for a user" do
|
||||
user = create(:user)
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
expect(email_digest.pending_notifications?).not_to be
|
||||
end
|
||||
|
||||
@@ -74,7 +74,7 @@ describe EmailDigest do
|
||||
notification = create(:notification, notifiable: proposal_notification, user: user)
|
||||
|
||||
reset_mailer
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
email_digest.deliver(Time.current)
|
||||
|
||||
email = open_last_email
|
||||
@@ -88,7 +88,7 @@ describe EmailDigest do
|
||||
create(:notification, notifiable: proposal_notification, user: user, emailed_at: Time.current)
|
||||
|
||||
reset_mailer
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
email_digest.deliver(Time.current)
|
||||
|
||||
expect(all_emails.count).to eq(0)
|
||||
@@ -111,7 +111,7 @@ describe EmailDigest do
|
||||
expect(notification2.emailed_at).not_to be
|
||||
expect(notification3.emailed_at).not_to be
|
||||
|
||||
email_digest = described_class.new(user1)
|
||||
email_digest = EmailDigest.new(user1)
|
||||
email_digest.mark_as_emailed
|
||||
|
||||
notification1.reload
|
||||
@@ -126,8 +126,8 @@ describe EmailDigest do
|
||||
user1 = create(:user, failed_email_digests_count: 0)
|
||||
user2 = create(:user, failed_email_digests_count: 3)
|
||||
|
||||
email_digest_1 = described_class.new(user1)
|
||||
email_digest_2 = described_class.new(user2)
|
||||
email_digest_1 = EmailDigest.new(user1)
|
||||
email_digest_2 = EmailDigest.new(user2)
|
||||
email_digest_1.mark_as_emailed
|
||||
email_digest_2.mark_as_emailed
|
||||
|
||||
@@ -142,14 +142,14 @@ describe EmailDigest do
|
||||
it "returns a MatchData if email is valid" do
|
||||
user = create(:user, email: "valid_email@email.com")
|
||||
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
expect(email_digest.valid_email?).to be_a(MatchData)
|
||||
end
|
||||
|
||||
it "returns nil if email is invalid" do
|
||||
user = create(:user, email: "invalid_email@email..com")
|
||||
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
expect(email_digest.valid_email?).to be(nil)
|
||||
end
|
||||
|
||||
@@ -157,7 +157,7 @@ describe EmailDigest do
|
||||
user = create(:user)
|
||||
user.update_attribute(:email, nil)
|
||||
|
||||
email_digest = described_class.new(user)
|
||||
email_digest = EmailDigest.new(user)
|
||||
expect(email_digest.valid_email?).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ describe GraphQL::ApiTypesCreator do
|
||||
|
||||
describe "::create_type" do
|
||||
it "creates fields for Int attributes" do
|
||||
debate_type = described_class.create_type(Debate, { id: :integer }, created_types)
|
||||
debate_type = GraphQL::ApiTypesCreator.create_type(Debate, { id: :integer }, created_types)
|
||||
created_field = debate_type.fields["id"]
|
||||
|
||||
expect(created_field).to be_a(GraphQL::Field)
|
||||
@@ -14,7 +14,7 @@ describe GraphQL::ApiTypesCreator do
|
||||
end
|
||||
|
||||
it "creates fields for String attributes" do
|
||||
debate_type = described_class.create_type(Debate, { title: :string }, created_types)
|
||||
debate_type = GraphQL::ApiTypesCreator.create_type(Debate, { title: :string }, created_types)
|
||||
created_field = debate_type.fields["title"]
|
||||
|
||||
expect(created_field).to be_a(GraphQL::Field)
|
||||
@@ -23,8 +23,8 @@ describe GraphQL::ApiTypesCreator do
|
||||
end
|
||||
|
||||
it "creates connections for :belongs_to associations" do
|
||||
user_type = described_class.create_type(User, { id: :integer }, created_types)
|
||||
debate_type = described_class.create_type(Debate, { author: User }, created_types)
|
||||
user_type = GraphQL::ApiTypesCreator.create_type(User, { id: :integer }, created_types)
|
||||
debate_type = GraphQL::ApiTypesCreator.create_type(Debate, { author: User }, created_types)
|
||||
|
||||
connection = debate_type.fields["author"]
|
||||
|
||||
@@ -34,8 +34,8 @@ describe GraphQL::ApiTypesCreator do
|
||||
end
|
||||
|
||||
it "creates connections for :has_one associations" do
|
||||
user_type = described_class.create_type(User, { organization: Organization }, created_types)
|
||||
organization_type = described_class.create_type(Organization, { id: :integer }, created_types)
|
||||
user_type = GraphQL::ApiTypesCreator.create_type(User, { organization: Organization }, created_types)
|
||||
organization_type = GraphQL::ApiTypesCreator.create_type(Organization, { id: :integer }, created_types)
|
||||
|
||||
connection = user_type.fields["organization"]
|
||||
|
||||
@@ -45,8 +45,8 @@ describe GraphQL::ApiTypesCreator do
|
||||
end
|
||||
|
||||
it "creates connections for :has_many associations" do
|
||||
comment_type = described_class.create_type(Comment, { id: :integer }, created_types)
|
||||
debate_type = described_class.create_type(Debate, { comments: [Comment] }, created_types)
|
||||
comment_type = GraphQL::ApiTypesCreator.create_type(Comment, { id: :integer }, created_types)
|
||||
debate_type = GraphQL::ApiTypesCreator.create_type(Debate, { comments: [Comment] }, created_types)
|
||||
|
||||
connection = debate_type.fields["comments"]
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ describe GraphQL::QueryTypeCreator do
|
||||
let(:api_types) { GraphQL::ApiTypesCreator.create(api_type_definitions) }
|
||||
|
||||
describe "::create" do
|
||||
let(:query_type) { described_class.create(api_types) }
|
||||
let(:query_type) { GraphQL::QueryTypeCreator.create(api_types) }
|
||||
|
||||
it "creates a QueryType with fields to retrieve single objects whose model fields included an ID" do
|
||||
field = query_type.fields["proposal"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe LocalCensus do
|
||||
let(:api) { described_class.new }
|
||||
let(:api) { LocalCensus.new }
|
||||
|
||||
describe "#call" do
|
||||
let(:invalid_body) { nil }
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe ManagerAuthenticator do
|
||||
let(:authenticator) { described_class.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "20151031135905") }
|
||||
let(:authenticator) { ManagerAuthenticator.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "20151031135905") }
|
||||
|
||||
describe "initialization params" do
|
||||
it "causes auth to return false if blank login" do
|
||||
blank_login_authenticator = described_class.new(login: "", clave_usuario: "31415926", fecha_conexion: "20151031135905")
|
||||
blank_login_authenticator = ManagerAuthenticator.new(login: "", clave_usuario: "31415926", fecha_conexion: "20151031135905")
|
||||
expect(blank_login_authenticator.auth).to be false
|
||||
end
|
||||
|
||||
it "causes auth to return false if blank user_key" do
|
||||
blank_user_key_authenticator = described_class.new(login: "JJB033", clave_usuario: "", fecha_conexion: "20151031135905")
|
||||
blank_user_key_authenticator = ManagerAuthenticator.new(login: "JJB033", clave_usuario: "", fecha_conexion: "20151031135905")
|
||||
expect(blank_user_key_authenticator.auth).to be false
|
||||
end
|
||||
|
||||
it "causes auth to return false if blank date" do
|
||||
blank_date_authenticator = described_class.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "")
|
||||
blank_date_authenticator = ManagerAuthenticator.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "")
|
||||
expect(blank_date_authenticator.auth).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe RemoteCensusApi do
|
||||
let(:api) { described_class.new }
|
||||
let(:api) { RemoteCensusApi.new }
|
||||
|
||||
describe "#call" do
|
||||
let(:invalid_body) { { get_habita_datos_response: { get_habita_datos_return: { datos_habitante: {}}}} }
|
||||
|
||||
@@ -19,7 +19,7 @@ describe RemoteTranslations::Caller do
|
||||
let(:debate) { create(:debate) }
|
||||
let(:remote_translation) { create(:remote_translation,
|
||||
remote_translatable: debate, locale: :es) }
|
||||
let(:caller) { described_class.new(remote_translation) }
|
||||
let(:caller) { RemoteTranslations::Caller.new(remote_translation) }
|
||||
|
||||
it "returns the resource with new translation persisted" do
|
||||
response = ["Título traducido", "Descripción traducida"]
|
||||
@@ -67,7 +67,7 @@ describe RemoteTranslations::Caller do
|
||||
let!(:proposal) { create(:proposal) }
|
||||
let(:remote_translation) { create(:remote_translation,
|
||||
remote_translatable: proposal, locale: :es) }
|
||||
let(:caller) { described_class.new(remote_translation) }
|
||||
let(:caller) { RemoteTranslations::Caller.new(remote_translation) }
|
||||
|
||||
it "returns the resource with new translation persisted" do
|
||||
response = ["Título traducido", "Descripción traducida", "Pregunta traducida",
|
||||
@@ -118,7 +118,7 @@ describe RemoteTranslations::Caller do
|
||||
let(:remote_translation) { create(:remote_translation,
|
||||
remote_translatable: budget_investment,
|
||||
locale: :es) }
|
||||
let(:caller) { described_class.new(remote_translation) }
|
||||
let(:caller) { RemoteTranslations::Caller.new(remote_translation) }
|
||||
|
||||
it "returns the resource with new translation persisted" do
|
||||
response = ["Título traducido", "Descripción traducida"]
|
||||
@@ -166,7 +166,7 @@ describe RemoteTranslations::Caller do
|
||||
let(:comment) { create(:comment) }
|
||||
let(:remote_translation) { create(:remote_translation,
|
||||
remote_translatable: comment, locale: :es) }
|
||||
let(:caller) { described_class.new(remote_translation) }
|
||||
let(:caller) { RemoteTranslations::Caller.new(remote_translation) }
|
||||
|
||||
it "returns the resource with new translation persisted" do
|
||||
response = ["Body traducido"]
|
||||
|
||||
@@ -2,7 +2,7 @@ require "rails_helper"
|
||||
|
||||
describe RemoteTranslations::Microsoft::Client do
|
||||
|
||||
let(:client) { described_class.new }
|
||||
let(:client) { RemoteTranslations::Microsoft::Client.new }
|
||||
|
||||
describe "#call" do
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ require "rails_helper"
|
||||
|
||||
describe TagSanitizer do
|
||||
|
||||
subject { described_class.new }
|
||||
subject { TagSanitizer.new }
|
||||
|
||||
describe "#sanitize_tag" do
|
||||
it "allows regular text, even spaces" do
|
||||
@@ -14,9 +14,9 @@ describe TagSanitizer do
|
||||
end
|
||||
|
||||
it "sets up a max length for each tag" do
|
||||
long_tag = "1" * (described_class.tag_max_length + 100)
|
||||
long_tag = "1" * (TagSanitizer.tag_max_length + 100)
|
||||
|
||||
expect(subject.sanitize_tag(long_tag).size).to eq(described_class.tag_max_length)
|
||||
expect(subject.sanitize_tag(long_tag).size).to eq(TagSanitizer.tag_max_length)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ describe UserSegments do
|
||||
active_user = create(:user)
|
||||
erased_user = create(:user, erased_at: Time.current)
|
||||
|
||||
expect(described_class.all_users).to include active_user
|
||||
expect(described_class.all_users).not_to include erased_user
|
||||
expect(UserSegments.all_users).to include active_user
|
||||
expect(UserSegments.all_users).not_to include erased_user
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,9 +21,9 @@ describe UserSegments do
|
||||
active_admin = create(:administrator).user
|
||||
erased_user = create(:user, erased_at: Time.current)
|
||||
|
||||
expect(described_class.administrators).to include active_admin
|
||||
expect(described_class.administrators).not_to include active_user
|
||||
expect(described_class.administrators).not_to include erased_user
|
||||
expect(UserSegments.administrators).to include active_admin
|
||||
expect(UserSegments.administrators).not_to include active_user
|
||||
expect(UserSegments.administrators).not_to include erased_user
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ describe UserSegments do
|
||||
create(:proposal, :archived, author: user2)
|
||||
create(:proposal, :retired, author: user3)
|
||||
|
||||
all_proposal_authors = described_class.all_proposal_authors
|
||||
all_proposal_authors = UserSegments.all_proposal_authors
|
||||
expect(all_proposal_authors).to include user1
|
||||
expect(all_proposal_authors).to include user2
|
||||
expect(all_proposal_authors).to include user3
|
||||
@@ -44,7 +44,7 @@ describe UserSegments do
|
||||
create(:proposal, :archived, author: user1)
|
||||
create(:proposal, :retired, author: user1)
|
||||
|
||||
all_proposal_authors = described_class.all_proposal_authors
|
||||
all_proposal_authors = UserSegments.all_proposal_authors
|
||||
expect(all_proposal_authors).to contain_exactly(user1)
|
||||
end
|
||||
end
|
||||
@@ -53,7 +53,7 @@ describe UserSegments do
|
||||
it "returns users that have created a proposal" do
|
||||
proposal = create(:proposal, author: user1)
|
||||
|
||||
proposal_authors = described_class.proposal_authors
|
||||
proposal_authors = UserSegments.proposal_authors
|
||||
expect(proposal_authors).to include user1
|
||||
expect(proposal_authors).not_to include user2
|
||||
end
|
||||
@@ -62,7 +62,7 @@ describe UserSegments do
|
||||
proposal1 = create(:proposal, author: user1)
|
||||
proposal2 = create(:proposal, author: user1)
|
||||
|
||||
proposal_authors = described_class.proposal_authors
|
||||
proposal_authors = UserSegments.proposal_authors
|
||||
expect(proposal_authors).to contain_exactly(user1)
|
||||
end
|
||||
end
|
||||
@@ -73,7 +73,7 @@ describe UserSegments do
|
||||
budget = create(:budget)
|
||||
investment.update(budget: budget)
|
||||
|
||||
investment_authors = described_class.investment_authors
|
||||
investment_authors = UserSegments.investment_authors
|
||||
expect(investment_authors).to include user1
|
||||
expect(investment_authors).not_to include user2
|
||||
end
|
||||
@@ -85,7 +85,7 @@ describe UserSegments do
|
||||
investment1.update(budget: budget)
|
||||
investment2.update(budget: budget)
|
||||
|
||||
investment_authors = described_class.investment_authors
|
||||
investment_authors = UserSegments.investment_authors
|
||||
expect(investment_authors).to contain_exactly(user1)
|
||||
end
|
||||
end
|
||||
@@ -111,7 +111,7 @@ describe UserSegments do
|
||||
unfeasible_investment_unfinished.update(budget: budget)
|
||||
unfeasible_investment_finished.update(budget: budget)
|
||||
|
||||
investment_authors = described_class.feasible_and_undecided_investment_authors
|
||||
investment_authors = UserSegments.feasible_and_undecided_investment_authors
|
||||
expect(investment_authors).to include user1
|
||||
expect(investment_authors).to include user2
|
||||
expect(investment_authors).to include user3
|
||||
@@ -127,7 +127,7 @@ describe UserSegments do
|
||||
feasible_investment.update(budget: budget)
|
||||
undecided_investment.update(budget: budget)
|
||||
|
||||
investment_authors = described_class.feasible_and_undecided_investment_authors
|
||||
investment_authors = UserSegments.feasible_and_undecided_investment_authors
|
||||
expect(investment_authors).to contain_exactly(user1)
|
||||
end
|
||||
end
|
||||
@@ -140,7 +140,7 @@ describe UserSegments do
|
||||
selected_investment.update(budget: budget)
|
||||
unselected_investment.update(budget: budget)
|
||||
|
||||
investment_authors = described_class.selected_investment_authors
|
||||
investment_authors = UserSegments.selected_investment_authors
|
||||
expect(investment_authors).to include user1
|
||||
expect(investment_authors).not_to include user2
|
||||
end
|
||||
@@ -152,7 +152,7 @@ describe UserSegments do
|
||||
selected_investment1.update(budget: budget)
|
||||
selected_investment2.update(budget: budget)
|
||||
|
||||
investment_authors = described_class.selected_investment_authors
|
||||
investment_authors = UserSegments.selected_investment_authors
|
||||
expect(investment_authors).to contain_exactly(user1)
|
||||
end
|
||||
end
|
||||
@@ -165,7 +165,7 @@ describe UserSegments do
|
||||
winner_investment.update(budget: budget)
|
||||
selected_investment.update(budget: budget)
|
||||
|
||||
investment_authors = described_class.winner_investment_authors
|
||||
investment_authors = UserSegments.winner_investment_authors
|
||||
expect(investment_authors).to include user1
|
||||
expect(investment_authors).not_to include user2
|
||||
end
|
||||
@@ -177,7 +177,7 @@ describe UserSegments do
|
||||
winner_investment1.update(budget: budget)
|
||||
winner_investment2.update(budget: budget)
|
||||
|
||||
investment_authors = described_class.winner_investment_authors
|
||||
investment_authors = UserSegments.winner_investment_authors
|
||||
expect(investment_authors).to contain_exactly(user1)
|
||||
end
|
||||
end
|
||||
@@ -189,7 +189,7 @@ describe UserSegments do
|
||||
budget = create(:budget)
|
||||
investment1.update(budget: budget)
|
||||
|
||||
current_budget_investments = described_class.current_budget_investments
|
||||
current_budget_investments = UserSegments.current_budget_investments
|
||||
expect(current_budget_investments).to include investment1
|
||||
expect(current_budget_investments).not_to include investment2
|
||||
end
|
||||
@@ -205,7 +205,7 @@ describe UserSegments do
|
||||
investment1.update(budget: budget)
|
||||
investment2.update(budget: budget)
|
||||
|
||||
not_supported_on_current_budget = described_class.not_supported_on_current_budget
|
||||
not_supported_on_current_budget = UserSegments.not_supported_on_current_budget
|
||||
expect(not_supported_on_current_budget).to include user3
|
||||
expect(not_supported_on_current_budget).not_to include user1
|
||||
expect(not_supported_on_current_budget).not_to include user2
|
||||
@@ -217,7 +217,7 @@ describe UserSegments do
|
||||
create(:user, email: "first@email.com", created_at: 1.day.ago)
|
||||
create(:user, email: "last@email.com")
|
||||
|
||||
emails = described_class.user_segment_emails(:all_users)
|
||||
emails = UserSegments.user_segment_emails(:all_users)
|
||||
expect(emails.first).to eq "first@email.com"
|
||||
expect(emails.last).to eq "last@email.com"
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ require "rails_helper"
|
||||
|
||||
describe WYSIWYGSanitizer do
|
||||
|
||||
subject { described_class.new }
|
||||
subject { WYSIWYGSanitizer.new }
|
||||
|
||||
describe "#sanitize" do
|
||||
|
||||
|
||||
Reference in New Issue
Block a user