Sha256: ad5040e02ccb6f34c570387a142d8dc588e2f2db18d9aa909b25e0365aac584f
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
require 'rails_helper' describe Theblog::CommentPolicy do subject { described_class } let(:account){ FactoryGirl.create(:confirmed_account) } let(:admin_account) { FactoryGirl.create(:admin) } let(:account_comment) { FactoryGirl.create(:theblog_comment, author: account) } let(:another_comment) { FactoryGirl.create(:theblog_comment) } permissions :update? do it "denies access if post is published by another user" do expect(subject).not_to permit(account, another_comment) end it "grants access if post is published by user" do expect(subject).to permit(account, account_comment) end it "grants access if user is admin" do expect(subject).to permit(admin_account, another_comment) end end permissions :delete? do it "denies access if post is published by another user" do expect(subject).not_to permit(account, another_comment) end it "grants access if post is published by user" do expect(subject).to permit(account, account_comment) end it "grants access if user is admin" do expect(subject).to permit(admin_account, another_comment) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
theblog-0.0.2.3 | spec/policies/theblog/comment_policy_spec.rb |
theblog-0.0.2.2 | spec/policies/theblog/comment_policy_spec.rb |
theblog-0.0.2 | spec/policies/theblog/comment_policy_spec.rb |