Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some specs for include_ations behaviour
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper')) | ||
|
||
module IncludeActionsSpec | ||
module Actions | ||
def foo; end | ||
def bar; end | ||
def faz; end | ||
end | ||
|
||
class ActionsController < ActionController::Base | ||
include_actions Actions | ||
end | ||
|
||
class OnlyFooController < ActionController::Base | ||
include_actions Actions, :only => :foo | ||
end | ||
|
||
class ExceptFooBarController < ActionController::Base | ||
include_actions Actions, :except => [:foo, :bar] | ||
end | ||
|
||
describe "Include actions use case" do | ||
it "ActionController should have actions from actions module" do | ||
ActionsController.action_methods.should == ['foo', 'bar', 'faz'].to_set | ||
end | ||
|
||
it "OnlyFooController should have only :foo from actions module" do | ||
OnlyFooController.action_methods.should == ['foo'].to_set | ||
end | ||
|
||
it "ExceptFooBarController should not have :foo, :bar from actions module" do | ||
ExceptFooBarController.action_methods.should == ['faz'].to_set | ||
end | ||
end | ||
end |