Random color assigned to new post statuses

This commit is contained in:
riggraz
2019-09-18 21:12:52 +02:00
parent 109381e791
commit a1dbbb07b4
2 changed files with 14 additions and 1 deletions

View File

@@ -62,6 +62,12 @@ RSpec.describe PostStatus, type: :model do
expect(roadmap.second).to eq(post_status2)
end
it 'automatically sets a random color if not specified' do
post_status1 = PostStatus.new
expect(post_status1.color).to match(/\A#(?:[0-9a-fA-F]{3}){1,2}\z/)
end
it 'automatically sets order to last order if not specified' do
order = 10
post_status1 = FactoryBot.create(:post_status, order: order)