Files
grecia/spec/models/banner_spec.rb
Javi Martín 0b83be6837 Apply banner default colors to dev seeds
Banners created through the admin form were getting the default color.
However, banners 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 banners and
simplify the code at the same time thanks to its `attribute` method.

Now, when creating a new banner, instead of getting a blank space, we
get an empty line with the banner's default background color, which most
users won't know what it's about until they fill in the banner's title.
So we're not displaying the content of the banner when it's empty,
thanks to the `:empty` CSS pseudoclass.
2020-08-12 17:16:11 +02:00

22 lines
436 B
Ruby

require "rails_helper"
describe Banner do
let(:banner) { build(:banner) }
describe "Concerns" do
it_behaves_like "acts as paranoid", :banner
it_behaves_like "globalizable", :banner
end
it "is valid" do
expect(banner).to be_valid
end
it "assigns default values to new banners" do
banner = Banner.new
expect(banner.background_color).to be_present
expect(banner.font_color).to be_present
end
end