spec/unit/inherited_permissions_spec.rb in cancannible-1.0.1 vs spec/unit/inherited_permissions_spec.rb in cancannible-2.0.0

- old
+ new

@@ -1,28 +1,26 @@ require 'spec_helper' - describe Cancannible do let(:grantee_class) { User } context "with mulitple sources of permissions inheritance" do - describe "##inheritable_permissions" do subject { grantee_class.inheritable_permissions } it { should eql([:roles, :group]) } end let!(:role_a) { Role.create! } let!(:role_b) { Role.create! } let!(:group_a) { Group.create! } let!(:group_b) { Group.create! } - subject(:grantee) { + subject(:grantee) do u = grantee_class.new(group: group_a) u.roles << role_a u.save! u - } + end context "with a symbolic resource" do let!(:resource) { :something } describe "#can?" do @@ -41,14 +39,12 @@ context "when permission inherited thru habtm association" do before { role_a.can(:read, resource) } it { should be_truthy } end end - end - context "with a resource class" do let!(:resource) { Widget } describe "#can?" do subject { grantee.can?(:read, resource) } @@ -66,11 +62,10 @@ context "when permission inherited thru habtm association" do before { role_a.can(:read, resource) } it { should be_truthy } end end - end context "with a resource instance" do let!(:resource) { Widget.create! } let!(:other_resource) { Widget.create! } @@ -134,12 +129,8 @@ context "when permission is asserted thru habtm association" do before { role_a.cannot(:read, resource) } it { should be_truthy } end end - - end - end - end