Sha256: 80dd065b36ff54c9d62f32b89c271196515bca3c055d9576f3b1d2449683fcc0

Contents?: true

Size: 1.09 KB

Versions: 26

Compression:

Stored size: 1.09 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Status, "attributes" do
  before :all do
    @status = Status.new(:id => 1, :name => 'Test')
  end
  
  specify 'id' do
    @status.id.should == 1
  end
  
  specify 'symbol' do
    @status.name.should == 'Test'
  end
  
  specify 'name' do
    @status.symbol.should == :test
  end
end

describe Status, 'find' do
  it 'should find by number ID' do
    Status.find(1).id.should == 1
  end
  
  it 'should find by string ID' do
    Status.find('1').id.should == 1
  end
  
  it 'should find nil when status with ID does not exist' do
    Status.find(0).should be_nil
  end
end

describe Status, 'brackets' do
  it 'should allow you to look up with a symbol' do
    Status[:draft].name.should == 'Draft'
  end
  
  it 'should return nil if symbol is not associated with a status' do
    Status[:whatever].should == nil
  end
end

describe Status, 'find_all' do
  it 'should return all statuses as Status objects' do
    statuses = Status.find_all
    statuses.size.should > 0
    statuses.each do |status|
      status.should be_kind_of(Status)
    end
  end
end

Version data entries

26 entries across 26 versions & 4 rubygems

Version Path
radiant-0.6.6 spec/models/status_spec.rb
radiant-0.6.9 spec/models/status_spec.rb
radiant-0.6.8 spec/models/status_spec.rb
radiant-0.7.0 spec/models/status_spec.rb
radiant-0.8.0 spec/models/status_spec.rb
radiant-0.7.1 spec/models/status_spec.rb