Skip to content

Commit

Permalink
Add some specs for include_ations behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwhite committed Oct 13, 2008
1 parent 35fda33 commit 95fc678
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions spec/lib/include_actions_spec.rb
@@ -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

0 comments on commit 95fc678

Please sign in to comment.