Sha256: b6c1f48f9e57307025b51083d5c0e61b6576e87b3fb6e38c1934d11239d72e07
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require 'mongo_mapper/spec_helper' describe Permits::Ability do context "Guest user" do before :each do @guest = User.create(:name => "Kristian", :role => "guest") @ability = Permits::Ability.new(@guest, :strategy => :orm) @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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cancan-permits-0.2.2 | spec/mongo_mapper/permits_spec.rb |