I have a module of custom examples, such as

module ControllerHelperMethods
        module MyExampleGroupMethods
                def should_set_the_body_id(body_id)
                        it "should set the body id to '#{body_id}'" do
                                assigns[:body_id].should == body_id
                        end
                end
        end

        def self.included(receiver)
                receiver.extend MyExampleGroupMethods
        end
end

and in spec_helper:

Spec::Runner.configure do |config|
        config.include(ControllerHelperMethods, :type => :controllers)
end

I have duplicate code in two of my custom examples, so I want to
refactor it to a private method, but I can't seem to get the private
method to work. I have tried the most obvious way (private keyword
followed by the method), and also a couple of more clever approaches
that involved doing an instance_eval in self.included.

First, should I be able to call private methods in my custom examples?
If so, how.

Peace.
Phillip
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to