commit
						aed9f26e56
					
				| @ -237,7 +237,7 @@ module CanCan | |||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def namespace |     def namespace | ||||||
|       @params[:controller].split("::")[0..-2] |       @params[:controller].split(/::|\//)[0..-2] | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def namespaced_name |     def namespaced_name | ||||||
|  | |||||||
| @ -62,6 +62,17 @@ describe CanCan::ControllerResource do | |||||||
|     @controller.instance_variable_get(:@project).should == project |     @controller.instance_variable_get(:@project).should == project | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   it "has the specified nested resource_class when using / for namespace" do | ||||||
|  |     module Admin | ||||||
|  |       class Dashboard; end | ||||||
|  |     end | ||||||
|  |     @ability.can(:index, "admin/dashboard") | ||||||
|  |     @params.merge!(:controller => "admin/dashboard", :action => "index") | ||||||
|  |     @controller.authorize!(:index, "admin/dashboard") | ||||||
|  |     resource = CanCan::ControllerResource.new(@controller, :authorize => true) | ||||||
|  |     resource.send(:resource_class).should == Admin::Dashboard | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|   it "builds a new resource with hash if params[:id] is not specified and authorize on each attribute" do |   it "builds a new resource with hash if params[:id] is not specified and authorize on each attribute" do | ||||||
|     @params.merge!(:action => "create", :project => {:name => "foobar"}) |     @params.merge!(:action => "create", :project => {:name => "foobar"}) | ||||||
|     CanCan::ControllerResource.new(@controller, :load => true).process |     CanCan::ControllerResource.new(@controller, :load => true).process | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ryan Bates
						Ryan Bates