Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resources_controller: Added more specs to get coverage to 100%
git-svn-id: https://svn.ardes.com/rails_plugins/resources_controller@252 845bbffb-5c18-0410-91b3-f25c072b94c1
- Loading branch information
ian
committed
May 10, 2007
1 parent
6dccf6a
commit f042826
Showing
8 changed files
with
127 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper')) | ||
require File.expand_path(File.join(File.dirname(__FILE__), '../app')) | ||
|
||
describe "ActionView with resources_controller Helper" do | ||
|
||
before do | ||
@view = mock('View') | ||
@view.extend Ardes::ResourcesController::Helper | ||
@controller = mock('Controller') | ||
@view.stub!(:controller).and_return(@controller) | ||
end | ||
|
||
def self.it_should_forward_to_controller(msg, *args) | ||
it "should forward ##{msg}#{args.size > 0 ? "(#{args.join(',')})" : ""} to controller" do | ||
@controller.should_receive(msg).with(*args) | ||
@view.send(msg, *args) | ||
end | ||
end | ||
|
||
it_should_forward_to_controller :resource_name | ||
it_should_forward_to_controller :resources_name | ||
it_should_forward_to_controller :resource | ||
it_should_forward_to_controller :resources | ||
it_should_forward_to_controller :resource_url, '*resource' | ||
it_should_forward_to_controller :edit_resource_url, '*resource' | ||
it_should_forward_to_controller :resources_url | ||
it_should_forward_to_controller :new_resource_url | ||
it_should_forward_to_controller :resource_path, '*resource' | ||
it_should_forward_to_controller :edit_resource_path, '*resource' | ||
it_should_forward_to_controller :resources_path | ||
it_should_forward_to_controller :new_resource_path | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper')) | ||
require File.expand_path(File.join(File.dirname(__FILE__), '../app')) | ||
|
||
describe "A controller's resource_service" do | ||
|
||
before do | ||
Forum.stub!(:gday) | ||
@controller = ForumsController.new | ||
@service = @controller.resource_service | ||
end | ||
|
||
it 'should pass unknown methods to the resource service of the controller' do | ||
Forum.should_receive(:gday) | ||
@service.gday | ||
end | ||
|
||
it 'may be explicitly set with #resource_service=' do | ||
@controller.resource_service = 'foo' | ||
@controller.resource_service.should == 'foo' | ||
end | ||
end |