diff --git a/.rubocop.yml b/.rubocop.yml index a183aa5b7..47498329c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -631,6 +631,9 @@ RSpec/SpecFilePathFormat: RSpec/SpecFilePathSuffix: Enabled: true +RSpec/StringAsInstanceDoubleConstant: + Enabled: true + RSpec/UndescriptiveLiteralsDescription: Enabled: true diff --git a/spec/helpers/comments_helper_spec.rb b/spec/helpers/comments_helper_spec.rb index f1d85a2b4..f0d8989d5 100644 --- a/spec/helpers/comments_helper_spec.rb +++ b/spec/helpers/comments_helper_spec.rb @@ -13,8 +13,8 @@ require "rails_helper" RSpec.describe CommentsHelper do describe "#user_level_class" do def comment_double(as_administrator: false, as_moderator: false, official: false) - user = instance_double("User", official?: official, official_level: "Y") - instance_double("Comment", as_administrator?: as_administrator, as_moderator?: as_moderator, user: user) + user = instance_double(User, official?: official, official_level: "Y") + instance_double(Comment, as_administrator?: as_administrator, as_moderator?: as_moderator, user: user) end it "returns is-admin for comment done as administrator" do @@ -45,14 +45,14 @@ RSpec.describe CommentsHelper do describe "#comment_author_class" do it "returns is-author if author is the commenting user" do author_id = 42 - comment = instance_double("Comment", user_id: author_id) + comment = instance_double(Comment, user_id: author_id) expect(helper.comment_author_class(comment, author_id)).to eq("is-author") end it "returns an empty string if commenter is not the author" do author_id = 42 - comment = instance_double("Comment", user_id: author_id - 1) + comment = instance_double(Comment, user_id: author_id - 1) expect(helper.comment_author_class(comment, author_id)).to eq("") end diff --git a/spec/models/verification/management/document_spec.rb b/spec/models/verification/management/document_spec.rb index f814e088c..e9eb02552 100644 --- a/spec/models/verification/management/document_spec.rb +++ b/spec/models/verification/management/document_spec.rb @@ -84,19 +84,19 @@ describe Verification::Management::Document do describe "#valid_age?" do it "returns false when the user is younger than the user's minimum required age" do - census_response = instance_double("CensusApi::Response", + census_response = instance_double(CensusApi::Response, date_of_birth: under_minium_age_date_of_birth) expect(Verification::Management::Document.new.valid_age?(census_response)).to be false end it "returns true when the user has the user's minimum required age" do - census_response = instance_double("CensusApi::Response", + census_response = instance_double(CensusApi::Response, date_of_birth: just_minium_age_date_of_birth) expect(Verification::Management::Document.new.valid_age?(census_response)).to be true end it "returns true when the user is older than the user's minimum required age" do - census_response = instance_double("CensusApi::Response", + census_response = instance_double(CensusApi::Response, date_of_birth: over_minium_age_date_of_birth) expect(Verification::Management::Document.new.valid_age?(census_response)).to be true end @@ -104,19 +104,19 @@ describe Verification::Management::Document do describe "#under_age?" do it "returns true when the user is younger than the user's minimum required age" do - census_response = instance_double("CensusApi::Response", + census_response = instance_double(CensusApi::Response, date_of_birth: under_minium_age_date_of_birth) expect(Verification::Management::Document.new.under_age?(census_response)).to be true end it "returns false when the user is user's minimum required age" do - census_response = instance_double("CensusApi::Response", + census_response = instance_double(CensusApi::Response, date_of_birth: just_minium_age_date_of_birth) expect(Verification::Management::Document.new.under_age?(census_response)).to be false end it "returns false when the user is older than user's minimum required age" do - census_response = instance_double("CensusApi::Response", + census_response = instance_double(CensusApi::Response, date_of_birth: over_minium_age_date_of_birth) expect(Verification::Management::Document.new.under_age?(census_response)).to be false end