Reports Refactor 2: Move all code to lib/reporting

This commit is contained in:
Sebastian Castro
2022-03-29 19:01:39 +02:00
committed by Jean-Baptiste Bellet
parent 392166b57a
commit 5f78fdce8b
110 changed files with 4654 additions and 4507 deletions

View File

@@ -13,11 +13,11 @@ describe IntegerArrayValidator do
describe "internationalization" do
it "has translation for NOT_ARRAY_ERROR" do
expect(described_class::NOT_ARRAY_ERROR).not_to be_blank
expect(described_class.not_array_error).not_to be_blank
end
it "has translation for INVALID_ELEMENT_ERROR" do
expect(described_class::INVALID_ELEMENT_ERROR).not_to be_blank
expect(described_class.invalid_element_error).not_to be_blank
end
end
@@ -37,7 +37,7 @@ describe IntegerArrayValidator do
it "adds error NOT_ARRAY_ERROR when neither nil nor an array" do
instance.ids = 1
expect(instance).not_to be_valid
expect(instance.errors[:ids]).to include(described_class::NOT_ARRAY_ERROR)
expect(instance.errors[:ids]).to include(described_class.not_array_error)
end
it "does not add error when array of integers" do
@@ -53,7 +53,7 @@ describe IntegerArrayValidator do
it "adds error INVALID_ELEMENT_ERROR when an element cannot be parsed as Integer" do
instance.ids = [1, "2", "Not Integer", 3]
expect(instance).not_to be_valid
expect(instance.errors[:ids]).to include(described_class::INVALID_ELEMENT_ERROR)
expect(instance.errors[:ids]).to include(described_class.invalid_element_error)
end
end
end