Apply Legislation Process default colors to dev seeds

Legislation Processes created through the admin form were getting the default color.
However, Legislation processes created by other means (like the `db:dev_seed` rake task) were not getting these default values.

This feature was originally implemented when we were using Rails 4.
With Rails 5, we can provide default values to all new Legislation processes
and simplify the code at the same time thanks to its `attribute` method.

Related commit:
https://github.com/consul/consul/pull/4080/commits/0b83be6
This commit is contained in:
taitus
2020-08-31 16:26:50 +02:00
parent 3853557343
commit 85ffc70f5f
4 changed files with 12 additions and 19 deletions

View File

@@ -10,6 +10,13 @@ describe Legislation::Process do
expect(process).to be_valid
end
it "assigns default values to new processes" do
process = Legislation::Process.new
expect(process.background_color).to be_present
expect(process.font_color).to be_present
end
describe "dates validations" do
it "is invalid if debate_start_date is present but debate_end_date is not" do
process = build(:legislation_process, debate_start_date: Date.current, debate_end_date: "")