We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
71 lines
3.2 KiB
Ruby
71 lines
3.2 KiB
Ruby
require "rails_helper"
|
|
|
|
describe SignatureSheetsHelper do
|
|
describe "#required_fields_to_verify_text_help by default" do
|
|
it "returns text help by default" do
|
|
text = "Write the numbers separated by semicolons (;)"
|
|
expect(required_fields_to_verify_text_help).to eq(text)
|
|
end
|
|
end
|
|
|
|
describe "#required_fields_to_verify_text_help with remote_census active" do
|
|
before do
|
|
Setting["feature.remote_census"] = true
|
|
end
|
|
|
|
it "returns text help when date_of_birth and postal_code are not required" do
|
|
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"
|
|
|
|
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)
|
|
end
|
|
|
|
it "returns text help when date_of_birth is required" do
|
|
Setting["remote_census.request.date_of_birth"] = "some.value"
|
|
|
|
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."
|
|
text_example = "Example: 12345678Z, 01/01/1980; 87654321Y, 01/02/1990"
|
|
|
|
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"
|
|
|
|
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."
|
|
text_example = "Example: 12345678Z, 28001; 87654321Y, 28002"
|
|
|
|
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"
|
|
|
|
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
|