rspec-mocks 2.8.0.rc1 → 2.8.0.rc2

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.
@@ -3,12 +3,16 @@ require 'rspec/mocks/extensions/psych' if defined?(::Psych)
3
3
 
4
4
  module RSpec
5
5
  module Mocks
6
+ # @private
6
7
  module Serialization
8
+ # @private
7
9
  def self.fix_for(object)
8
10
  object.extend(YAML) if defined?(::YAML)
9
11
  end
10
12
 
13
+ # @private
11
14
  module YAML
15
+ # @private
12
16
  def to_yaml(options = {})
13
17
  return nil if defined?(::Psych) && options.respond_to?(:[]) && options[:nodump]
14
18
  return super(options) unless instance_variable_defined?(:@mock_proxy)
@@ -1,5 +1,6 @@
1
1
  module RSpec
2
2
  module Mocks
3
+ # @api private
3
4
  class Space
4
5
  def add(obj)
5
6
  mocks << obj unless mocks.detect {|m| m.equal? obj}
@@ -1,7 +1,7 @@
1
1
  module RSpec
2
2
  module Mocks
3
3
  module Version
4
- STRING = '2.8.0.rc1'
4
+ STRING = '2.8.0.rc2'
5
5
  end
6
6
  end
7
7
  end
@@ -3,10 +3,10 @@ require 'spec_helper'
3
3
  module RSpec
4
4
  module Mocks
5
5
  module ArgumentMatchers
6
- describe HashNotIncludingMatcher do
6
+ describe HashExcludingMatcher do
7
7
 
8
8
  it "describes itself properly" do
9
- HashNotIncludingMatcher.new(:a => 5).description.should eq "hash_not_including(:a=>5)"
9
+ HashExcludingMatcher.new(:a => 5).description.should eq "hash_not_including(:a=>5)"
10
10
  end
11
11
 
12
12
  describe "passing" do
@@ -28,7 +28,7 @@ module RSpec
28
28
  @instance = @class.new
29
29
  @stub = Object.new
30
30
  end
31
-
31
+
32
32
  [:stub!, :stub].each do |method|
33
33
  describe "using #{method}" do
34
34
  it "returns declared value when message is received" do
@@ -146,7 +146,7 @@ module RSpec
146
146
  current_value.should eq [:yielded_value, :another_value]
147
147
  @instance.rspec_verify
148
148
  end
149
-
149
+
150
150
  it "yields a specified object and return another specified object" do
151
151
  yielded_obj = double("my mock")
152
152
  yielded_obj.should_receive(:foo).with(:bar)
@@ -156,11 +156,14 @@ module RSpec
156
156
 
157
157
  it "throws when told to" do
158
158
  @stub.stub(:something).and_throw(:up)
159
- lambda do
160
- @stub.something
161
- end.should throw_symbol(:up)
159
+ expect { @stub.something }.to throw_symbol(:up)
160
+ end
161
+
162
+ it "throws with argument when told to" do
163
+ @stub.stub(:something).and_throw(:up, 'high')
164
+ expect { @stub.something }.to throw_symbol(:up, 'high')
162
165
  end
163
-
166
+
164
167
  it "overrides a pre-existing method" do
165
168
  @stub.stub(:existing_instance_method).and_return(:updated_stub_value)
166
169
  @stub.existing_instance_method.should eq :updated_stub_value
@@ -171,7 +174,7 @@ module RSpec
171
174
  @stub.stub(:foo) { 'baz' }
172
175
  @stub.foo.should eq 'baz'
173
176
  end
174
-
177
+
175
178
  it "allows a stub and an expectation" do
176
179
  @stub.stub(:foo).with("bar")
177
180
  @stub.should_receive(:foo).with("baz")
@@ -185,7 +188,7 @@ module RSpec
185
188
  @stub.rspec_verify
186
189
  end
187
190
  end
188
-
191
+
189
192
  describe "A method stub with args" do
190
193
  before(:each) do
191
194
  @stub = Object.new
@@ -225,7 +228,7 @@ module RSpec
225
228
  @stub.foo("other")
