[rspec-users] Rspec doesn't pickup the status code correctly.

J2M james2mccarthy at gmail.com
Sun Aug 3 17:41:55 EDT 2008


The failure message is;

should return conflict 409
expected: 409,
     got: 200 (using ==)

Yes it is nested and the rest of the setup is;

    before(:each) do
      request.env["HTTP_ACCEPT"] = "application/json"
      @account = mock_account
      @account.stub!(:valid?)
      Account.stub!(:new).and_return(@account)
      @errors = { 'login' => 'Not available, try another!' }
      @account.stub!(:errors).and_return( @errors )
      @json = {:this => 'that'}.to_json
      @format = mock("format", :json => @json )
      controller.stub!(:respond_to).and_yield(@format)
    end

Thanks.
James

On Aug 3, 9:19 pm, "Pat Maddox" <perg... at gmail.com> wrote:
> >      it "should return conflict 409" do
> >        do_post
> >        response.response_code.should == 409
> >      end
>
> What is the failure message?
>
> Also, it looks like your before block has not set Account.new to
> return @account, and that @account is nil.  Is this a nested describe,
> and there's some other setup happening elsewhere?
>
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list