rspec-mocks 2.0.0.beta.8 → 2.0.0.beta.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/README.markdown +1 -1
  2. data/Rakefile +10 -10
  3. data/VERSION +1 -1
  4. data/features/mocks/block_local_expectations.feature +5 -5
  5. data/features/mocks/mix_stubs_and_mocks.feature +2 -2
  6. data/features/mocks/warn_when_expectation_is_set_on_nil.feature +6 -6
  7. data/features/stubs/stub_implementation.feature +2 -2
  8. data/lib/rspec/mocks.rb +112 -137
  9. data/lib/rspec/mocks/argument_expectation.rb +1 -1
  10. data/lib/rspec/mocks/argument_matchers.rb +1 -1
  11. data/lib/rspec/mocks/error_generator.rb +2 -2
  12. data/lib/rspec/mocks/errors.rb +1 -1
  13. data/lib/rspec/mocks/extensions/instance_exec.rb +2 -2
  14. data/lib/rspec/mocks/extensions/object.rb +1 -1
  15. data/lib/rspec/mocks/message_expectation.rb +3 -3
  16. data/lib/rspec/mocks/method_double.rb +3 -3
  17. data/lib/rspec/mocks/methods.rb +1 -1
  18. data/lib/rspec/mocks/mock.rb +9 -6
  19. data/lib/rspec/mocks/order_group.rb +1 -1
  20. data/lib/rspec/mocks/proxy.rb +9 -8
  21. data/lib/rspec/mocks/space.rb +1 -1
  22. data/lib/rspec/mocks/spec_methods.rb +13 -15
  23. data/lib/rspec/mocks/version.rb +1 -1
  24. data/rspec-mocks.gemspec +11 -11
  25. data/spec/rspec/mocks/and_yield_spec.rb +4 -4
  26. data/spec/rspec/mocks/any_number_of_times_spec.rb +2 -2
  27. data/spec/rspec/mocks/argument_expectation_spec.rb +3 -3
  28. data/spec/rspec/mocks/at_least_spec.rb +7 -7
  29. data/spec/rspec/mocks/at_most_spec.rb +5 -5
  30. data/spec/rspec/mocks/bug_report_10260_spec.rb +1 -1
  31. data/spec/rspec/mocks/bug_report_15719_spec.rb +3 -3
  32. data/spec/rspec/mocks/bug_report_830_spec.rb +2 -2
  33. data/spec/rspec/mocks/double_spec.rb +1 -1
  34. data/spec/rspec/mocks/failing_argument_matchers_spec.rb +14 -14
  35. data/spec/rspec/mocks/hash_including_matcher_spec.rb +1 -1
  36. data/spec/rspec/mocks/hash_not_including_matcher_spec.rb +1 -1
  37. data/spec/rspec/mocks/mock_ordering_spec.rb +4 -4
  38. data/spec/rspec/mocks/mock_space_spec.rb +2 -2
  39. data/spec/rspec/mocks/mock_spec.rb +32 -25
  40. data/spec/rspec/mocks/multiple_return_value_spec.rb +12 -12
  41. data/spec/rspec/mocks/nil_expectation_warning_spec.rb +3 -3
  42. data/spec/rspec/mocks/null_object_mock_spec.rb +3 -3
  43. data/spec/rspec/mocks/once_counts_spec.rb +4 -4
  44. data/spec/rspec/mocks/options_hash_spec.rb +4 -4
  45. data/spec/rspec/mocks/partial_mock_spec.rb +9 -9
  46. data/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +3 -3
  47. data/spec/rspec/mocks/passing_argument_matchers_spec.rb +3 -3
  48. data/spec/rspec/mocks/precise_counts_spec.rb +3 -3
  49. data/spec/rspec/mocks/record_messages_spec.rb +2 -2
  50. data/spec/rspec/mocks/stash_spec.rb +1 -1
  51. data/spec/rspec/mocks/stub_chain_spec.rb +1 -1
  52. data/spec/rspec/mocks/stub_implementation_spec.rb +1 -1
  53. data/spec/rspec/mocks/stub_spec.rb +1 -1
  54. data/spec/rspec/mocks/stubbed_message_expectations_spec.rb +2 -2
  55. data/spec/rspec/mocks/twice_counts_spec.rb +5 -5
  56. data/spec/spec_helper.rb +4 -4
  57. metadata +10 -10
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  def remove_last_describe_from_world
4
- Rspec::Core.world.example_groups.pop
4
+ RSpec::world.example_groups.pop
5
5
  end
6
6
 
7
7
  def empty_example_group
8
- group = Rspec::Core::ExampleGroup.describe(Object, 'Empty Behaviour Group') { }
8
+ group = RSpec::Core::ExampleGroup.describe(Object, 'Empty Behaviour Group') { }
9
9
  remove_last_describe_from_world
