Sha256: 2bddeff503d604777b47dd6eb35acc00a265dcb09a3f2072d287ff82edd4f247

Contents?: true

Size: 927 Bytes

Versions: 8

Compression:

Stored size: 927 Bytes

Contents

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

class StatusTest < Test::Unit::TestCase
  def test_initialize
    status = Status.new(:id => 1, :name => 'Test')
    assert_equal 1, status.id
    assert_equal 'Test', status.name
    assert_equal :test, status.symbol
  end
  
  # Class Methods
  
  def test_find
    status = Status.find(1)
    assert_equal 1, status.id
  end
  def test_find__by_string
    status = Status.find('1')
    assert_equal 1, status.id
  end
  def test_find__nonexistant
    status = Status.find(0)
    assert_equal nil, status
  end
  
  def test_brackets
    status = Status[:draft]
    assert_equal 'Draft', status.name
  end
  
  def test_brackets__nonexistant
    status = Status[:drafts]
    assert_equal nil, status
  end
  
  def test_find_all
    statuses = Status.find_all
    assert statuses.size > 0
    statuses.each do |status|
      assert_kind_of Status, status
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
radiant-0.5.0 test/unit/status_test.rb
radiant-0.5.1 test/unit/status_test.rb
radiant-0.6.1 test/unit/status_test.rb
radiant-0.6.0 test/unit/status_test.rb
radiant-0.5.2 test/unit/status_test.rb
radiant-0.6.3 test/unit/status_test.rb
radiant-0.6.2 test/unit/status_test.rb
radiant-0.6.4 test/unit/status_test.rb