Skip to content

Commit

Permalink
fix headers on template CSVs
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyevil committed Oct 17, 2023
1 parent b43b8a1 commit b2b099e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ def ingredients_from_csv

def csv_header_template
if component.range?
headers = ["Ingredient name", "Minimum % w/w", "Maximum % w/w", "Exact % w/w", "CAS number", "Does NPIS need to know about it?"]
headers = ["Ingredient name", "Minimum % w/w", "Maximum % w/w", "Exact % w/w", "CAS number", "Does the NPIS need to be notified about this ingredient?"]
else
headers = ["Ingredient name", "% w/w", "CAS number", "Does NPIS need to know about it?"]
headers = ["Ingredient name", "% w/w", "CAS number", "Does the NPIS need to be notified about this ingredient?"]
headers << "Is it used for different shades?" if multiple_shades?
end

Expand Down
2 changes: 1 addition & 1 deletion cosmetics-web/spec/fixtures/files/exact_ingredients.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,35,498-19-8,false
Aqua,65,,false
ethanol,23,497-19-8,true
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,35,498-19-8,false
Aqua,65,,false
ethonol,23,497-19-8,true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,35,498-19-8,false
Aqua,65,,true
ethonol,23,497-19-8,false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?,Is it used for different shades?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?,Is it used for different shades?
Sodium,35,498-19-8,false,false
Aqua,65,,false,true
ethanol,23,497-19-8,true,true
2 changes: 1 addition & 1 deletion cosmetics-web/spec/fixtures/files/range_ingredients.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Ingredient name,Minimum % w/w,Maximum % w/w,Exact % w/w,CAS number,Does NPIS need to know about it?
Ingredient name,Minimum % w/w,Maximum % w/w,Exact % w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium carbonate,10,30,,497-19-8,false
Water,35,65,,7732-18-5,false
Eucalyptol,,,12,,true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,35,497-19-8,true
Aqua,65,497-19-8,false
CSV
Expand Down Expand Up @@ -117,7 +117,7 @@
context "when only a header row is present" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
CSV
end

Expand All @@ -144,7 +144,7 @@
context "when the file has too many columns in the header row but correct ingredient row values" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?,Foo
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?,Foo
Aqua,65,497-19-8,false
CSV
end
Expand All @@ -158,7 +158,7 @@
context "when the file has an extra empty column in the header row but correct ingredient row values" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?,
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?,
Aqua,65,497-19-8,false
CSV
end
Expand All @@ -172,7 +172,7 @@
context "when there are duplicate ingredients" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Aqua,65,497-19-8,false
Aqua,50,497-19-8,false
CSV
Expand All @@ -188,7 +188,7 @@
# rubocop:disable Layout/HeredocIndentation
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Aqua,65,497-19-8,false,
CSV
end
Expand All @@ -203,7 +203,7 @@
context "when an ingredient row has an extra column" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Aqua,65,497-19-8,false,bar
CSV
end
Expand All @@ -217,7 +217,7 @@
context "when the ingredient name is empty" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
,35,497-19-8,true
CSV
end
Expand All @@ -231,7 +231,7 @@
context "when the ingredient name is too long" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,32,497-19-8,true
CSV
end
Expand All @@ -245,7 +245,7 @@
context "when the ingredient concentration is empty" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Foo,,497-19-8,true
CSV
end
Expand All @@ -259,7 +259,7 @@
context "when the ingredient concentration value is incorrect" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,abc,497-19-8,foo
CSV
end
Expand All @@ -273,7 +273,7 @@
context "when the ingredient NPIS column is empty" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Aqua,65,497-19-8,
CSV
end
Expand All @@ -287,7 +287,7 @@
context "when the ingredient NPIS column is incorrect" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,32,497-19-8,foo
CSV
end
Expand All @@ -301,7 +301,7 @@
context "when one ingredient row is invalid" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,35,497-19-8,true
Aqua,65,497-19-8,false
Acid,50-75,497-19-8,false
Expand All @@ -317,7 +317,7 @@
context "when multiple ingredient rows are invalid" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,thirtyfive,497-19-8,true
Aqua,65,497-19-8,false
Acid,50-75,497-19-8,false
Expand All @@ -336,7 +336,7 @@

let(:csv) do
<<~CSV
Ingredient name,Minimum % w/w,Maximum % w/w,Exact % w/w,CAS number,Does NPIS need to know about it?
Ingredient name,Minimum % w/w,Maximum % w/w,Exact % w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium carbonate,10,30,,497-19-8,false
Water,35,65,,7732-18-5,false
Eucalyptol,,,12,,true
Expand All @@ -358,7 +358,7 @@
context "when using upper case for toxicity" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Foo,12,497-19-8,TRUE
CSV
end
Expand Down Expand Up @@ -389,7 +389,7 @@
context "when the fields start or end with extra spaces" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Foo,12 , 497-19-8 , TRUE
CSV
end
Expand All @@ -410,7 +410,7 @@
context "when the file contains blank rows" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
,,,
Foo,12 ,497-19-8,TRUE
CSV
Expand Down Expand Up @@ -447,7 +447,7 @@
context "when ingredients are already present in product" do
let(:csv) do
<<~CSV
Ingredient name,% w/w,CAS number,Does NPIS need to know about it?
Ingredient name,% w/w,CAS number,Does the NPIS need to be notified about this ingredient?
Sodium,35,497-19-8,true
Aqua,65,497-19-8,false
CSV
Expand Down

0 comments on commit b2b099e

Please sign in to comment.