fozzie 1.0.2 → 1.0.3

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.
Files changed (41) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +5 -5
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +5 -5
  6. data/Gemfile +3 -3
  7. data/README.md +288 -276
  8. data/Rakefile +6 -6
  9. data/fozzie.gemspec +29 -29
  10. data/fozzie.yml.example +14 -14
  11. data/lib/core_ext/hash/symbolize_keys.rb +21 -21
  12. data/lib/core_ext/module/alias_method_chain.rb +19 -19
  13. data/lib/core_ext/module/monitor.rb +12 -12
  14. data/lib/core_ext/string/snakecase.rb +9 -9
  15. data/lib/fozzie.rb +67 -67
  16. data/lib/fozzie/adapter/statsd.rb +95 -95
  17. data/lib/fozzie/bulk_dsl.rb +27 -27
  18. data/lib/fozzie/configuration.rb +1 -0
  19. data/lib/fozzie/dsl.rb +18 -18
  20. data/lib/fozzie/exception.rb +4 -4
  21. data/lib/fozzie/interface.rb +139 -139
  22. data/lib/fozzie/rack/middleware.rb +43 -43
  23. data/lib/fozzie/sniff.rb +49 -49
  24. data/lib/fozzie/version.rb +3 -3
  25. data/resources/mill.js.example +26 -26
  26. data/spec/config/fozzie.yml +5 -5
  27. data/spec/lib/core_ext/module/monitor_spec.rb +8 -8
  28. data/spec/lib/fozzie/adapter/statsd_spec.rb +82 -82
  29. data/spec/lib/fozzie/bulk_dsl_spec.rb +46 -46
  30. data/spec/lib/fozzie/configuration_spec.rb +125 -125
  31. data/spec/lib/fozzie/dsl_spec.rb +15 -15
  32. data/spec/lib/fozzie/rack/middleware_spec.rb +69 -69
  33. data/spec/lib/fozzie/rack/sinatra_spec.rb +30 -30
  34. data/spec/lib/fozzie/sniff_spec.rb +131 -131
  35. data/spec/lib/fozzie/version_spec.rb +9 -9
  36. data/spec/lib/fozzie_spec.rb +39 -39
  37. data/spec/shared_examples/fozzie_adapter.rb +7 -7
  38. data/spec/shared_examples/interface.rb +159 -159
  39. data/spec/spec_helper.rb +28 -28
  40. metadata +24 -36
  41. data/.rvmrc +0 -1
