loggable 0.2.0 → 0.3.0

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.
@@ -1,9 +1,9 @@
1
1
  class LoggerStub
2
2
 
3
3
  [:debug, :error, :fatal, :info, :warn].each do |method|
4
- define_method(method) do
5
- nil
6
- end
4
+ class_eval <<-CODE
5
+ def #{method}(message); nil; end
6
+ CODE
7
7
  end
8
8
 
9
9
  end
@@ -2,7 +2,7 @@ module Loggable
2
2
  module Version
3
3
 
4
4
  MAJOR = 0
5
- MINOR = 2
5
+ MINOR = 3
6
6
  TINY = 0
7
7
 
8
8
  def self.to_s # :nodoc:
@@ -8,47 +8,47 @@ end
8
8
 
9
9
  module MyModule; end
10
10
 
11
- describe "MyClass, with loggable mix-in" do
12
-
13
- before(:each) do
14
- @logger = mock()
15
- end
16
-
17
- after(:each) do
18
- MyClass.logger = nil
19
- end
20
-
21
- it "should have a logger stub by default" do
22
- MyClass.logger.should.be.an.instance_of(LoggerStub)
23
- end
24
-
25
- it "should not fail when an instance calls an uninitialized logger" do
26
- m = MyClass.new
27
- lambda { m.logged_method }.should.not.raise
28
- end
29
-
30
- it "should allow the asssignment of a logger" do
31
- MyClass.logger = @logger
32
- MyClass.logger.should.equal @logger
33
- end
34
-
35
- it "should allow access to the logger from an instance" do
36
- MyClass.logger = @logger
37
- MyClass.new.logger.should.equal @logger
38
- end
39
-
40
- end
11
+ class LogMethodsTest < Test::Unit::TestCase
12
+ context "An instance of MyClass, with loggable mix-in" do
13
+
14
+ setup { @logger = mock() }
15
+ teardown { MyClass.logger = nil}
16
+
17
+ should "have a logger stub by default" do
18
+ MyClass.logger.should be_kind_of(LoggerStub)
19
+ end
20
+
21
+ should "not fail when an instance calls an uninitialized logger" do
22
+ m = MyClass.new
23
+ lambda { m.logged_method }.should_not raise_error
24
+ end
25
+
26
+ should "allow the asssignment of a logger" do
27
+ MyClass.logger = @logger
28
+ MyClass.logger.should == @logger
29
+ end
30
+
31
+ should "allow access to the logger from an instance" do
32
+ MyClass.logger = @logger
33
+ MyClass.new.logger.should == @logger
34
+ end
41
35
 
42
- describe "MyModule, with loggable mix-in" do
43
-
44
- it "should have a logger stub by default" do
45
- MyModule.logger.should.be.an.instance_of(LoggerStub)
46
36
  end
47
-
48
- it "should be able to log messages" do
49
- logger = mock {|m| m.expects(:debug).with('blip') }
50
- MyModule.logger = logger
51
- MyModule.logger.debug('blip')
37
+
38
+ context "MyModule, with loggable mix-in" do
39
+
40
+ should "have a logger stub by default" do
41
+ MyModule.logger = nil
42
+ MyModule.logger.should be_kind_of(LoggerStub)
43
+ end
44
+
45
+ should "be able to log messages" do
46
+ logger = mock()
47
+ logger.expects(:debug).with('blip')
48
+
49
+ MyModule.logger = logger
50
+ MyModule.logger.debug('blip')
51
+ end
52
+
52
53
  end
53
-
54
54
  end
@@ -1,15 +1,15 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper'
2
2
 
3
- describe "LoggerStub" do
4
-
5
- before(:each) do
6
- @logger = LoggerStub.new
7
- end
8
-
9
- it "should return nil for all standard logging methods" do
10
- [:debug, :error, :fatal, :info, :warn].each do |method|
11
- @logger.send(method).should.be.nil
3
+ class LoggerStubTest < Test::Unit::TestCase
4
+ context "An instance of the LoggerStub class" do
5
+
6
+ setup { @logger = LoggerStub.new }
7
+
8
+ should "return nil for all standard logging methods" do
9
+ [:debug, :error, :fatal, :info, :warn].each do |method|
10
+ @logger.send(method, 'message').should be(nil)
11
+ end
12
12
  end
13
+
13
14
  end
14
-
15
15
  end
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
- require 'test/spec'
2
+ require 'test/unit'
3
3
  require 'mocha'
4
+ require 'shoulda'
5
+ require 'matchy'
4
6
 
5
7
  require File.dirname(__FILE__) + '/../lib/loggable'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loggable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Reagan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-21 00:00:00 -05:00
12
+ date: 2009-04-29 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,17 +24,17 @@ extra_rdoc_files:
24
24
  files:
25
25
  - README.rdoc
26
26
  - Rakefile
27
- - lib/loggable
28
27
  - lib/loggable/log_methods.rb
29
28
  - lib/loggable/logger_stub.rb
30
29
  - lib/loggable/version.rb
31
30
  - lib/loggable.rb
32
- - test/examples
33
31
  - test/examples/log_methods_test.rb
34
32
  - test/examples/logger_stub_test.rb
35
33
  - test/test_helper.rb
36
34
  has_rdoc: true
37
35
  homepage: http://viget.com/extend
36
+ licenses: []
37
+
38
38
  post_install_message:
39
39
  rdoc_options:
40
40
  - --main
@@ -56,9 +56,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  requirements: []
57
57
 
58
58
  rubyforge_project: viget
59
- rubygems_version: 1.3.1
59
+ rubygems_version: 1.3.2
60
60
  signing_key:
61
- specification_version: 2
61
+ specification_version: 3
62
62
  summary: A gem that provides logging capabilities to any class
63
63
  test_files: []
64
64