You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require'rails_helper'RSpec.describeSubject,type: :modeldoit'can give access to users'douser=User.create!()subject=Subject.create!()user.add_role:admin,subjectexpect(subject.applied_roles).toinclude(user.roles.first)endend
The above spec fails. It passes as soon as I remove the resourcify from User class. The failure message I get is:
% bundle exec rspec spec/models/subject_spec.rb:7Run options: include {:locations=>{"./spec/models/subject_spec.rb"=>[7]}}FFailures: 1) Subject can give access to users Failure/Error: expect(subject.applied_roles).to include(user.roles.first) expected [] to include #<Role id: 1, name: "admin", resource_type: "User", resource_id: 1, created_at: "2023-03-14 06:51:29.467423000 +0000", updated_at: "2023-03-14 06:51:29.482289000 +0000"> Diff: @@ -1 +1 @@ -[#<Role id: 1, name: "admin", resource_type: "User", resource_id: 1, created_at: "2023-03-14 06:51:29.467423000 +0000", updated_at: "2023-03-14 06:51:29.482289000 +0000">] +[] # ./spec/models/subject_spec.rb:9:in `block (2 levels) in <top (required)>'Finished in 0.07391 seconds (files took 1.47 seconds to load)1 example, 1 failureFailed examples:rspec ./spec/models/subject_spec.rb:5 # Subject can give access to users
System info:
% uname -a
Darwin machine.lan 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64 x86_64
% ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
% rails --version
Rails 7.0.4.3
Rolify v6.0.1
The text was updated successfully, but these errors were encountered:
I have the following setup:
and the following spec:
The above spec fails. It passes as soon as I remove the
resourcify
fromUser
class. The failure message I get is:System info:
Rolify v6.0.1
The text was updated successfully, but these errors were encountered: