Skip to content
This repository

Add manage to default aliases #688

Closed
wants to merge 2 commits into from

2 participants

Steven Weller Ryan Bates
Steven Weller

Fixed a pending mongoid spec with @matsimitsu by introducing the :manage key to default actions.

Happy Weekend!

Ryan Bates
Owner
ryanb commented

The :manage action is intended to be a wildcard and match anything, not just those five. We should look for another solution to this.

Update: I just realized this is for the 2.0 branch where I changed the wildcard action to :access. Still I don't think this is the right way to go fixing this test.

Ryan Bates ryanb closed this
Steven Weller suweller commented on the diff
spec/cancan/model_adapters/mongoid_adapter_spec.rb
@@ -80,7 +79,7 @@ class MongoidProject
80 79 lord = MongoidProject.create(:title => 'Lord')
81 80 dude = MongoidProject.create(:title => 'Dude')
82 81
83   - MongoidProject.accessible_by(@ability, :destroy).entries.should == [sir]
  82 + MongoidProject.accessible_by(@ability, :delete).entries.should == [sir]
1
Steven Weller
suweller added a note

This still applies though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Jul 13, 2012
Steven Weller suweller Add manage to default actions 28d994a
Steven Weller suweller Fix spec f24fe2f
This page is out of date. Refresh to see the latest.
1  lib/cancan/ability.rb
@@ -341,6 +341,7 @@ def default_aliases
341 341 :create => [:new],
342 342 :update => [:edit],
343 343 :destroy => [:delete],
  344 + :manage => [:index, :show, :new, :edit, :delete]
344 345 }
345 346 }
346 347 end
3  spec/cancan/model_adapters/mongoid_adapter_spec.rb
@@ -72,7 +72,6 @@ class MongoidProject
72 72 end
73 73
74 74 it "returns the correct records when a mix of can and cannot rules in defined ability" do
75   - pending "TODO figure out why this isn't working"
76 75 @ability.can :manage, :mongoid_projects, :title => 'Sir'
77 76 @ability.cannot :destroy, :mongoid_projects
78 77
@@ -80,7 +79,7 @@ class MongoidProject
80 79 lord = MongoidProject.create(:title => 'Lord')
81 80 dude = MongoidProject.create(:title => 'Dude')
82 81
83   - MongoidProject.accessible_by(@ability, :destroy).entries.should == [sir]
  82 + MongoidProject.accessible_by(@ability, :delete).entries.should == [sir]
84 83 end
85 84
86 85 it "is able to mix empty conditions and hashes" do

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.