10
10
  end
11
11
 
12
- module Rspec
12
+ module RSpec
13
13
  module Mocks
14
14
 
15
15
  describe "an expectation set on nil" do
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "a mock acting as a NullObject" do
6
6
  before(:each) do
7
- @mock = Rspec::Mocks::Mock.new("null_object", :null_object => true)
7
+ @mock = RSpec::Mocks::Mock.new("null_object").as_null_object
8
8
  end
9
9
 
10
10
  it "should allow explicit expectation" do
@@ -16,7 +16,7 @@ module Rspec
16
16
  lambda do
17
17
  @mock.should_receive(:something)
18
18
  @mock.rspec_verify
19
- end.should raise_error(Rspec::Mocks::MockExpectationError)
19
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
20
20
  end
21
21
 
22
22
  it "should ignore unexpected methods" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "OnceCounts" do
6
6
  before(:each) do
@@ -11,7 +11,7 @@ module Rspec
11
11
  @mock.should_receive(:random_call).once.with("a", "b", "c")
12
12
  lambda do
13
13
  @mock.random_call("d", "e", "f")
14
- end.should raise_error(Rspec::Mocks::MockExpectationError)
14
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
15
15
  @mock.rspec_reset
16
16
  end
17
17
 
@@ -21,14 +21,14 @@ module Rspec
21
21
  @mock.random_call
22
22
  lambda do
23
23
  @mock.rspec_verify
24
- end.should raise_error(Rspec::Mocks::MockExpectationError)
24
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
25
25
  end
26
26
 
27
27
  it "once should fail when not called" do
28
28
  @mock.should_receive(:random_call).once
29
29
  lambda do
30
30
  @mock.rspec_verify
31
- end.should raise_error(Rspec::Mocks::MockExpectationError)
31
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
32
32
  end
33
33
 
34
34
  it "once should pass when called once" do
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "calling :should_receive with an options hash" do
6
6
  it "should report the file and line submitted with :expected_from" do
7
7
  begin
8
- mock = Rspec::Mocks::Mock.new("a mock")
8
+ mock = RSpec::Mocks::Mock.new("a mock")
9
9
  mock.should_receive(:message, :expected_from => "/path/to/blah.ext:37")
10
10
  mock.rspec_verify
11
11
  rescue Exception => e
@@ -16,7 +16,7 @@ module Rspec
16
16
 
17
17
  it "should use the message supplied with :message" do
18
18
  lambda {
19
- m = Rspec::Mocks::Mock.new("a mock")
19
+ m = RSpec::Mocks::Mock.new("a mock")
20
20
  m.should_receive(:message, :message => "recebi nada")
21
21
  m.rspec_verify
22
22
  }.should raise_error("recebi nada")
@@ -24,7 +24,7 @@ module Rspec
24
24
 
25
25
  it "should use the message supplied with :message after a similar stub" do
