Sha256: d3bb5b6ee2c00e28a7dd4b186d0c48a7524f66b5e158983c77f8953c49360e24
Contents?: true
Size: 564 Bytes
Versions: 3
Compression:
Stored size: 564 Bytes
Contents
require 'test_helper' class UserTest < ActiveSupport::TestCase setup do @admin ||= User.where({ username: 'flynn', role: 'admin' }).first_or_create @user ||= User.where({ username: 'sam', role: 'user' }).first_or_create end test "the model gets extended" do assert @user.respond_to? :can? end test "it allows to check permissions" do # User assert @user.can?(:show, :articles) assert_not @user.can?(:create, :articles) # Admin assert @admin.can?(:create, :articles) assert @admin.can?(:edit, :articles) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
action_access-0.0.3 | test/models/user_test.rb |
action_access-0.0.2 | test/models/user_test.rb |
action_access-0.0.1 | test/models/user_test.rb |