~bkerensa/ubuntu/raring/puppet/new-upstream-release

« back to all changes in this revision

Viewing changes to spec/unit/network/http/webrick/rest_spec.rb

  • Committer: Benjamin Kerensa
  • Date: 2012-11-21 23:50:52 UTC
  • mfrom: (1.1.30)
  • Revision ID: bkerensa@ubuntu.com-20121121235052-ah7nzabp77sh69gb
New Upstream Release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env rspec
 
1
#! /usr/bin/env ruby
2
2
require 'spec_helper'
3
3
require 'puppet/network/http'
4
4
require 'webrick'
9
9
    Puppet::Network::HTTP::WEBrickREST.ancestors.should be_include(Puppet::Network::HTTP::Handler)
10
10
  end
11
11
 
12
 
  describe "when initializing", :'fails_on_ruby_1.9.2' => true do
 
12
  describe "when initializing" do
13
13
    it "should call the Handler's initialization hook with its provided arguments as the server and handler" do
14
 
      Puppet::Network::HTTP::WEBrickREST.any_instance.expects(:initialize_for_puppet).with(:server => "my", :handler => "arguments")
15
 
      Puppet::Network::HTTP::WEBrickREST.new("my", "arguments")
 
14
      server = WEBrick::HTTPServer.new(:BindAddress => '127.0.0.1',
 
15
                                       # Probablistically going to succeed
 
16
                                       # even if we run more than one test
 
17
                                       # instance at once.
 
18
                                       :Port        => 40000 + rand(10000),
 
19
                                       # Just discard any log output, thanks.
 
20
                                       :Logger      => stub_everything('logger'))
 
21
 
 
22
      Puppet::Network::HTTP::WEBrickREST.any_instance.
 
23
        expects(:initialize_for_puppet).with(:server => server, :handler => "arguments")
 
24
 
 
25
      Puppet::Network::HTTP::WEBrickREST.new(server, "arguments")
16
26
    end
17
27
  end
18
28