Sha256: a9a598b43757a3ce4e133c3d7776c93a7a68b6ec318ed6347a4af297357182d0

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

require "test_helper"

class ActiveRecordTest < ActiveSupport::TestCase

  should "verify mapping instace method with an array" do
    post = Factory(:post)
    assert_equal "published", post.mapping(:status)
  end

  should "verify mapping instace method with an array when status if unpublished" do
    post = Factory(:post, :status => "unpublished")
    assert_equal "unpublished", post.mapping(:status)
  end

  should "verify mapping instace method with a hash" do
    page = Factory(:page)
    assert_equal "Published", page.mapping(:status)
    page = Factory(:page, :status => "unpublished")
    assert_equal "Not Published", page.mapping(:status)
  end

  should "verify to_label instace method" do
    assert_equal "admin@example.com", Factory(:typus_user).to_label
  end

  should "verify to_label instace method for post" do
    assert_match /Post#/, Factory(:post).to_label
  end

  should "verify to_resource instance method" do
    assert_equal "typus_users", TypusUser.to_resource
    assert_equal "delayed/tasks", Delayed::Task.to_resource
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
typus-1.0.0.pre8 test/lib/support/active_record_test.rb
typus-1.0.0.pre7 test/lib/support/active_record_test.rb
typus-1.0.0.pre6 test/lib/support/active_record_test.rb
typus-1.0.0.pre5 test/lib/support/active_record_test.rb
typus-1.0.0.pre4 test/lib/support/active_record_test.rb
typus-1.0.0.pre3 test/lib/support/active_record_test.rb
typus-1.0.0.pre2 test/lib/support/active_record_test.rb
typus-1.0.0.pre test/lib/support/active_record_test.rb