@@ -1,131 +1,131 @@
1
- require 'spec_helper'
2
- require 'fozzie/sniff'
3
-
4
- describe Fozzie::Sniff do
5
- let(:klass) do
6
- class FooBar
7
-
8
- _monitor
9
- def self.bar!; :bar end
10
-
11
- _monitor
12
- def self.koala(hsh = {}); hsh end
13
-
14
- def self.badger; :cares end
15
-
16
- _monitor("my.awesome.class.bucket.name")
17
- def self.class_method_with_non_default_bucket_name; true; end
18
-
19
- _monitor
20
- def foo; :foo; end
21
-
22
- _monitor("my.awesome.bucket.name")
23
- def method_with_non_default_bucket_name; true; end
24
-
25
- _monitor
26
- def sloth(a, b, c); [a,b,c] end
27
-
28
- def honeybadger; :dontcare end
29
-
30
- _monitor
31
- def method_yielding_to_block
32
- yield(:retval_from_block) if block_given?
33
- end
34
-
35
- _monitor
36
- def self.class_method_yielding_to_block
37
- yield(:retval_from_block) if block_given?
38
- end
39
- end
40
-
41
- FooBar
42
- end
43
-
44
- # Turn on sniffing for the duration of this spec
45
- before(:all) do
46
- Fozzie.c.sniff_envs << :test
47
- end
48
-
49
- after(:all) do
50
- Fozzie.c.sniff_envs.delete(:test)
51
- end
52
-
53
- context 'class methods' do
54
- subject { klass }
55
-
56
- it "aliases methods for monitoring" do
57
- subject.methods.grep(/bar/).should =~ [:bar!, :"bar_with_monitor!", :"bar_without_monitor!"]
58
- end
59
-
60
- it "behaves like original" do
61
- subject.bar!.should eq :bar
62
- end
63
-
64
- it "utilises Fozzie" do
65
- S.should_receive(:time_for).with(['foo_bar', 'bar!'])
66
-
67
- subject.bar!
68
- end
69
-
70
- it "handles arguments" do
71
- h = { drop: 'bear' }
72
- subject.koala(h).should eq h
73
- end
74
-
75
- it "does not monitor when mapped" do
76
- S.should_receive(:time_for).with(['foo_bar', 'badger']).never
77
-
78
- subject.badger.should eq :cares
79
- end
80
-
81
- it "optionally sets the bucket name" do
82
- S.should_receive(:time_for).with("my.awesome.class.bucket.name")
83
-
84
- subject.class_method_with_non_default_bucket_name
85
- end
86
-
87
-
88
- it "yields to a block when given" do
89
- subject.class_method_yielding_to_block {|val| val }.should eq :retval_from_block
90
- end
91
- end
92
-
93
- context 'instance methods' do
94
- subject { klass.new }
95
-
96
- it "aliases methods for monitoring" do
97
- subject.methods.grep(/foo/).should =~ [:foo, :foo_with_monitor, :foo_without_monitor]
98
- end
99
-
100
- it "behaves like original" do
101
- subject.foo.should eq :foo
102
- end
103
-
104
- it "utilises Fozzie" do
105
- S.should_receive(:time_for).with(['foo_bar', 'foo'])
106
-
107
- subject.foo
108
- end
109
-
110
- it "optionally sets the bucket name" do
111
- S.should_receive(:time_for).with("my.awesome.bucket.name")
112
-
113
- subject.method_with_non_default_bucket_name
114
- end
115
-
116
- it "handles arguments" do
117
- a = [:slow, :slower, :slowest]
118
- subject.sloth(*a).should eq a
119
- end
120
-
121
- it "does not monitor when mapped" do
122
- S.should_receive(:time_for).with(['foo_bar', 'honeybadger']).never
123
-
124
- subject.honeybadger.should eq :dontcare
125
- end
126
-
127
- it "yields to a block when given" do
128
- subject.method_yielding_to_block {|val| val }.should eq :retval_from_block
129
- end
130
- end
131
- end
1
+ require 'spec_helper'
2
+ require 'fozzie/sniff'
3
+
4
+ describe Fozzie::Sniff do
5
+ let(:klass) do
6
+ class FooBar
7
+
8
+ _monitor
9
+ def self.bar!; :bar end
10
+
11
+ _monitor
12
+ def self.koala(hsh = {}); hsh end
13
+
14
+ def self.badger; :cares end
15
+
16
+ _monitor("my.awesome.class.bucket.name")
17
+ def self.class_method_with_non_default_bucket_name; true; end
18
+
19
+ _monitor
20
+ def foo; :foo; end
21
+
22
+ _monitor("my.awesome.bucket.name")
23
+ def method_with_non_default_bucket_name; true; end
24
+
25
+ _monitor
26
+ def sloth(a, b, c); [a,b,c] end
27
+
28
+ def honeybadger; :dontcare end
29
+
30
+ _monitor
31
+ def method_yielding_to_block
32
+ yield(:retval_from_block) if block_given?
33
+ end
34
+
35
+ _monitor
36
+ def self.class_method_yielding_to_block
37
+ yield(:retval_from_block) if block_given?
38
+ end
39
+ end
40
+
41
+ FooBar
42
+ end
43
+
44
+ # Turn on sniffing for the duration of this spec
45
+ before(:all) do
46
+ Fozzie.c.sniff_envs << :test
47
+ end
48
+
49
+ after(:all) do
50
+ Fozzie.c.sniff_envs.delete(:test)
51
+ end
52
+
53
+ context 'class methods' do
54
+ subject { klass }
55
+
56
+ it "aliases methods for monitoring" do
57
+ subject.methods.grep(/bar/).should =~ [:bar!, :"bar_with_monitor!", :"bar_without_monitor!"]
58
+ end
59
+
60
+ it "behaves like original" do
61
+ subject.bar!.should eq :bar
62
+ end
63
+
64
+ it "utilises Fozzie" do
65
+ S.should_receive(:time_for).with(['foo_bar', 'bar!'])
66
+
67
+ subject.bar!
68
+ end
69
+
70
+ it "handles arguments" do
71
+ h = { drop: 'bear' }
72
+ subject.koala(h).should eq h
73
+ end
74
+
75
+ it "does not monitor when mapped" do
76
+ S.should_receive(:time_for).with(['foo_bar', 'badger']).never
77
+
78
+ subject.badger.should eq :cares
79
+ end
80
+
81
+ it "optionally sets the bucket name" do
82
+ S.should_receive(:time_for).with("my.awesome.class.bucket.name")
83
+
84
+ subject.class_method_with_non_default_bucket_name
85
+ end
86
+
87
+
88
+ it "yields to a block when given" do
89
+ subject.class_method_yielding_to_block {|val| val }.should eq :retval_from_block
90
+ end
91
+ end
92
+
93
+ context 'instance methods' do
94
+ subject { klass.new }
95
+
96
+ it "aliases methods for monitoring" do
97
+ subject.methods.grep(/foo/).should =~ [:foo, :foo_with_monitor, :foo_without_monitor]
98
+ end
99
+
100
+ it "behaves like original" do
101
+ subject.foo.should eq :foo
102
+ end
103
+
104
+ it "utilises Fozzie" do
105
+ S.should_receive(:time_for).with(['foo_bar', 'foo'])
106
+
107
+ subject.foo
108
+ end
109
+
110
+ it "optionally sets the bucket name" do
111
+ S.should_receive(:time_for).with("my.awesome.bucket.name")
112
+
113
+ subject.method_with_non_default_bucket_name
114
+ end
115
+
116
+ it "handles arguments" do
117
+ a = [:slow, :slower, :slowest]
118
+ subject.sloth(*a).should eq a
119
+ end
120
+
121
+ it "does not monitor when mapped" do
122
+ S.should_receive(:time_for).with(['foo_bar', 'honeybadger']).never
123
+
124
+ subject.honeybadger.should eq :dontcare
125
+ end
126
+
127
+ it "yields to a block when given" do
128
+ subject.method_yielding_to_block {|val| val }.should eq :retval_from_block
129
+ end
130
+ end
131
+ end
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
2
-
3
- describe "Fozzie Version" do
4
-
5
- it "is correct formatted" do
6
- Fozzie::VERSION.should be_kind_of(String)
7
- Fozzie::VERSION.should match(/\d{1,3}?\.?/)
8
- end
9
-
1
+ require 'spec_helper'
2
+
3
+ describe "Fozzie Version" do
4
+
5
+ it "is correct formatted" do
6
+ Fozzie::VERSION.should be_kind_of(String)
7
+ Fozzie::VERSION.should match(/\d{1,3}?\.?/)
8
+ end
9
+
10
10
  end
