spec/role_spec.rb in access-granted-0.0.2 vs spec/role_spec.rb in access-granted-0.1.0
- old
+ new
@@ -60,11 +60,11 @@
expect { @role.can :read, String }.to raise_error AccessGranted::DuplicatePermission
end
it "accepts :manage shortcut for CRUD actions" do
@role.can :manage, String
- @role.permissions.map(&:action).should include(:create, :update, :destroy)
+ @role.permissions.map(&:action).should include(:read, :create, :update, :destroy)
end
describe "when action is an Array" do
it "creates multiple permissions" do
@role.can [:read, :create], String
@@ -73,23 +73,23 @@
end
describe "when no conditions given" do
it "should be able to read a class" do
@role.can :read, String
- @role.can?(:read, String).should be_true
+ @role.find_permission(:read, String).should be_true
end
it "should be able to read instance of class" do
@role.can :read, String
- @role.can?(:read, "text").should be_true
+ @role.find_permission(:read, "text").should be_true
end
end
describe "when conditions given" do
it "should be able to read when conditions match" do
sub = double("Element", published: true)
@role.can :read, sub.class, { published: true }
- @role.can?(:read, sub).should be_true
+ @role.find_permission(:read, sub).should be_true
end
end
end
end