bubot 0.0.2 → 0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2fae634ace0fd84b594ed5ba002298529ceb869
4
- data.tar.gz: b6035c4939b68325d0dec3c4c56fa6db9e66c91a
3
+ metadata.gz: 02e14c092d6111ff2a7438dd5372f5ef16c3f620
4
+ data.tar.gz: d580e4a8efa9a8f0bf103d4b5b54ac68a05f0eca
5
5
  SHA512:
6
- metadata.gz: 8d1cdc55a327900fec5a7d981ee197987c21c1f89a480d457f2115070677cac6eca0ca61f6bceaa73fe8eea2ff953194f925fa65b90ad6c554e5057799e7e8eb
7
- data.tar.gz: f2b55d65cd4fb980fc0647e97eea79492883248e42105a3cd7205e16e7762205439223c1f528fe34fe0d460e4eb38525b9c6d0af9e4e040bd35e5809c2be7d87
6
+ metadata.gz: e335fb6754b0dc81609b965917b36745fb65139929dcc463717d594121192f7a95d03501f993287b3a11def5dad805b01a44522119f2d352d931b24847c4d97e
7
+ data.tar.gz: d8d808b606983dc9b3d81b8fd259fcb4a4990a6ab317614db65e64ba3800d9e47f7561b3a5de7504ce666c96cfd33d6ea630a008a093146bb44d1a9e2d69d15e
@@ -2,12 +2,12 @@ require "bubot/version"
2
2
 
3
3
  module Bubot
4
4
 
5
- def watch(method_name, timeout, &block)
5
+ def watch(method_name, timeout=0)
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
9
  if (total_time = Time.now - start_time) > timeout
10
- block.call(self, total_time)
10
+ yield(self, total_time)
11
11
  end
12
12
  response
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module Bubot
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -60,6 +60,19 @@ describe Bubot do
60
60
  end
61
61
  end
62
62
 
63
+ context "timeout is optional" do
64
+ it "timeout is not passed" do
65
+ class NoTimeout
66
+ extend Bubot
67
+ watch(:without_timeout) { Baz.buz }
68
+ def without_timeout() end
69
+ end
70
+
71
+ Baz.should_receive(:buz).once
72
+ NoTimeout.new.without_timeout
73
+ end
74
+ end
75
+
63
76
  context "watching methods that are not defined" do
64
77
  it "does nothing and does not break" do
65
78
  expect do
@@ -71,7 +84,7 @@ describe Bubot do
71
84
  end
72
85
  end
73
86
 
74
- context "do defining new methods" do
87
+ context "sending messages to strategy" do
75
88
  it "passes its instance to the strategy" do
76
89
  class RecievesSelfStrategy
77
90
  def self.execute(instance)
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Cooper