Extract block to configure remote census in tests

Co-Authored-By: Javi Martín <javim@elretirao.net>
This commit is contained in:
Senén Rodero Rodríguez
2020-09-29 15:53:55 +02:00
committed by Javi Martín
parent b170949fc1
commit 06dcbd699c
11 changed files with 48 additions and 128 deletions

View File

@@ -8,12 +8,11 @@ describe SignatureSheetsHelper do
end
end
describe "#required_fields_to_verify_text_help with remote_census active" do
before do
Setting["feature.remote_census"] = true
end
describe "#required_fields_to_verify_text_help with remote_census active", :remote_census do
it "returns text help when date_of_birth and postal_code are not required" do
Setting["remote_census.request.date_of_birth"] = nil
Setting["remote_census.request.postal_code"] = nil
text_help_1 = "To verify a user, your application needs: Document number"
text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
text_example = "Example: 12345678Z; 87654321Y"
@@ -24,7 +23,7 @@ describe SignatureSheetsHelper do
end
it "returns text help when date_of_birth is required" do
Setting["remote_census.request.date_of_birth"] = "some.value"
Setting["remote_census.request.postal_code"] = nil
text_help_1 = "To verify a user, your application needs: Document number, Day of birth (dd/mm/yyyy)"
text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
@@ -33,12 +32,10 @@ describe SignatureSheetsHelper do
expect(required_fields_to_verify_text_help).to include(text_help_1)
expect(required_fields_to_verify_text_help).to include(text_help_2)
expect(example_text_help).to include(text_example)
Setting["remote_census.request.date_of_birth"] = nil
end
it "returns text help when postal_code is required" do
Setting["remote_census.request.postal_code"] = "some.value"
Setting["remote_census.request.date_of_birth"] = nil
text_help_1 = "To verify a user, your application needs: Document number and Postal Code"
text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
@@ -47,14 +44,9 @@ describe SignatureSheetsHelper do
expect(required_fields_to_verify_text_help).to include(text_help_1)
expect(required_fields_to_verify_text_help).to include(text_help_2)
expect(example_text_help).to include(text_example)
Setting["remote_census.request.postal_code"] = nil
end
it "returns text help when date_of_birth and postal_code are required" do
Setting["remote_census.request.date_of_birth"] = "some.value"
Setting["remote_census.request.postal_code"] = "some.value"
text_help_1 = "To verify a user, your application needs: Document number, Day of birth (dd/mm/yyyy) and Postal Code"
text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
text_example = "Example: 12345678Z, 01/01/1980, 28001; 87654321Y, 01/02/1990, 28002"
@@ -62,9 +54,6 @@ describe SignatureSheetsHelper do
expect(required_fields_to_verify_text_help).to include(text_help_1)
expect(required_fields_to_verify_text_help).to include(text_help_2)
expect(example_text_help).to include(text_example)
Setting["remote_census.request.postal_code"] = nil
Setting["remote_census.request.postal_code"] = nil
end
end
end