差分

2009-12-31 57 views
0

我有以下RSpec的代碼:差分

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 

它成功地通過書面(RR語法註釋),但是當我切換到RR語法它失敗:

'ProjectsController創建一個新項目應該重定向到項目成功保存通知'失敗預期new_record?返回false,成立true

RR會失敗的兩個區別是什麼?

回答