@@ -1,39 +1,39 @@
1
- require 'spec_helper'
2
- require 'logger'
3
-
4
- describe Fozzie do
5
- it "allows dynamic assignment" do
6
- { :host => 'somewhere.local', :port => 99 }.each do |field, val|
7
- Fozzie.configure {|c| c.send("#{field}=", val) }
8
- Fozzie.c.send(field).should == val
9
- end
10
- end
11
-
12
- describe ".logger" do
13
- let(:logger) { double "logger" }
14
-
15
- before do
16
- @old_logger = Fozzie.logger
17
- end
18
-
19
- it "assigns a logger" do
20
- Fozzie.logger = logger
21
- Fozzie.logger.should eq logger
22
- end
23
-
24
- after do
25
- Fozzie.logger = @old_logger
26
- end
27
- end
28
-
29
- it "has configuration" do
30
- Fozzie.config.should be_kind_of(Fozzie::Configuration)
31
- Fozzie.c.should be_kind_of(Fozzie::Configuration)
32
- end
33
-
34
- it "creates new classes for statistics gathering" do
35
- Fozzie.c.namespaces.each do |k|
36
- Kernel.const_defined?(k).should == true
37
- end
38
- end
39
- end
1
+ require 'spec_helper'
2
+ require 'logger'
3
+
4
+ describe Fozzie do
5
+ it "allows dynamic assignment" do
6
+ { :host => 'somewhere.local', :port => 99 }.each do |field, val|
7
+ Fozzie.configure {|c| c.send("#{field}=", val) }
8
+ Fozzie.c.send(field).should == val
9
+ end
10
+ end
11
+
12
+ describe ".logger" do
13
+ let(:logger) { double "logger" }
14
+
15
+ before do
16
+ @old_logger = Fozzie.logger
17
+ end
18
+
19
+ it "assigns a logger" do
20
+ Fozzie.logger = logger
21
+ Fozzie.logger.should eq logger
22
+ end
23
+
24
+ after do
25
+ Fozzie.logger = @old_logger
26
+ end
27
+ end
28
+
29
+ it "has configuration" do
30
+ Fozzie.config.should be_kind_of(Fozzie::Configuration)
31
+ Fozzie.c.should be_kind_of(Fozzie::Configuration)
32
+ end
33
+
34
+ it "creates new classes for statistics gathering" do
35
+ Fozzie.c.namespaces.each do |k|
36
+ Kernel.const_defined?(k).should == true
37
+ end
38
+ end
39
+ end
@@ -1,7 +1,7 @@
1
- shared_examples_for "fozzie adapter" do
2
-
3
- it { should respond_to(:register) }
4
-
5
- it { should respond_to(:delimeter) }
6
-
7
- end
1
+ shared_examples_for "fozzie adapter" do
2
+
3
+ it { should respond_to(:register) }
4
+
5
+ it { should respond_to(:delimeter) }
6
+
7
+ end
@@ -1,160 +1,160 @@
1
- shared_examples "interface" do
2
-
3
- it "#increment" do
4
- subject.should_receive(:send).with('wat', 1, :count, 1)
5
- subject.increment 'wat'
6
- end
7
-
8
- it "#decrement" do
9
- subject.should_receive(:send).with('wat', -1, :count, 1)
10
- subject.decrement 'wat'
11
- end
12
-
13
- it "#count" do
14
- subject.should_receive(:send).with('wat', 5, :count, 1)
15
- subject.count 'wat', 5
16
- end
17
-
18
- it "#timing" do
19
- subject.should_receive(:send).with('wat', 500, :timing, 1)
20
- subject.timing 'wat', 500
21
- end
22
-
23
- it "times a given block" do
24
- subject.should_receive(:timing).with do |b, val, timing|
25
- b == 'data.bin' && (1..11).include?(val)
26
- end.exactly(3).times
27
-
28
- subject.time_for('data.bin') { sleep 0.01 }
29
- subject.time_to_do('data.bin') { sleep 0.01 }
30
- subject.time('data.bin') { sleep 0.01 }
31
- end
32
-
33
- describe "event" do
34
- it "for a commit" do
35
- subject.should_receive(:gauge).with(['event', 'commit', nil], anything).twice
36
- subject.commit
37
- subject.committed
38
- end
39
-
40
- it "for a build" do
41
- subject.should_receive(:gauge).with(['event', 'build', nil], anything).twice
42
- subject.build
43
- subject.built
44
- end
45
-
46
- it "for a deploy" do
47
- subject.should_receive(:gauge).with(['event', 'deploy', nil], anything).twice
48
- subject.deploy
49
- subject.deployed
50
- end
51
-
52
- it "for anything" do
53
- subject.should_receive(:send).with(['event', 'foo', nil], anything, :gauge, 1)
54
- subject.event 'foo'
55
- end
56
-
57
- it "accepts an app name" do
58
- subject.should_receive(:send).with(['event', 'foo', 'fozzie'], anything, :gauge, 1)
59
- subject.event 'foo', 'fozzie'
60
- end
61
- end
62
-
63
- describe "#increment_on" do
64
- it "registers success" do
65
- subject.should_receive(:increment).with(["event.increment", "success"], 1)
66
- subject.increment_on('event.increment', true).should == true
67
- end
68
-
69
- it "registers failure" do
70
- subject.should_receive(:increment).with(["event.increment", "fail"], 1)
71
- subject.increment_on('event.increment', false).should == false
72
- end
73
-
74
- it "simply questions the passed val with if" do
75
- a = double
76
- a.should_receive(:save).and_return({})
77
- subject.should_receive(:increment).with(["event.increment", "success"], 1)
78
- subject.increment_on('event.increment', a.save).should == {}
79
- end
80
-
81
- it "registers fail on nil return" do
82
- a = double
83
- a.should_receive(:save).and_return(nil)
84
- subject.should_receive(:increment).with(["event.increment", "fail"], 1)
85
- subject.increment_on('event.increment', a.save).should == nil
86
- end
87
-
88
- describe "performing actions" do
89
- it "registers success" do
90
- a = double
91
- a.should_receive(:save).and_return(true)
92
- subject.should_receive(:increment).with(["event.increment", "success"], 1)
93
- subject.increment_on('event.increment', a.save).should == true
94
- end
95
-
96
- it "registers failure" do
97
- a = double
98
- a.should_receive(:save).and_return(false)
99
- subject.should_receive(:increment).with(["event.increment", "fail"], 1)
100
- subject.increment_on('event.increment', a.save).should == false
101
- end
102
-
103
- it "registers positive even when nested" do
104
- a = double
105
- a.should_receive(:save).and_return(true)
106
- subject.should_receive(:timing).with('event.run', anything, anything)
107
- subject.should_receive(:increment).with(["event.increment", "success"], 1)
108
-
109
- res = subject.time_to_do "event.run" do
110
- subject.increment_on('event.increment', a.save)
111
- end
112
- res.should == true
113
- end
114
-
115
- it "registers negative even when nested" do
116
- a = double
117
- a.should_receive(:save).and_return(false)
118
- subject.should_receive(:timing).with('event.run', anything, anything)
119
- subject.should_receive(:increment).with(["event.increment", "fail"], 1)
120
-
121
- res = subject.time_to_do "event.run" do
122
- subject.increment_on('event.increment', a.save)
123
- end
124
- res.should == false
125
- end
126
- end
127
- end
128
-
129
- describe "#bulk" do
130
-
131
- it "registers statistics in a single call" do
132
- Fozzie.c.adapter.should_receive(:register).once
133
-
134
- subject.bulk do
135
- increment :foo
136
- decrement :bar
137
- end
138
- end
139
-
140
- end
141
-
142
- it "registers a gauge measurement" do
143
- subject.should_receive(:send).with("mystat", 99, :gauge, 1)
144
- subject.gauge("mystat", 99)
145
- end
146
-
147
- it "raises exception if natural exception from block" do
148
- proc { subject.time_to_do('data.bin', 1, :gauge, 1) { raise ArgumentError, "testing" } }.should raise_error(ArgumentError)
149
- end
150
-
151
- it "only calls the block once on error" do
152
- Fozzie.c.adapter.stub(:send) { raise SocketError }
153
- i = 0
154
- p = proc {|n| (n + 1) }
155
- val = subject.time_to_do('data.bin') { i+= p.call(i) }
156
-
157
- val.should == 1
158
- end
159
-
1
+ shared_examples "interface" do
2
+
3
+ it "#increment" do
4
+ subject.should_receive(:send).with('wat', 1, :count, 1)
5
+ subject.increment 'wat'
6
+ end
7
+
8
+ it "#decrement" do
9
+ subject.should_receive(:send).with('wat', -1, :count, 1)
10
+ subject.decrement 'wat'
11
+ end
12
+
13
+ it "#count" do
14
+ subject.should_receive(:send).with('wat', 5, :count, 1)
15
+ subject.count 'wat', 5
16
+ end
17
+
18
+ it "#timing" do
19
+ subject.should_receive(:send).with('wat', 500, :timing, 1)
20
+ subject.timing 'wat', 500
21
+ end
22
+
23
+ it "times a given block" do
24
+ subject.should_receive(:timing).with do |b, val, timing|
25
+ b == 'data.bin' && (1..11).include?(val)
26
+ end.exactly(3).times
27
+
28
+ subject.time_for('data.bin') { sleep 0.01 }
29
+ subject.time_to_do('data.bin') { sleep 0.01 }
30
+ subject.time('data.bin') { sleep 0.01 }
31
+ end
32
+
33
+ describe "event" do
34
+ it "for a commit" do
35
+ subject.should_receive(:gauge).with(['event', 'commit', nil], anything).twice
36
+ subject.commit
37
+ subject.committed
38
+ end
39
+
40
+ it "for a build" do
41
+ subject.should_receive(:gauge).with(['event', 'build', nil], anything).twice
42
+ subject.build
43
+ subject.built
44
+ end
45
+
46
+ it "for a deploy" do
47
+ subject.should_receive(:gauge).with(['event', 'deploy', nil], anything).twice
48
+ subject.deploy
49
+ subject.deployed
50
+ end
51
+
52
+ it "for anything" do
53
+ subject.should_receive(:send).with(['event', 'foo', nil], anything, :gauge, 1)
54
+ subject.event 'foo'
55
+ end
56
+
57
+ it "accepts an app name" do
58
+ subject.should_receive(:send).with(['event', 'foo', 'fozzie'], anything, :gauge, 1)
59
+ subject.event 'foo', 'fozzie'
60
+ end
61
+ end
62
+
63
+ describe "#increment_on" do
64
+ it "registers success" do
65
+ subject.should_receive(:increment).with(["event.increment", "success"], 1)
66
+ subject.increment_on('event.increment', true).should == true
67
+ end
68
+
69
+ it "registers failure" do
70
+ subject.should_receive(:increment).with(["event.increment", "fail"], 1)
71
+ subject.increment_on('event.increment', false).should == false
72
+ end
73
+
74
+ it "simply questions the passed val with if" do
75
+ a = double
76
+ a.should_receive(:save).and_return({})
77
+ subject.should_receive(:increment).with(["event.increment", "success"], 1)
78
+ subject.increment_on('event.increment', a.save).should == {}
79
+ end
80
+
81
+ it "registers fail on nil return" do
82
+ a = double
83
+ a.should_receive(:save).and_return(nil)
84
+ subject.should_receive(:increment).with(["event.increment", "fail"], 1)
85
+ subject.increment_on('event.increment', a.save).should == nil
86
+ end
87
+
88
+ describe "performing actions" do
89
+ it "registers success" do
90
+ a = double
91
+ a.should_receive(:save).and_return(true)
92
+ subject.should_receive(:increment).with(["event.increment", "success"], 1)
93
+ subject.increment_on('event.increment', a.save).should == true
94
+ end
95
+
96
+ it "registers failure" do
97
+ a = double
98
+ a.should_receive(:save).and_return(false)
99
+ subject.should_receive(:increment).with(["event.increment", "fail"], 1)
100
+ subject.increment_on('event.increment', a.save).should == false
101
+ end
102
+
103
+ it "registers positive even when nested" do
104
+ a = double
105
+ a.should_receive(:save).and_return(true)
106
+ subject.should_receive(:timing).with('event.run', anything, anything)
107
+ subject.should_receive(:increment).with(["event.increment", "success"], 1)
108
+
109
+ res = subject.time_to_do "event.run" do
110
+ subject.increment_on('event.increment', a.save)
111
+ end
112
+ res.should == true
113
+ end
114
+
115
+ it "registers negative even when nested" do
116
+ a = double
117
+ a.should_receive(:save).and_return(false)
118
+ subject.should_receive(:timing).with('event.run', anything, anything)
119
+ subject.should_receive(:increment).with(["event.increment", "fail"], 1)
120
+
121
+ res = subject.time_to_do "event.run" do
122
+ subject.increment_on('event.increment', a.save)
123
+ end
124
+ res.should == false
125
+ end
126
+ end
127
+ end
128
+
129
+ describe "#bulk" do
130
+
131
+ it "registers statistics in a single call" do
132
+ Fozzie.c.adapter.should_receive(:register).once
133
+
134
+ subject.bulk do
135
+ increment :foo
136
+ decrement :bar
137
+ end
138
+ end
139
+
140
+ end
141
+
142
+ it "registers a gauge measurement" do
143
+ subject.should_receive(:send).with("mystat", 99, :gauge, 1)
144
+ subject.gauge("mystat", 99)
145
+ end
146
+
147
+ it "raises exception if natural exception from block" do
148
+ proc { subject.time_to_do('data.bin', 1, :gauge, 1) { raise ArgumentError, "testing" } }.should raise_error(ArgumentError)
149
+ end
150
+
151
+ it "only calls the block once on error" do
152
+ Fozzie.c.adapter.stub(:send) { raise SocketError }
153
+ i = 0
154
+ p = proc {|n| (n + 1) }
155
+ val = subject.time_to_do('data.bin') { i+= p.call(i) }
156
+
157
+ val.should == 1
158
+ end
159
+
160
160
  end