Sha256: 0937167f7d00c38fe137956ca067e010e2fdc795a26e61ee49d1344ede76f47a

Contents?: true

Size: 1.34 KB

Versions: 8

Compression:

Stored size: 1.34 KB

Contents

require "test_helper"

class FakeUserTest < ActiveSupport::TestCase

  setup do
    @fake_user = FakeUser.new
  end

  should "have the id set to 0" do
    assert_equal 0, @fake_user.id
  end

  should "be able to do anything" do
    assert @fake_user.can?("sing")
    assert !@fake_user.cannot?("sing")
  end

  should "have a locale" do
    assert_equal ::I18n.locale, @fake_user.locale
  end

  should "have status set to true" do
    assert @fake_user.status
  end

  should "be considered as root" do
    assert @fake_user.is_root?
  end

  should "not be considered as no_root" do
    assert !@fake_user.is_not_root?
  end

  should "have access to all applications" do
    assert_equal Typus.applications, @fake_user.applications
  end

  context "application" do

    should "have access to all applications filtered" do
      assert_equal Typus.application("CRUD"), @fake_user.application("CRUD")
    end

    should "make sure I get what I want" do
      expected = ["Animal", "Bird", "Dog", "ImageHolder"]
      assert_equal expected, @fake_user.application("Polymorphic")
    end

  end

  should "be master_role" do
    assert_equal Typus.master_role, @fake_user.role
  end

  should "not respond to resources" do
    assert !@fake_user.respond_to?(:resources)
  end

  should "always be the owner of a resource" do
    assert @fake_user.owns?('a')
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
typus-3.0.11 test/lib/support/fake_user_test.rb
typus-3.0.11.rc5 test/lib/support/fake_user_test.rb
typus-3.0.11.rc4 test/lib/support/fake_user_test.rb
typus-3.0.11.rc3 test/lib/support/fake_user_test.rb
typus-3.0.11.rc2 test/lib/support/fake_user_test.rb
typus-3.0.11.rc1 test/lib/support/fake_user_test.rb
typus-3.0.10 test/lib/support/fake_user_test.rb
typus-3.0.9 test/lib/support/fake_user_test.rb