OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/models/user_spec.rb

28 lines
888 B

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe User do
describe 'backlogs_preference' do
describe 'task_color' do
it 'reads from and writes to a user preference' do
u = FactoryGirl.create(:user)
u.backlogs_preference(:task_color, '#FFCC33')
u.backlogs_preference(:task_color).should == '#FFCC33'
u.reload
u.backlogs_preference(:task_color).should == '#FFCC33'
end
it 'computes a random color and persists it, when none is set' do
u = FactoryGirl.create(:user)
u.backlogs_preference(:task_color, nil)
u.save!
generated_task_color = u.backlogs_preference(:task_color)
generated_task_color.should =~ /^#[0-9A-F]{6}$/
u.save!
u.reload
u.backlogs_preference(:task_color).should == generated_task_color
end
end
end
end