Replace instance_double usages with double

After the previous commit, we were using `double` in many places but
were only using `instance_double` in one file. So, for consistency,
we're using `double` in this file as well.
This commit is contained in:
Javi Martín
2024-11-06 15:27:21 +01:00
parent f721e88af8
commit bb50f02ba1

View File

@@ -84,40 +84,34 @@ describe Verification::Management::Document do
describe "#valid_age?" do describe "#valid_age?" do
it "returns false when the user is younger than the user's minimum required 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 = double(date_of_birth: under_minium_age_date_of_birth)
date_of_birth: under_minium_age_date_of_birth)
expect(Verification::Management::Document.new.valid_age?(census_response)).to be false expect(Verification::Management::Document.new.valid_age?(census_response)).to be false
end end
it "returns true when the user has the user's minimum required age" do it "returns true when the user has the user's minimum required age" do
census_response = instance_double(CensusApi::Response, census_response = double(date_of_birth: just_minium_age_date_of_birth)
date_of_birth: just_minium_age_date_of_birth)
expect(Verification::Management::Document.new.valid_age?(census_response)).to be true expect(Verification::Management::Document.new.valid_age?(census_response)).to be true
end end
it "returns true when the user is older than the user's minimum required age" do it "returns true when the user is older than the user's minimum required age" do
census_response = instance_double(CensusApi::Response, census_response = double(date_of_birth: over_minium_age_date_of_birth)
date_of_birth: over_minium_age_date_of_birth)
expect(Verification::Management::Document.new.valid_age?(census_response)).to be true expect(Verification::Management::Document.new.valid_age?(census_response)).to be true
end end
end end
describe "#under_age?" do describe "#under_age?" do
it "returns true when the user is younger than the user's minimum required 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 = double(date_of_birth: under_minium_age_date_of_birth)
date_of_birth: under_minium_age_date_of_birth)
expect(Verification::Management::Document.new.under_age?(census_response)).to be true expect(Verification::Management::Document.new.under_age?(census_response)).to be true
end end
it "returns false when the user is user's minimum required age" do it "returns false when the user is user's minimum required age" do
census_response = instance_double(CensusApi::Response, census_response = double(date_of_birth: just_minium_age_date_of_birth)
date_of_birth: just_minium_age_date_of_birth)
expect(Verification::Management::Document.new.under_age?(census_response)).to be false expect(Verification::Management::Document.new.under_age?(census_response)).to be false
end end
it "returns false when the user is older than user's minimum required age" do it "returns false when the user is older than user's minimum required age" do
census_response = instance_double(CensusApi::Response, census_response = double(date_of_birth: over_minium_age_date_of_birth)
date_of_birth: over_minium_age_date_of_birth)
expect(Verification::Management::Document.new.under_age?(census_response)).to be false expect(Verification::Management::Document.new.under_age?(census_response)).to be false
end end
end end