ungulate 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/ungulate/job.rb CHANGED
@@ -95,10 +95,9 @@ module Ungulate
95
95
 
96
96
  url = URI.parse(notification_url)
97
97
 
98
- Net::HTTP.start(url.host) do |http|
99
- http.use_ssl = true if url.scheme == 'https'
100
- http.put(url.path, nil)
101
- end
98
+ http = Net::HTTP.new(url.host, url.port)
99
+ http.use_ssl = true if url.scheme == 'https'
100
+ http.start {|http| http.put(url.path, nil) }
102
101
  end
103
102
 
104
103
  def version_key(version)
@@ -235,7 +235,8 @@ module Ungulate
235
235
  describe :send_notification do
236
236
  after { subject.send_notification }
237
237
 
238
- let(:http) { mock('Net::HTTP', :put => nil, :use_ssl= => nil) }
238
+ let(:http_instance) { mock('Net::HTTP', :start => nil) }
239
+ let(:http_block_instance) { mock('Net::HTTP', :put => nil) }
239
240
 
240
241
  context "notification URL provided" do
241
242
  before do
@@ -243,24 +244,27 @@ module Ungulate
243
244
  end
244
245
 
245
246
  it "should PUT to the URL" do
246
- Net::HTTP.stub(:start).with('some.host').and_yield(http)
247
- http.should_receive(:put).with('/processing_images/some/path', nil)
247
+ Net::HTTP.should_receive(:new).with('some.host', 80).and_return(http_instance)
248
+ http_instance.should_receive(:start).and_yield(http_block_instance)
249
+ http_block_instance.should_receive(:put).with('/processing_images/some/path', nil)
248
250
  end
249
251
  end
250
252
 
251
253
  context "https notification URL provided" do
252
254
  before do
253
255
  subject.stub(:notification_url).and_return('https://some.host/processing_images/some/path')
256
+ http_instance.stub(:use_ssl=)
254
257
  end
255
258
 
256
259
  it "should PUT to the URL" do
257
- Net::HTTP.stub(:start).with('some.host').and_yield(http)
258
- http.should_receive(:put).with('/processing_images/some/path', nil)
260
+ Net::HTTP.should_receive(:new).with('some.host', 443).and_return(http_instance)
261
+ http_instance.should_receive(:start).and_yield(http_block_instance)
262
+ http_block_instance.should_receive(:put).with('/processing_images/some/path', nil)
259
263
  end
260
264
 
261
265
  it "should use SSL" do
262
- Net::HTTP.stub(:start).with('some.host').and_yield(http)
263
- http.should_receive(:use_ssl=).with(true)
266
+ Net::HTTP.should_receive(:new).with('some.host', 443).and_return(http_instance)
267
+ http_instance.should_receive(:use_ssl=).with(true)
264
268
  end
265
269
  end
266
270
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ungulate
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Bruce