2010-05-16 12:44:32 -07:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Color do
|
|
|
|
specify "should find by id, report name" do
|
|
|
|
Color.find(1).name.should == 'alien'
|
|
|
|
Color.find(2).name.should == 'apple'
|
|
|
|
end
|
|
|
|
|
|
|
|
specify "should find by name, report id" do
|
|
|
|
Color.find_by_name('alien').id.should == 1
|
|
|
|
Color.find_by_name('apple').id.should == 2
|
|
|
|
end
|
|
|
|
|
|
|
|
specify "name should be case-insensitive" do
|
|
|
|
Color.find_by_name('Alien').id.should == 1
|
|
|
|
Color.find_by_name('alien').id.should == 1
|
|
|
|
end
|
2010-05-16 13:15:21 -07:00
|
|
|
|
|
|
|
specify "class should have list of basic colors" do
|
|
|
|
Color::Basic.map { |c| c.name }.should == ['blue', 'green', 'red', 'yellow']
|
|
|
|
end
|
2010-05-16 12:44:32 -07:00
|
|
|
end
|