rspec-message-within 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 86005d7513d01eef6bd43ece104ea78d80ca2ff3
4
- data.tar.gz: f243479b5a09274e53490ee6accf9097affdc423
5
- SHA512:
6
- metadata.gz: f965dc638f52d4278c54dda068eda0088642576d0a4469ff98f0e4e14f48a29e707462de45cf75afb8173d279aa50d9051da4563598dfc4c8326ffbb75fe5423
7
- data.tar.gz: f3054e941b22734f20ba54abcf8b57967bf7077b0f2fb0d2da9035ec1f50cd1dff81d12a9c45841165f8f6a45b2e2f490bbae888420704335eb1b147c3fcd48c
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MGY0MzBiODNkZWFmOTU0OWZkZWM3MDY4NWMzZTdhNWViMjNkZDBjYg==
5
+ data.tar.gz: !binary |-
6
+ YmRiN2Q5Y2U1ZGI4MzQ3MGY3Y2QxOWUyMTNhMzgzYWYwNjk1NmQxMA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZmUwMmY2MzJkZThkMjdlMDVmZGM5NzIxMGRiNTllNGRlMGViMWQwODJjYzg3
10
+ OGRhZGRmZDY4MDE1MGI1OWY2NTJmMGI3ODIwZTJmNmI0MmMyNWVkMTkzNzEz
11
+ ODZlYjVlZmFlNDM5ZGRjMDBiNjkyYjM3NWRiZjEyYzg0NzIwOTE=
12
+ data.tar.gz: !binary |-
13
+ ODZmNTQ5ZDk3NjE3MDc5NDNjZGQ3NTBiNTJkY2M0MmExNzAwNmRlNDJhMTYy
14
+ NzFhYTI3YzEyYzEzM2M1MWVkYjJhZmE4YWI4ZTUyY2U4NWRlMWMwYzdiMmM0
15
+ OGI1MTBkMTU4YmM4N2YzZjlkNzg2YmMzN2IzZjU0NmVjNTZmZjU=
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - jruby
6
+ - rbx-19mode
7
+
8
+ script:
9
+ - bundle exec rake spec
@@ -2,90 +2,67 @@ require 'rspec/message/within/version'
2
2
  require 'rspec/mocks'
3
3
 
4
4
  module RSpec
5
- module Message
6
- module Within
7
-
8
- def self.until(within_time)
9
- if within_time && within_time > 0.0
10
- time = Time.now + within_time
11
- while time > Time.now
12
- break if yield
13
- sleep 0
14
- end
5
+ module MessageWithin
6
+ def self.until(within_time)
7
+ if within_time && within_time > 0.0
8
+ time = Time.now + within_time
9
+ while time > Time.now
10
+ break if yield
11
+ sleep 0
15
12
  end
16
13
  end
14
+ end
15
+ end
16
+ end
17
17
 
18
- module MessageExpectationPatch
19
- def self.included(base)
20
- # Seems to not work. Why?
21
- base.send :include, InstanceMethods
22
-
23
- base.send :alias_method, :orig_verify_messages_received, :verify_messages_received
24
- base.send :undef_method, :verify_messages_received
25
- base.send :define_method, :verify_messages_received, InstanceMethods.instance_method(:verify_messages_received)
18
+ module RSpec
19
+ module Mocks
20
+ class MessageExpectation
21
+ alias_method :orig_verify_messages_received, :verify_messages_received
22
+ def verify_messages_received
23
+ MessageWithin.until(@within_time || 0) do
24
+ expected_messages_received? and !negative?
26
25
  end
27
26
 
28
- module InstanceMethods
29
- def verify_messages_received
30
- Within.until(@within_time || 0) do
31
- expected_messages_received? and !negative?
32
- end
33
-
34
- orig_verify_messages_received
35
- end
27
+ orig_verify_messages_received
28
+ end
36
29
 
37
- def within(time)
38
- @within_time = time
39
- self
40
- end
41
- end
30
+ def within(time)
31
+ @within_time = time
32
+ self
42
33
  end
34
+ end
43
35
 
44
- module ReceivePatch
45
- def self.included(base)
46
- base.send :include, InstanceMethods
36
+ module Matchers
37
+ class Receive
38
+ def within(*args, &block)
39
+ @recorded_customizations << ::RSpec::Mocks::Matchers::Receive::Customization.new(:within, args, block)
40
+ self
47
41
  end
48
42
 
49
- module InstanceMethods
50
- def within(*args, &block)
51
- @recorded_customizations << ::RSpec::Mocks::Matchers::Receive::Customization.new(:within, args, block)
52
- self
53
- end
54
- def seconds
55
- self
56
- end
43
+ def seconds
44
+ self
57
45
  end
58
46
  end
47
+ end
59
48
 
60
- module ExpectationChainPatch
61
- def self.included(base)
62
- base.send :alias_method, :orig_expectation_fulfilled?, :expectation_fulfilled?
63
- base.send :undef_method, :expectation_fulfilled?
64
- base.send :define_method, :expectation_fulfilled?, InstanceMethods.instance_method(:expectation_fulfilled?)
65
- end
66
-
67
- module InstanceMethods
68
- def expectation_fulfilled?
69
- Within.until(@within_time || 0) do
70
- orig_expectation_fulfilled?
71
- end
49
+ module AnyInstance
50
+ class ExpectationChain
51
+ alias_method :orig_expectation_fulfilled?, :expectation_fulfilled?
72
52
 
53
+ def expectation_fulfilled?
54
+ RSpec::MessageWithin.until(@within_time || 0) do
73
55
  orig_expectation_fulfilled?
74
56
  end
57
+
58
+ orig_expectation_fulfilled?
75
59
  end
76
- end
77
60
 
78
- module ChainPatch
79
61
  def within(time)
80
62
  @within_time = time
81
63
  self
82
64
  end
83
65
  end
84
-
85
- ::RSpec::Mocks::MessageExpectation.send :include, MessageExpectationPatch
86
- ::RSpec::Mocks::AnyInstance::Chain.send :include, ChainPatch
87
- ::RSpec::Mocks::AnyInstance::ExpectationChain.send :include, ExpectationChainPatch
88
- ::RSpec::Mocks::Matchers::Receive.send :include, ReceivePatch
89
66
  end
90
67
  end
91
68
  end
@@ -1,7 +1,7 @@
1
1
  module Rspec
2
2
  module Message
3
3
  module Within
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-message-within
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -74,6 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - .gitignore
77
+ - .travis.yml
77
78
  - Gemfile
78
79
  - LICENSE.txt
79
80
  - README.md
@@ -93,17 +94,17 @@ require_paths:
93
94
  - lib
94
95
  required_ruby_version: !ruby/object:Gem::Requirement
95
96
  requirements:
96
- - - '>='
97
+ - - ! '>='
97
98
  - !ruby/object:Gem::Version
98
99
  version: '0'
99
100
  required_rubygems_version: !ruby/object:Gem::Requirement
100
101
  requirements:
101
- - - '>='
102
+ - - ! '>='
102
103
  - !ruby/object:Gem::Version
103
104
  version: '0'
104
105
  requirements: []
105
106
  rubyforge_project:
106
- rubygems_version: 2.0.6
107
+ rubygems_version: 2.0.7
107
108
  signing_key:
108
109
  specification_version: 4
109
110
  summary: expect(object).to receive(:message).within(:some).seconds