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.

Why should there be any difference between the two?

-- 
Posted via http://www.ruby-forum.com/.

-- 
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