litmus_paper 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ module LitmusPaper
26
26
  def _make_request
27
27
  uri = URI.parse(@uri)
28
28
  request = Net::HTTP.const_get(@method.capitalize).new(uri.normalize.path)
29
- request.initialize_http_header({"User-Agent" => "Litmus Paper/#{LitmusPaper::VERSION}"})
29
+ request["User-Agent"] = "Litmus Paper/#{LitmusPaper::VERSION}"
30
30
  request.set_form_data({})
31
31
  request.basic_auth(uri.user, uri.password) if uri.user || uri.password
32
32
 
@@ -1,3 +1,3 @@
1
1
  module LitmusPaper
2
- VERSION = "0.7.3"
2
+ VERSION = "0.7.4"
3
3
  end
@@ -21,8 +21,13 @@ describe LitmusPaper::Dependency::HTTP do
21
21
  check.should be_available
22
22
  end
23
23
 
24
- it "sends a user agent including the version number" do
25
- check = LitmusPaper::Dependency::HTTP.new("#{@url}/fail_if_no_agent", :method => "GET", :content => "OK")
24
+ it "sends an accept header" do
25
+ check = LitmusPaper::Dependency::HTTP.new("#{@url}/echo_accept", :method => "GET", :content => Regexp.escape("*/*"))
26
+ check.should be_available
27
+ end
28
+
29
+ it "sends a user agent" do
30
+ check = LitmusPaper::Dependency::HTTP.new("#{@url}/echo_agent", :method => "GET", :content => "Litmus Paper")
26
31
  check.should be_available
27
32
  end
28
33
  end
@@ -9,12 +9,12 @@ class HttpTestServer < Sinatra::Base
9
9
  text 200, "POST"
10
10
  end
11
11
 
12
- get "/fail_if_no_agent" do
13
- if request.user_agent.nil?
14
- text 400, "No user agent"
15
- else
16
- text 200, "OK"
17
- end
12
+ get "/echo_accept" do
13
+ text 200, request.accept.first
14
+ end
15
+
16
+ get "/echo_agent" do
17
+ text 200, request.user_agent
18
18
  end
19
19
 
20
20
  get "/status/:response_status" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litmus_paper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 3
10
- version: 0.7.3
9
+ - 4
10
+ version: 0.7.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Braintreeps
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-24 00:00:00 -06:00
18
+ date: 2013-01-25 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency