On 6 April 2012 01:10, Fearless Fool <li...@ruby-forum.com> wrote:
> MORE UPDATE: I beefed up the tests to look at the return code, the # of
> Premises generated and the assignment.  And things only got stranger:
>
>
>  context "POST create" do
>
>    context "with user logged in" do
>      before(:each) do
>        @user = mock_model(User, :admin? => false, :guest? => false)
>        controller.stub(:current_user) { @user } # aka login
>        @attributes = valid_attributes
>      end
>
>      it "should create a new Premise" do
>        count = Premise.count
>        post(:create, {:premise => @attributes}, :format => :json)
>        Premise.count.should == count + 1
>        response.message.should == "OK"
>        assigns(:premise).should be_instance_of(Premise)
>      end
>
>      it "should create a new Premise again" do
>        count = Premise.count
>        post(:create, {:premise => @attributes}, :format => :json)
>        Premise.count.should == count + 1
>        response.message.should == "OK"
>        assigns(:premise).should be_instance_of(Premise)
>      end
>
>    end
>  end
>
> NOW what happens:
>
> - the first test fails with response.message = "Not Acceptable"
> - the second test fails because count is not incremented.

First look in test.log to see if there is any difference there, if
still no joy then debug the create action to see what is going on.
Look at the Rails Guide on Debugging if you don't know how to do this.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to