-
How do I properly test it "is authorized" do
expect { post_create }.to be_authorized_to(:create?, Product.last)
.with(Accounts::ProductPolicy)
end Since block with expect is deferers the post_create, I don't know how to test that I am authorizing the post object to be created Similar question to :new? Since Product.new == Product.new is false, I don't know how to implement the same test |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Doesn't In general, I recommend against calling Check out also this discussion: #209 |
Beta Was this translation helpful? Give feedback.
Doesn't
an_instance_of(Product)
work here? I believe, it should.In general, I recommend against calling
authorize!
against non-yet-created records. Creating a record is usually protected by some outer context, which should be authorized.Check out also this discussion: #209