Sha256: 0fdef73e24e501f9f9c26e73b898beb2ec0033c0f11bdf055a02b47b5dc97461

Contents?: true

Size: 682 Bytes

Versions: 14

Compression:

Stored size: 682 Bytes

Contents

require 'test_helper'

class RolesWithCustomAssociationNamesTest < ActiveSupport::TestCase
  setup do
    Access.destroy_all
    [Account, FooBar].each { |model| model.delete_all }

    assert @subj = Account.create!
    assert @subj2 = Account.create!
    assert @foobar = FooBar.create!
  end

  test "should basically work" do
    assert_difference -> { Access.count }, 2 do
      assert @subj.has_role! :admin
      assert @subj.has_role! :user, @foobar
    end

    assert @subj.has_role? :admin
    refute @subj2.has_role? :admin

    assert @subj.has_role? :user, @foobar
    refute @subj2.has_role? :user, @foobar

    @subj.has_no_roles!
    @subj2.has_no_roles!
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
careacademy-acl9-3.4.0 test/models/roles_with_custom_association_names_test.rb
careacademy-acl9-3.3.0 test/models/roles_with_custom_association_names_test.rb
acl9-3.2.0 test/models/roles_with_custom_association_names_test.rb
acl9-3.1.0 test/models/roles_with_custom_association_names_test.rb
acl9-3.0.0 test/models/roles_with_custom_association_names_test.rb
acl9-2.1.2 test/models/roles_with_custom_association_names_test.rb
acl9-2.1.1 test/models/roles_with_custom_association_names_test.rb
acl9-2.1.0 test/models/roles_with_custom_association_names_test.rb
acl9-2.0.0 test/models/roles_with_custom_association_names_test.rb
acl9-1.3.0 test/models/roles_with_custom_association_names_test.rb
acl9-1.2.1 test/models/roles_with_custom_association_names_test.rb
acl9-1.2.0 test/models/roles_with_custom_association_names_test.rb
acl9-1.1.0 test/models/roles_with_custom_association_names_test.rb
acl9-1.0.0 test/models/roles_with_custom_association_names_test.rb