[test] Add unit test for conference_helper#conference_color

This commit is contained in:
Jimmy 2021-03-12 07:49:55 -08:00
parent 72dd36993b
commit 2bcd7d39b3
2 changed files with 12 additions and 0 deletions

View file

@ -49,6 +49,7 @@ FactoryBot.define do
ticket_layout { 'portrait' }
description { Faker::Hipster.paragraph }
organization
color { '#FFFFFF' }
after(:create) do |conference|
Role.where(name: 'organizer', resource: conference).first_or_create(description: 'For the organizers of the conference (who shall have full access)')
Role.where(name: 'cfp', resource: conference).first_or_create(description: 'For the members of the CfP team')

View file

@ -88,4 +88,15 @@ describe ConferenceHelper, type: :helper do
expect(conference_logo_url(conference2)).to include('2.png')
end
end
describe '#conference_color' do
let(:conference2) { create(:conference, color: '#000000') }
it 'gives the correct conference color' do
expect(conference_color(conference2)).to eq('#000000')
conference2.color = ''
expect(conference_color(conference2)).to eq('#0B3559')
end
end
end