Sha256: 8e9ee276b87c2447d550b6566a5abd0bd0549b87c8295a15495351f947453f5b
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'spec_helper' # can :read, [Comment, Post] # can [:update, :destroy], [Comment] # can :create, Article describe AuthAssistant::Ability do context "Editor user" do before :each do @editor = User.new(1, :editor, 'kristian') @ability = AuthAssistant::Ability.new @editor @comment = Comment.new(1) @post = Post.new(1) @article = Article.new('kristian') end it "should be able to :read Comment he owns, using default :user_id relation - foreign key to User.id" do @ability.should be_able_to(:read, Comment) @ability.should be_able_to(:read, @comment) end it "should be able to :read Post he owns, using :owner relation - foreign key to User.id" do @ability.should be_able_to(:read, Post) @ability.should be_able_to(:read, @post) end it "should be able to :read Article he owns, using :author relation - foreign key to User.name" do @ability.should be_able_to(:read, Article) @ability.should be_able_to(:read, @article) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cancan-permits-0.1.0 | spec/cancan-permits/permits/owner_permits_spec.rb |