Files
nairobi/spec/helpers/legislation_helper_spec.rb
Javi Martín 53ff81dfdf Unify code applying the colors of a process
We had some duplication because the `css_for_process_header` was using
an instance variable, and so it couldn't be called from a partial where
this instance variable wasn't available.

Using a local variable and passing it as a parameter (as we should
always do) solves the issue and lets us simplify the code.
2025-03-06 18:25:45 +01:00

32 lines
1008 B
Ruby

require "rails_helper"
describe LegislationHelper do
let(:process) { build(:legislation_process) }
it "is valid" do
expect(process).to be_valid
end
describe "banner colors presence" do
it "background and font color exist" do
process = build(:legislation_process, background_color: "#944949", font_color: "#ffffff")
expect(banner_color?(process)).to be true
end
it "background color exist and font color not exist" do
process = build(:legislation_process, background_color: "#944949", font_color: "")
expect(banner_color?(process)).to be false
end
it "background color not exist and font color exist" do
process = build(:legislation_process, background_color: "", font_color: "#944949")
expect(banner_color?(process)).to be false
end
it "background and font color not exist" do
process = build(:legislation_process, background_color: "", font_color: "")
expect(banner_color?(process)).to be false
end
end
end