26
26
  lambda {
27
- m = Rspec::Mocks::Mock.new("a mock")
27
+ m = RSpec::Mocks::Mock.new("a mock")
28
28
  m.stub(:message)
29
29
  m.should_receive(:message, :message => "from mock")
30
30
  m.rspec_verify
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "using a Partial Mock," do
6
6
  before(:each) do
@@ -11,14 +11,14 @@ module Rspec
11
11
  @object.should_receive(:foo)
12
12
  expect do
13
13
  @object.rspec_verify
14
- end.to raise_error(Rspec::Mocks::MockExpectationError, /\(#<Object:.*>\).foo/)
14
+ end.to raise_error(RSpec::Mocks::MockExpectationError, /\(#<Object:.*>\).foo/)
15
15
  end
16
16
 
17
17
  it "should name the class in the failure message when expectation is on class" do
18
18
  Object.should_receive(:foo)
19
19
  lambda do
20
20
  Object.rspec_verify
21
- end.should raise_error(Rspec::Mocks::MockExpectationError, /<Object \(class\)>/)
21
+ end.should raise_error(RSpec::Mocks::MockExpectationError, /<Object \(class\)>/)
22
22
  end
23
23
 
24
24
  it "should not conflict with @options in the object" do
@@ -32,13 +32,13 @@ module Rspec
32
32
  expect {
33
33
  @object.fuhbar
34
34
  }.to raise_error(
35
- Rspec::Mocks::MockExpectationError,
35
+ RSpec::Mocks::MockExpectationError,
36
36
  /expected\: 0 times\n received\: 1 time/
37
37
  )
38
38
  end
39
39
 
40
40
  it "should_not_receive should return a negative message expectation" do
41
- @object.should_not_receive(:foobar).should be_kind_of(Rspec::Mocks::NegativeMessageExpectation)
41
+ @object.should_not_receive(:foobar).should be_kind_of(RSpec::Mocks::NegativeMessageExpectation)
42
42
  end
43
43
 
44
44
  it "should_receive should mock out the method" do
@@ -58,7 +58,7 @@ module Rspec
58
58
  end
59
59
 
60
60
  it "should_receive should return a message expectation" do
61
- @object.should_receive(:foobar).should be_kind_of(Rspec::Mocks::MessageExpectation)
61
+ @object.should_receive(:foobar).should be_kind_of(RSpec::Mocks::MessageExpectation)
62
62
  @object.foobar
63
63
  end
64
64
 
@@ -66,7 +66,7 @@ module Rspec
66
66
  @object.should_receive(:foobar).with(:test_param).and_return(1)
67
67
  lambda do
68
68
  @object.rspec_verify
69
- end.should raise_error(Rspec::Mocks::MockExpectationError)
69
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
70
70
  end
71
71
 
72
72
  it "should_receive should also take a String argument" do
@@ -78,7 +78,7 @@ module Rspec
78
78
  @object.should_not_receive('foobar')
79
79
  lambda do
80
80
  @object.foobar
81
- end.should raise_error(Rspec::Mocks::MockExpectationError)
81
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
82
82
  end
83
83
 
84
84
  it "should use report nil in the error message" do
@@ -88,7 +88,7 @@ module Rspec
88
88
  expect {
89
89
  @this_will_resolve_to_nil.rspec_verify
90
90
  }.to raise_error(
91
- Rspec::Mocks::MockExpectationError,
91
+ RSpec::Mocks::MockExpectationError,
92
92
  %Q|(nil).foobar(any args)\n expected: 1 time\n received: 0 times|
93
93
  )
94
94
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "PartialMockUsingMocksDirectly" do
6
6
  before(:each) do
@@ -29,14 +29,14 @@ describe "PartialMockUsingMocksDirectly" do
29
29
  @obj.should_receive(:msg)
30
30
  lambda do
31
31
  @obj.rspec_verify
32
- end.should raise_error(Rspec::Mocks::MockExpectationError)
32
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
33
33
 
34
34
  end
35
35
  it "should fail when message is received with incorrect args" do
36
36
  @obj.should_receive(:msg).with(:correct_arg)
37
37
  lambda do
38
38
  @obj.msg(:incorrect_arg)
39
- end.should raise_error(Rspec::Mocks::MockExpectationError)
39
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
40
40
  @obj.msg(:correct_arg)
41
41
 
42
42
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  def include_mock_argument_matchers
4
4
  before(:each) do
5
- @mock = Rspec::Mocks::Mock.new("test mock")
5
+ @mock = RSpec::Mocks::Mock.new("test mock")
6
6
  Kernel.stub(:warn)
7
7
  end
8
8
 
@@ -10,7 +10,7 @@ def include_mock_argument_matchers
10
10
  @mock.rspec_verify
11
11
  end
12
12
  end
13
- module Rspec
13
+ module RSpec
14
14
  module Mocks
15
15
 
16
16
  describe Methods, "handling argument matchers" do
@@ -106,7 +106,7 @@ module Rspec
106
106
  describe Methods, "handling non-matcher arguments" do
107
107
 
108
108
  before(:each) do
109
- @mock = Rspec::Mocks::Mock.new("test mock")
109
+ @mock = RSpec::Mocks::Mock.new("test mock")
110
110
  end
111
111
 
112
112
  it "should match non special symbol (can be removed when deprecated symbols are removed)" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "PreciseCounts" do
6
6
  before(:each) do
@@ -13,14 +13,14 @@ module Rspec
13
13
  @mock.random_call
14
14
  lambda do
15
15
  @mock.rspec_verify
16
- end.should raise_error(Rspec::Mocks::MockExpectationError)
16
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
17
17
  end
18
18
 
19
19
  it "should fail when exactly n times method is never called" do
20
20
  @mock.should_receive(:random_call).exactly(3).times
21
21
  lambda do
22
22
  @mock.rspec_verify
23
- end.should raise_error(Rspec::Mocks::MockExpectationError)
23
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
24
24
  end
25
25
 
26
26
  it "should pass if exactly n times method is called exactly n times" do
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "a mock" do
6
6
  before(:each) do
7
- @mock = double("mock", :null_object => true)
7
+ @mock = double("mock").as_null_object
8
8
  end
9
9
  it "should answer false for received_message? when no messages received" do
10
10
  @mock.received_message?(:message).should be_false
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
 
6
6
  describe "only stashing the original method" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "A chained method stub" do
6
6
  before(:each) do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "stub implementation" do
6
6
  describe "with no args" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "A method stub" do
6
6
  before(:each) do
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "Example with stubbed and then called message" do
6
6
  it "fails if the message is expected and then subsequently not called again" do
7
7
  double = double("mock", :msg => nil)
8
8
  double.msg
9
9
  double.should_receive(:msg)
10
- lambda { double.rspec_verify }.should raise_error(Rspec::Mocks::MockExpectationError)
10
+ lambda { double.rspec_verify }.should raise_error(RSpec::Mocks::MockExpectationError)
11
11
  end
12
12
 
13
13
  it "outputs arguments of all similar calls" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Rspec
3
+ module RSpec
4
4
  module Mocks
5
5
  describe "TwiceCounts" do
6
6
  before(:each) do
@@ -14,7 +14,7 @@ module Rspec
14
14
  @mock.random_call
15
15
  lambda do
16
16
  @mock.rspec_verify
17
- end.should raise_error(Rspec::Mocks::MockExpectationError)
17
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
18
18
  end
19
19
 
20
20
  it "twice should fail when call count is lower than expected" do
@@ -22,14 +22,14 @@ module Rspec
22
22
  @mock.random_call
23
23
  lambda do
24
24
  @mock.rspec_verify
25
- end.should raise_error(Rspec::Mocks::MockExpectationError)
25
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
26
26
  end
27
27
 
28
28
  it "twice should fail when called twice with wrong args on the first call" do
29
29
  @mock.should_receive(:random_call).twice.with("1", 1)
30
30
  lambda do
31
31
  @mock.random_call(1, "1")
32
- end.should raise_error(Rspec::Mocks::MockExpectationError)
32
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
33
33
  @mock.rspec_reset
34
34
  end
35
35
 
@@ -38,7 +38,7 @@ module Rspec
38
38
  @mock.random_call("1", 1)
39
39
  lambda do
40
40
  @mock.random_call(1, "1")
41
- end.should raise_error(Rspec::Mocks::MockExpectationError)
41
+ end.should raise_error(RSpec::Mocks::MockExpectationError)
42
42
  @mock.rspec_reset
43
43
  end
44
44
 
@@ -35,7 +35,7 @@ module Macros
35
35
  end
36
36
  end
37
37
 
38
- module Rspec
38
+ module RSpec
39
39
  module Matchers
40
40
  def with_ruby(version)
41
41
  yield if RUBY_VERSION =~ Regexp.compile("^#{version.to_s}")
@@ -43,10 +43,10 @@ module Rspec
43
43
  end
44
44
  end
45
45
 
46
- Rspec.configure do |config|
46
+ RSpec.configure do |config|
47
47
  config.mock_with :rspec
48
48
  config.color_enabled = true
49
49
  config.extend(Macros)
50
- config.include(Rspec::Matchers)
51
- config.include(Rspec::Mocks::Methods)
50
+ config.include(RSpec::Matchers)
51
+ config.include(RSpec::Mocks::Methods)
52
52
  end
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 0
9
9
  - beta
10
- - 8
11
- version: 2.0.0.beta.8
10
+ - 9
11
+ version: 2.0.0.beta.9
12
12
  platform: ruby
13
13
  authors:
14
14
  - David Chelimsky
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-04-27 00:00:00 -05:00
20
+ date: 2010-05-27 00:00:00 -05:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -32,8 +32,8 @@ dependencies:
32
32
  - 0
33
33
  - 0
34
34
  - beta
35
- - 8
36
- version: 2.0.0.beta.8
35
+ - 9
36
+ version: 2.0.0.beta.9
37
37
  type: :development
38
38
  version_requirements: *id001
39
39
  - !ruby/object:Gem::Dependency
@@ -48,11 +48,11 @@ dependencies:
48
48
  - 0
49
49
  - 0
50
50
  - beta
51
- - 8
52
- version: 2.0.0.beta.8
51
+ - 9
52
+ version: 2.0.0.beta.9
53
53
  type: :development
54
54
  version_requirements: *id002
55
- description: Rspec's 'test double' framework, with support for stubbing and mocking
55
+ description: RSpec's 'test double' framework, with support for stubbing and mocking
56
56
  email: dchelimsky@gmail.com;chad.humphries@gmail.com
57
57
  executables: []
58
58
 
@@ -146,7 +146,7 @@ licenses: []
146
146
  post_install_message: |
147
147
  **************************************************
148
148
 
149
- Thank you for installing rspec-mocks-2.0.0.beta.8
149
+ Thank you for installing rspec-mocks-2.0.0.beta.9
150
150
 
151
151
  This is beta software. If you are looking
152
152
  for a supported production release, please
@@ -180,7 +180,7 @@ rubyforge_project: rspec
180
180
  rubygems_version: 1.3.6
181
181
  signing_key:
182
182
  specification_version: 3
183
- summary: rspec-mocks-2.0.0.beta.8
183
+ summary: rspec-mocks-2.0.0.beta.9
184
184
  test_files:
185
185
  - spec/rspec/mocks/and_yield_spec.rb
186
186
  - spec/rspec/mocks/any_number_of_times_spec.rb