samuel 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "samuel"
8
- gem.version = "0.3.0"
8
+ gem.version = "0.3.1"
9
9
  gem.summary = %Q{An automatic logger for HTTP requests in Ruby}
10
10
  gem.description = %Q{An automatic logger for HTTP requests in Ruby, supporting the Net::HTTP and HTTPClient client libraries.}
11
11
  gem.email = "chris@kampers.net"
data/lib/samuel.rb CHANGED
@@ -13,7 +13,7 @@ require "samuel/log_entries/net_http"
13
13
  module Samuel
14
14
  extend self
15
15
 
16
- VERSION = "0.3.0"
16
+ VERSION = "0.3.1"
17
17
 
18
18
  attr_writer :logger, :config
19
19
 
@@ -34,8 +34,10 @@ module Samuel
34
34
  def label
35
35
  return Samuel.config[:label] if Samuel.config[:label]
36
36
 
37
- pair = Samuel.config[:labels].detect { |domain, label| host.include?(domain) }
38
- pair[1] if pair
37
+ default = lambda { ["", "HTTP"] }
38
+ Samuel.config[:labels].detect(default) { |domain, label|
39
+ host.include?(domain)
40
+ }[1]
39
41
  end
40
42
 
41
43
  def response_summary
data/samuel.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{samuel}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Chris Kampmeier"]
12
- s.date = %q{2010-01-01}
12
+ s.date = %q{2010-01-02}
13
13
  s.description = %q{An automatic logger for HTTP requests in Ruby, supporting the Net::HTTP and HTTPClient client libraries.}
14
14
  s.email = %q{chris@kampers.net}
15
15
  s.extra_rdoc_files = [
@@ -215,6 +215,15 @@ class RequestTest < Test::Unit::TestCase
215
215
  should_log_including "Example API request"
216
216
  end
217
217
 
218
+ context "with a global config including :labels => {'example.org' => 'Example API'} but making a request to example.com" do
219
+ setup do
220
+ FakeWeb.register_uri(:get, "http://example.com/test", :status => [200, "OK"])
221
+ Samuel.config[:labels] = {'example.org' => 'Example API'}
222
+ open "http://example.com/test"
223
+ end
224
+
225
+ should_log_including "HTTP request"
226
+ end
218
227
  end
219
228
 
220
229
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samuel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Kampmeier
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-01 00:00:00 -08:00
12
+ date: 2010-01-02 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency