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-rails3-0.1 spec/models/status_spec.rb
radiantcms-couchrest_model-0.2.4 spec/models/status_spec.rb
radiantcms-couchrest_model-0.2.2 spec/models/status_spec.rb
radiantcms-couchrest_model-0.2.1 spec/models/status_spec.rb
radiantcms-couchrest_model-0.2 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.9 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.8 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.7 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.6 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.5 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.4 spec/models/status_spec.rb
radiant-0.7.2 spec/models/status_spec.rb
radiant-0.9.1 spec/models/status_spec.rb
radiant-0.8.2 spec/models/status_spec.rb
radiant-0.9.0.rc2 spec/models/status_spec.rb
radiant-rc-0.9.0 spec/models/status_spec.rb
radiant-0.8.1 spec/models/status_spec.rb
radiant-0.6.5.1 spec/models/status_spec.rb
radiant-0.6.5 spec/models/status_spec.rb
radiant-0.6.7 spec/models/status_spec.rb