bubot 0.0.6 → 0.0.7
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.
- checksums.yaml +4 -4
- data/lib/bubot.rb +1 -1
- data/lib/bubot/version.rb +1 -1
- data/spec/bubot_spec.rb +13 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5164f040c4ac3f870f748ebd333ffc0a755b4e5f
|
4
|
+
data.tar.gz: d31db432a0ae70aedb45aeb98ec43b1f5a699581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5bf37ee1f8e8f37b1bd236e37dc86066c3ac341b4e3c78243abcc0e48d99a8d7a9b925214e637dacbb4be373bd65a9314171e55991ff5ccae4c64fc830860d0
|
7
|
+
data.tar.gz: 23dc04269ed4d55b84d93583c49cd98cd19ac55fbec4ee1ad55752fd4de7e7596704f05b12cbda67a88cc388861a7b7dafb05782dbef54923582e2d71052381e
|
data/lib/bubot.rb
CHANGED
@@ -10,7 +10,7 @@ module Bubot
|
|
10
10
|
|
11
11
|
method_return_value = send("#{method_name}_without_feature".to_sym, *args, &block)
|
12
12
|
|
13
|
-
if (total_time = Time.now - start_time)
|
13
|
+
if (total_time = Time.now - start_time) >= defaults[:timeout]
|
14
14
|
if options[:with]
|
15
15
|
options[:with].call(self, total_time, method_return_value)
|
16
16
|
else
|
data/lib/bubot/version.rb
CHANGED
data/spec/bubot_spec.rb
CHANGED
@@ -86,7 +86,7 @@ describe Bubot do
|
|
86
86
|
|
87
87
|
context "sending messages to strategy" do
|
88
88
|
it "passes its instance to the strategy" do
|
89
|
-
class
|
89
|
+
class ReceivesSelfStrategy
|
90
90
|
def self.execute(instance)
|
91
91
|
# do stuff
|
92
92
|
end
|
@@ -95,19 +95,19 @@ describe Bubot do
|
|
95
95
|
class PassesSelf
|
96
96
|
extend Bubot
|
97
97
|
watch(:pass_self, timeout: 0.001) do |instance|
|
98
|
-
|
98
|
+
ReceivesSelfStrategy.execute(instance)
|
99
99
|
end
|
100
100
|
def pass_self; sleep 0.002; end
|
101
101
|
end
|
102
102
|
|
103
103
|
bubot_observed = PassesSelf.new
|
104
|
-
|
104
|
+
ReceivesSelfStrategy.should_receive(:execute).with(bubot_observed).once
|
105
105
|
|
106
106
|
bubot_observed.pass_self
|
107
107
|
end
|
108
108
|
|
109
109
|
it "passes the time it took to the strategy" do
|
110
|
-
class
|
110
|
+
class ReceivesTimeStrategy
|
111
111
|
def self.execute(instance, time)
|
112
112
|
# do stuff
|
113
113
|
end
|
@@ -116,22 +116,22 @@ describe Bubot do
|
|
116
116
|
class PassesTime
|
117
117
|
extend Bubot
|
118
118
|
watch(:pass_time, timeout: 0.001) do |instance, time|
|
119
|
-
|
119
|
+
ReceivesTimeStrategy.execute(instance, time)
|
120
120
|
end
|
121
121
|
def pass_time; sleep 0.002; end
|
122
122
|
end
|
123
123
|
|
124
124
|
bubot_observed = PassesTime.new
|
125
|
-
|
126
|
-
expect(time).to be > 0.
|
125
|
+
ReceivesTimeStrategy.should_receive(:execute) do |instance, time|
|
126
|
+
expect(time).to be > 0.001
|
127
127
|
expect(instance).to be(bubot_observed)
|
128
128
|
end
|
129
129
|
|
130
130
|
bubot_observed.pass_time
|
131
131
|
end
|
132
132
|
|
133
|
-
it "passes the returned value
|
134
|
-
class
|
133
|
+
it "passes the returned value from the watched method" do
|
134
|
+
class ReceivesReturnValueStrategy
|
135
135
|
def self.execute(instance, time, original_value)
|
136
136
|
# do stuff
|
137
137
|
end
|
@@ -140,7 +140,7 @@ describe Bubot do
|
|
140
140
|
class PassesReturnValue
|
141
141
|
extend Bubot
|
142
142
|
watch(:pass_return_value, timeout: 0.001) do |instance, time, return_value|
|
143
|
-
|
143
|
+
ReceivesReturnValueStrategy.execute(instance, time, return_value)
|
144
144
|
end
|
145
145
|
def pass_return_value
|
146
146
|
sleep 0.002
|
@@ -149,8 +149,8 @@ describe Bubot do
|
|
149
149
|
end
|
150
150
|
|
151
151
|
bubot_observed = PassesReturnValue.new
|
152
|
-
|
153
|
-
expect(time).to be > 0.
|
152
|
+
ReceivesReturnValueStrategy.should_receive(:execute) do |instance, time, return_value|
|
153
|
+
expect(time).to be > 0.001
|
154
154
|
expect(instance).to be(bubot_observed)
|
155
155
|
expect(return_value).to eq("return_value")
|
156
156
|
end
|
@@ -181,7 +181,7 @@ describe Bubot do
|
|
181
181
|
original_class = UsingWith.new
|
182
182
|
expect(RespondingStrategy).to receive(:call) do |instance, time, value|
|
183
183
|
expect(instance).to be(original_class)
|
184
|
-
expect(time).to be
|
184
|
+
expect(time).to be >= 0
|
185
185
|
expect(value).to eq "original value"
|
186
186
|
end
|
187
187
|
original_class.original
|
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.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Cooper
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|