1 require File.dirname(__FILE__) + '/../spec_helper'
3 describe Status, "attributes" do
5 @status = Status.new(:id => 1, :name => 'Test')
13 @status.name.should == 'Test'
17 @status.symbol.should == :test
21 describe Status, 'find' do
22 it 'should find by number ID' do
23 Status.find(1).id.should == 1
26 it 'should find by string ID' do
27 Status.find('1').id.should == 1
30 it 'should find nil when status with ID does not exist' do
31 Status.find(0).should be_nil
35 describe Status, 'brackets' do
36 it 'should allow you to look up with a symbol' do
37 Status[:draft].name.should == 'Draft'
40 it 'should return nil if symbol is not associated with a status' do
41 Status[:whatever].should == nil
45 describe Status, 'find_all' do
46 it 'should return all statuses as Status objects' do
47 statuses = Status.find_all
48 statuses.size.should > 0
49 statuses.each do |status|
50 status.should be_kind_of(Status)