[rspec-users] Can module spec "behave like" controller spec?

Shaker flyeminent at hotmail.com
Fri Aug 31 04:22:22 EDT 2007

Hello everyone:
    Right now I am writing spec on modules, which are provided by my
colleagues. Some of the modules actually contain action methods. I tried
very hard to spec those action methods in modules. But it seems that  the
rspec does not allow module spec to 'get' action like controller does. After
I saw the documentation, I then used :behaviour_type=>:controller. However,
it failed again. It reported an error for me. For illustration, I'd like a
simple example.
module MyModule
    def copy #an action method
        render :partial=>"/index", :layout=>false

describe MyModule, :behaviour_type=>:controller do
    it "should render partial index" do
        get 'copy' #test code not provided yet, just want to get the action
The error reported was: undefined method 'new' for MyModule:Module. Do you
guys have any idea of the error? And how should I test the action methods in

View this message in context: http://www.nabble.com/Can-module-spec-%22behave-like%22-controller-spec--tf4358891.html#a12422548
Sent from the rspec-users mailing list archive at Nabble.com.

More information about the rspec-users mailing list