On Thu, Nov 25, 2010 at 12:10 AM, Arun Sharma <li...@ruby-forum.com> wrote:
> thanks for reply
>
> my other methods in spec file it is working
> properly(index,edit,update...)
>
> but here it creates a probelm.bascially except CRUD opertion it is not
> working.
>
>  get :automatic_partitions,{:harddrive_id=>'sda',:server_id=>1938}
>         assigns[:prev_values].should==''
>
> i simply want to ask that is this right way to call a action and pass
> the value??
>
> please post the reply as soon as.I am waiting for reply

That seems like it should work, and the very first statement of the
controller action meets the expectation that is failing:

  # spec
  Cpanel.should_receive(:find).and_return(@prev_values)

  # controller
  @prev_values = Cpanel.find(:all, :conditions => [
    "harddrive_id = ? and server_id = ?",
    HARDDRIVE_SLOTS[params[:harddrive_id].to_i],
    params[:server_id]
  ])

I see the filters are stubbed in the before block. Try changing those
stubs to return true:

     controller.stub(:have_hard_drive?) { true }
     controller.stub(:is_cpanel_belongs_to_current_server?) { true }
     controller.stub(:authorized_user_to_server?) { true }

HTH,
David
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to