summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorRick Bradley <rick@rickbradley.com>2008-04-02 20:28:57 -0500
committerLuke Kanies <luke@madstop.com>2008-04-11 13:11:28 -0500
commit9187a347306f547805c175b1f288a97da721cc11 (patch)
tree5385ffb74290b7d70b041fdc047b4c4d600cebf3 /spec
parent93bc1a946f2da6e7c78a38ff90dac8a20b1bcbc7 (diff)
downloadpuppet-9187a347306f547805c175b1f288a97da721cc11.tar.gz
puppet-9187a347306f547805c175b1f288a97da721cc11.tar.xz
puppet-9187a347306f547805c175b1f288a97da721cc11.zip
updating mongrel/webrick unit tests to match integration-tested version of REST save functionality
Diffstat (limited to 'spec')
-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)