test/emulate_test.rb in sinatra-backbone-0.1.0.rc2 vs test/emulate_test.rb in sinatra-backbone-0.1.1

- old
+ new

@@ -1,14 +1,15 @@ require File.expand_path('../test_helper', __FILE__) +require 'ostruct' class EmulateTest < UnitTest class App < Sinatra::Base register Sinatra::RestAPI disable :show_exceptions enable :raise_errors - rest_resource("/api/:id") { |id| FauxModel.new id } + rest_resource("/api/:id") { |id| FauxModel.new } end def app() App; end setup do @@ -16,9 +17,10 @@ end test "emulate json and emulate http" do FauxModel.any_instance.expects(:two=).times(1).returns(true) FauxModel.any_instance.expects(:save).times(1).returns(true) + FauxModel.any_instance.expects(:valid?).times(1).returns(true) FauxModel.any_instance.expects(:to_hash).times(1).returns('a' => 'b') post "/api/2", :model => { :two => 2 }.to_json assert json_response == { 'a' => 'b' } end