226
229
  end.should raise_error
227
230
  end
228
-
231
+
229
232
  it "supports options" do
230
233
  @stub.stub(:foo, :expected_from => "bar")
231
234
  end
metadata CHANGED
@@ -1,47 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-mocks
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424215
4
+ hash: 15424209
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 2
8
8
  - 8
9
9
  - 0
10
10
  - rc
11
- - 1
12
- version: 2.8.0.rc1
11
+ - 2
12
+ version: 2.8.0.rc2
13
13
  platform: ruby
14
14
  authors:
15
+ - Steven Baker
15
16
  - David Chelimsky
16
- - Chad Humphries
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-11-06 00:00:00 Z
21
+ date: 2011-12-20 00:00:00 Z
22
22
  dependencies: []
23
23
 
24
24
  description: RSpec's 'test double' framework, with support for stubbing and mocking
25
- email: dchelimsky@gmail.com;chad.humphries@gmail.com
25
+ email: rspec-users@rubyforge.org
26
26
  executables: []
27
27
 
28
28
  extensions: []
29
29
 
30
30
  extra_rdoc_files:
31
31
  - README.md
32
+ - License.txt
32
33
  files:
33
34
  - lib/rspec/mocks.rb
34
35
  - lib/rspec/mocks/any_instance.rb
35
36
  - lib/rspec/mocks/any_instance/chain.rb
36
- - lib/rspec/mocks/any_instance/expectation_chain.rb
37
37
  - lib/rspec/mocks/any_instance/message_chains.rb
38
38
  - lib/rspec/mocks/any_instance/recorder.rb
39
- - lib/rspec/mocks/any_instance/stub_chain.rb
40
- - lib/rspec/mocks/any_instance/stub_chain_chain.rb
41
39
  - lib/rspec/mocks/argument_expectation.rb
42
40
  - lib/rspec/mocks/argument_matchers.rb
43
41
  - lib/rspec/mocks/error_generator.rb
44
42
  - lib/rspec/mocks/errors.rb
43
+ - lib/rspec/mocks/example_methods.rb
45
44
  - lib/rspec/mocks/extensions/instance_exec.rb
46
45
  - lib/rspec/mocks/extensions/marshal.rb
47
46
  - lib/rspec/mocks/extensions/psych.rb
@@ -54,10 +53,10 @@ files:
54
53
  - lib/rspec/mocks/proxy.rb
55
54
  - lib/rspec/mocks/serialization.rb
56
55
  - lib/rspec/mocks/space.rb
57
- - lib/rspec/mocks/spec_methods.rb
58
56
  - lib/rspec/mocks/standalone.rb
59
57
  - lib/rspec/mocks/version.rb
60
58
  - lib/spec/mocks.rb
59
+ - License.txt
61
60
  - README.md
62
61
  - features/README.markdown
63
62
  - features/Scope.md
@@ -102,8 +101,8 @@ files:
102
101
  - spec/rspec/mocks/bug_report_957_spec.rb
103
102
  - spec/rspec/mocks/double_spec.rb
104
103
  - spec/rspec/mocks/failing_argument_matchers_spec.rb
104
+ - spec/rspec/mocks/hash_excluding_matcher_spec.rb
105
105
  - spec/rspec/mocks/hash_including_matcher_spec.rb
106
- - spec/rspec/mocks/hash_not_including_matcher_spec.rb
107
106
  - spec/rspec/mocks/mock_ordering_spec.rb
108
107
  - spec/rspec/mocks/mock_space_spec.rb
109
108
  - spec/rspec/mocks/mock_spec.rb
@@ -128,8 +127,8 @@ files:
128
127
  - spec/rspec/mocks_spec.rb
129
128
  - spec/spec_helper.rb
130
129
  homepage: http://github.com/rspec/rspec-mocks
131
- licenses: []
132
-
130
+ licenses:
131
+ - MIT
133
132
  post_install_message:
134
133
  rdoc_options:
135
134
  - --charset=UTF-8
