Sha256: 763174d0a7319103cbeeee5a236955fcce883010645f2fa9e2c9a1f6d19f486b

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

require "test/test_helper"

class HasRoleOptionsTest < ActiveSupport::TestCase

  context "A record with a custom role field" do

    setup do
      @soldier = Soldier.new
    end

    should "allow its role to be written and read" do
      @soldier.role = "guest"
      assert "guest", @soldier.role.name
    end

    should "store the role name in the custom field" do
      assert "guest", @soldier.rank
    end

    should "still work with permissions" do
      @soldier.role = "guest"
      assert @soldier.may_hug?
      assert !@soldier.may_update_users?
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Chrononaut-aegis-1.2.0 test/has_role_options_test.rb