Sha256: ff01233f154f4fa43f4750af4cf387ec1b5f84bea3c163760beaa6f0e1517efa

Contents?: true

Size: 1.37 KB

Versions: 20

Compression:

Stored size: 1.37 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

describe Status, 'selectable' do
  it "should return all statuses except 'Scheduled'" do
    statuses = Status.selectable
    statuses.size.should > 0
    statuses.each do |status|
      status.should be_kind_of(Status)
      status.name.should_not == "Scheduled"
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
radiant-1.1.4 spec/models/status_spec.rb
radiant-1.1.3 spec/models/status_spec.rb
radiant-1.1.2 spec/models/status_spec.rb
radiant-1.1.1 spec/models/status_spec.rb
radiant-1.1.0 spec/models/status_spec.rb
radiant-1.1.0.rc1 spec/models/status_spec.rb
radiant-1.1.0.beta spec/models/status_spec.rb
radiant-1.0.1 spec/models/status_spec.rb
radiant-1.1.0.alpha spec/models/status_spec.rb
radiant-1.0.0 spec/models/status_spec.rb
radiant-1.0.0.rc5 spec/models/status_spec.rb
radiant-1.0.0.rc4 spec/models/status_spec.rb
radiant-1.0.0.rc3 spec/models/status_spec.rb
kajam-1.0.3.rc2 spec/models/status_spec.rb
radiant-1.0.0.rc2 spec/models/status_spec.rb
radiant-1.0.0.rc1 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.3 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.2 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1.1 spec/models/status_spec.rb
radiantcms-couchrest_model-0.1 spec/models/status_spec.rb