From 95fc6785e19dd3dfed01a3066fa78b55a03dbeaa Mon Sep 17 00:00:00 2001 From: Ian White Date: Tue, 14 Oct 2008 09:05:11 +1100 Subject: [PATCH] Add some specs for include_ations behaviour --- spec/lib/include_actions_spec.rb | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 spec/lib/include_actions_spec.rb diff --git a/spec/lib/include_actions_spec.rb b/spec/lib/include_actions_spec.rb new file mode 100644 index 0000000..44a459a --- /dev/null +++ b/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