summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/unit/network/http/mongrel/rest.rb12
-rw-r--r--spec/unit/network/http/webrick/rest.rb14
2 files changed, 4 insertions, 22 deletions
diff --git a/spec/unit/network/http/mongrel/rest.rb b/spec/unit/network/http/mongrel/rest.rb
index 3de314852..b483bbd46 100644
--- a/spec/unit/network/http/mongrel/rest.rb
+++ b/spec/unit/network/http/mongrel/rest.rb
@@ -73,7 +73,7 @@ describe Puppet::Network::HTTP::MongrelREST, "when receiving a request" do
'QUERY_STRING' => '' }.merge(params))
@mock_request.stubs(:body).returns('this is a fake request body')
@mock_model_instance = stub('indirected model instance', :save => true)
- @mock_model_class.stubs(:new).returns(@mock_model_instance)
+ @mock_model_class.stubs(:from_yaml).returns(@mock_model_instance)
end
def setup_bad_request
@@ -100,7 +100,7 @@ describe Puppet::Network::HTTP::MongrelREST, "when receiving a request" do
it "should call the model save method if the request represents an HTTP PUT" do
setup_save_request
- @mock_model_instance.expects(:save).with(:data => 'this is a fake request body')
+ @mock_model_instance.expects(:save)
@handler.process(@mock_request, @mock_response)
end
@@ -210,14 +210,6 @@ describe Puppet::Network::HTTP::MongrelREST, "when receiving a request" do
@handler.process(@mock_request, @mock_response)
end
- it "should pass HTTP request parameters to model save" do
- setup_save_request('QUERY_STRING' => 'foo=baz&bar=xyzzy')
- @mock_model_instance.expects(:save).with do |args|
- args[:data] == 'this is a fake request body' and args['foo'] == 'baz' and args['bar'] == 'xyzzy'
- end
- @handler.process(@mock_request, @mock_response)
- end
-
it "should generate a 200 response when a model save call succeeds" do
setup_save_request
@mock_response.expects(:start).with(200)
diff --git a/spec/unit/network/http/webrick/rest.rb b/spec/unit/network/http/webrick/rest.rb
index cdc1164fc..b7bd33880 100644
--- a/spec/unit/network/http/webrick/rest.rb
+++ b/spec/unit/network/http/webrick/rest.rb
@@ -64,7 +64,7 @@ describe Puppet::Network::HTTP::WEBrickREST, "when receiving a request" do
@mock_request.stubs(:path).returns('/foo')
@mock_request.stubs(:body).returns('This is a fake request body')
@mock_model_instance = stub('indirected model instance', :save => true)
- @mock_model_class.stubs(:new).returns(@mock_model_instance)
+ @mock_model_class.stubs(:from_yaml).returns(@mock_model_instance)
end
def setup_bad_request
@@ -93,8 +93,7 @@ describe Puppet::Network::HTTP::WEBrickREST, "when receiving a request" do
it "should call the model save method if the request represents an HTTP PUT" do
setup_save_request
- @mock_model_instance.expects(:save).with(:data => 'This is a fake request body')
- @mock_model_class.expects(:new).returns(@mock_model_instance)
+ @mock_model_instance.expects(:save)
@handler.service(@mock_request, @mock_response)
end
@@ -212,15 +211,6 @@ describe Puppet::Network::HTTP::WEBrickREST, "when receiving a request" do
@handler.process(@mock_request, @mock_response)
end
- it "should pass HTTP request parameters to model save" do
- setup_save_request
- @mock_request.stubs(:query).returns(:foo => :baz, :bar => :xyzzy)
- @mock_model_instance.expects(:save).with do |args|
- args[:data] == 'This is a fake request body' and args[:foo] == :baz and args[:bar] == :xyzzy
- end
- @handler.service(@mock_request, @mock_response)
- end
-
it "should generate a 200 response when a model save call succeeds" do
setup_save_request
@mock_response.expects(:status=).with(200)