Failed to pass arguments to controller method

View: New views
2 Messages — Rating Filter:   Alert me  

Failed to pass arguments to controller method

by Shaker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good morning to everyone:
    So weird!!
    I got a method called apply_settings(arg1, arg2) in the controller to be tested. In the controller spec, I of course called the method.
In the controller:
    def apply_settings(arg1, arg2) #where arg1 is a hash, and arg2 is an array of object
      #do some coding
    end
In the controller spec:
    before(:each) do
      @controller = Controller.new
    end
   
    it "should test the apply_settings" do
      @controller.apply_settings(Hash.new, array_of_object) #where the arguments are exactly some format
                                                                                 #as required
    end

However, it yielded "wrong number of arguments(0 for 1)" error after I ran the spec. It there anything wrong in my spec?
   
    Cheers!

Re: Failed to pass arguments to controller method

by David Chelimsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/7/07, Shaker <flyeminent@...> wrote:

>
> Good morning to everyone:
>     So weird!!
>     I got a method called apply_settings(arg1, arg2) in the controller to be
> tested. In the controller spec, I of course called the method.
> In the controller:
>     def apply_settings(arg1, arg2) #where arg1 is a hash, and arg2 is an
> array of object
>       #do some coding
>     end
> In the controller spec:
>     before(:each) do
>       @controller = Controller.new
>     end
>
>     it "should test the apply_settings" do
>       @controller.apply_settings(Hash.new, array_of_object) #where the
> arguments are exactly some format
>
> #as required
>     end
>
> However, it yielded "wrong number of arguments(0 for 1)" error after I ran
> the spec. It there anything wrong in my spec?

Difficult to say with the little bit of code you're posting. It would
be a lot easier to help if you posted the full code of the spec'd
method, the spec, and the resulting backtrace.
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users