@@ -161,7 +160,7 @@ rubyforge_project: rspec
161
160
  rubygems_version: 1.8.11
162
161
  signing_key:
163
162
  specification_version: 3
164
- summary: rspec-mocks-2.8.0.rc1
163
+ summary: rspec-mocks-2.8.0.rc2
165
164
  test_files:
166
165
  - features/README.markdown
167
166
  - features/Scope.md
@@ -206,8 +205,8 @@ test_files:
206
205
  - spec/rspec/mocks/bug_report_957_spec.rb
207
206
  - spec/rspec/mocks/double_spec.rb
208
207
  - spec/rspec/mocks/failing_argument_matchers_spec.rb
208
+ - spec/rspec/mocks/hash_excluding_matcher_spec.rb
209
209
  - spec/rspec/mocks/hash_including_matcher_spec.rb
210
- - spec/rspec/mocks/hash_not_including_matcher_spec.rb
211
210
  - spec/rspec/mocks/mock_ordering_spec.rb
212
211
  - spec/rspec/mocks/mock_space_spec.rb
213
212
  - spec/rspec/mocks/mock_spec.rb
@@ -231,3 +230,4 @@ test_files:
231
230
  - spec/rspec/mocks/twice_counts_spec.rb
232
231
  - spec/rspec/mocks_spec.rb
233
232
  - spec/spec_helper.rb
233
+ has_rdoc:
@@ -1,33 +0,0 @@
1
- module RSpec
2
- module Mocks
3
- module AnyInstance
4
- class ExpectationChain < Chain
5
- def initialize(*args, &block)
6
- record(:should_receive, *args, &block)
7
- @expectation_fulfilled = false
8
- end
9
-
10
- def invocation_order
11
- @invocation_order ||= {
12
- :should_receive => [nil],
13
- :with => [:should_receive],
14
- :and_return => [:with, :should_receive],
15
- :and_raise => [:with, :should_receive]
16
- }
17
- end
18
-
19
- def expectation_fulfilled!
20
- @expectation_fulfilled = true
21
- end
22
-
23
- def expectation_fulfilled?
24
- @expectation_fulfilled || constrained_to_any_of?(:never, :any_number_of_times)
25
- end
26
-
27
- private
28
- def verify_invocation_order(rspec_method_name, *args, &block)
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,35 +0,0 @@
1
- module RSpec
2
- module Mocks
3
- module AnyInstance
4
- class StubChain < Chain
5
- def initialize(*args, &block)
6
- record(:stub, *args, &block)
7
- end
8
-
9
- def invocation_order
10
- @invocation_order ||= {
11
- :stub => [nil],
12
- :with => [:stub],
13
- :and_return => [:with, :stub],
14
- :and_raise => [:with, :stub],
15
- :and_yield => [:with, :stub]
16
- }
17
- end
18
-
19
- def expectation_fulfilled?
20
- true
21
- end
22
-
23
- def expectation_fulfilled!
24
- end
25
-
26
- private
27
- def verify_invocation_order(rspec_method_name, *args, &block)
28
- unless invocation_order[rspec_method_name].include?(last_message)
29
- raise(NoMethodError, "Undefined method #{rspec_method_name}")
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,34 +0,0 @@
1
- module RSpec
2
- module Mocks
3
- module AnyInstance
4
- class StubChainChain < Chain
5
- def initialize(*args, &block)
6
- record(:stub_chain, *args, &block)
7
- end
8
-
9
- def invocation_order
10
- @invocation_order ||= {
11
- :stub_chain => [nil],
12
- :and_return => [:stub_chain],
13
- :and_raise => [:stub_chain],
14
- :and_yield => [:stub_chain]
15
- }
16
- end
17
-
18
- def expectation_fulfilled?
19
- true
20
- end
21
-
22
- def expectation_fulfilled!
23
- end
24
-
25
- private
26
- def verify_invocation_order(rspec_method_name, *args, &block)
27
- unless invocation_order[rspec_method_name].include?(last_message)
28
- raise(NoMethodError, "Undefined method #{rspec_method_name}")
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end