bubot 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffb70ca69b74a4877180a5b9744f5898f9b992ea
4
- data.tar.gz: 66d101334c85204bc981a50c1cf8a1a3b1fbe39c
3
+ metadata.gz: a2fae634ace0fd84b594ed5ba002298529ceb869
4
+ data.tar.gz: b6035c4939b68325d0dec3c4c56fa6db9e66c91a
5
5
  SHA512:
6
- metadata.gz: 3a90de6794daed69b791cecb1a9d964f4aec80bfa0473255a5d18414cf8838f6c418673384061756206eaee61958ccb2c2d88512c812446a0c3e9f1a57145260
7
- data.tar.gz: 0e277e45f5acdc93db180080e1aa98f97616b52352fc3e7d6b394011ecc4e4199fa2b00dd7291a79f3662376ac833cf177925c5facadff229f2370296027c8dc
6
+ metadata.gz: 8d1cdc55a327900fec5a7d981ee197987c21c1f89a480d457f2115070677cac6eca0ca61f6bceaa73fe8eea2ff953194f925fa65b90ad6c554e5057799e7e8eb
7
+ data.tar.gz: f2b55d65cd4fb980fc0647e97eea79492883248e42105a3cd7205e16e7762205439223c1f528fe34fe0d460e4eb38525b9c6d0af9e4e040bd35e5809c2be7d87
data/lib/bubot.rb CHANGED
@@ -6,8 +6,8 @@ module Bubot
6
6
  define_method("#{method_name}_with_feature") do
7
7
  start_time = Time.now
8
8
  response = send("#{method_name}_without_feature".to_sym)
9
- if (Time.now - start_time) > timeout
10
- block.call(self)
9
+ if (total_time = Time.now - start_time) > timeout
10
+ block.call(self, total_time)
11
11
  end
12
12
  response
13
13
  end
data/lib/bubot/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bubot
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/bubot_spec.rb CHANGED
@@ -92,6 +92,30 @@ describe Bubot do
92
92
 
93
93
  bubot_observed.pass_self
94
94
  end
95
+
96
+ it "passes the time it took to the strategy" do
97
+ class RecievesTimeStrategy
98
+ def self.execute(instance, time)
99
+ # do stuff
100
+ end
101
+ end
102
+
103
+ class PassesTime
104
+ extend Bubot
105
+ watch(:pass_time, 0.001) do |instance, time|
106
+ RecievesTimeStrategy.execute(instance, time)
107
+ end
108
+ def pass_time; sleep 0.002; end
109
+ end
110
+
111
+ bubot_observed = PassesTime.new
112
+ RecievesTimeStrategy.should_receive(:execute) do |instance, time|
113
+ expect(time).to be > 0.002
114
+ expect(instance).to be(bubot_observed)
115
+ end
116
+
117
+ bubot_observed.pass_time
118
+ end
95
119
  end
96
120
  end
97
121
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bubot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Cooper