[rspec-users] <help> renders new/edit user_mst form

David Chelimsky dchelimsky at gmail.com
Mon Jun 10 09:57:28 UTC 2013

On Mon, Jun 10, 2013 at 4:39 AM, oliver <oliverjesus2008 at yahoo.com> wrote:

>   def new
>     @user_mst = UserMst.new
>     @group_mst = GroupMst.all

Under normal circumstances, this line ^^ would assign @group_mst an empty
collection, not nil, so something is wrong with the way things are set

What happens if you stub GroupMst.all in the spec:

    GroupMst.stub(:all => [])

Please try that and then run just one example like this:

    rspec spec/views/user_msts/new.html.erb_spec.rb:18 --backtrace

And then post the complete output.

>     respond_to do |format|
>       format.html # new.html.erb
>       format.xml  { render :xml => @user_mst }
>     end
>   end

Those are the lines I include @group_mst.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20130610/3e9a78e4/attachment.html>

More information about the rspec-users mailing list