views:

390

answers:

1

I have the following rspec code:

require 'spec_helper'
require 'mocha'
require 'rr'

describe ProjectsController, "creating a new project" do
  integrate_views

  it "should redirect to project with a notice on successful save" do
    Project.any_instance.stubs(:valid?).returns(true)
    #mock.instance_of(Project).valid? {true}
    Project.any_instance.stubs(:create_default_packets)
    #mock.instance_of(Project).create_default_packets
    post 'create'
    assigns[:project].should_not be_new_record
  end
end

It passes successfully as written (RR syntax commented out) but when I switch to the RR syntax it fails with:

'ProjectsController creating a new project should redirect to project with a notice on successful save' FAILED expected new_record? to return false, got true

What is the difference between the two that RR would fail?

A: 

It appears the difference is that you can't call instance_of twice with rr. See the following git issue: http://github.com/btakita/rr/issues#issue/17

Jason