spec/mongoid/permits_spec.rb in cancan-permits-0.2.5 vs spec/mongoid/permits_spec.rb in cancan-permits-0.2.7
- old
+ new
@@ -1,66 +1,2 @@
require 'mongoid/spec_helper'
-
-Permits::Ability.orm = :mongoid
-
-describe Permits::Ability do
- context "Guest user" do
- before :each do
- @guest = User.create(:name => "Kristian", :role => "guest")
-
- @ability = Permits::Ability.new(@guest, :strategy => :string)
-
- @comment = Comment.create(:user_id => @guest.id)
-
- @post = Post.create(:writer => @guest.id)
-
- @article = Article.create(:author => @guest.id)
- end
-
- it "should be able to :read Comment and Post but NOT Article" do
- @ability.can?(:read, Comment).should be_true
- @ability.can?(:read, @comment).should be_true
-
- @ability.can?(:read, Post).should be_true
- @ability.can?(:read, @post).should be_true
-
- @ability.can?(:read, Article).should be_false
- @ability.can?(:read, @article).should be_false
- end
-
- it "should be not able to :update only Comment" do
- @ability.can?(:update, Comment).should be_true
- @ability.can?(:update, @comment).should be_true
-
- @ability.can?(:update, Post).should be_false
- @ability.can?(:update, @post).should be_false
- end
- end
-
- context "Admin user" do
- before do
- @admin = User.create(:role => 'admin')
- @ability = Permits::Ability.new(@admin, :strategy => :string)
- end
-
- it "should be able to :read anything" do
- @ability.can?(:read, Comment).should be_true
- @ability.can?(:read, Post).should be_true
- end
-
- it "should be not able to :update everything" do
- @ability.can?(:update, Comment).should be_true
- @ability.can?(:update, Post).should be_true
- end
-
- it "should be not able to :create everything" do
- @ability.can?(:create, Comment).should be_true
- @ability.can?(:create, Post).should be_true
- end
-
- it "should be not able to :update everything" do
- @ability.can?(:destroy, Comment).should be_true
- @ability.can?(:destroy, Post).should be_true
- end
- end
-
-end
+require 'generic/api/basic/xgroup_orm'
\ No newline at end of file