hardmock 1.3.4 → 1.3.5

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.
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ Hardmock 1.3.5
2
+
3
+ * Aliased should_receive => expects and and_return => returns for easier transition from rspec mock and flexmock users.
4
+
1
5
  Hardmock 1.3.4
2
6
 
3
7
  * Prevents accidental stubbing and mocking on NilClasses
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rake'
2
2
  require 'rubygems'
3
3
 
4
- HARDMOCK_VERSION = "1.3.4"
4
+ HARDMOCK_VERSION = "1.3.5"
5
5
 
6
6
  Dir["rake_tasks/*.rake"].each { |f| load f }
7
7
 
data/lib/hardmock.rb CHANGED
@@ -9,6 +9,7 @@ require 'hardmock/expectation'
9
9
  require 'hardmock/expectation_builder'
10
10
  require 'hardmock/stubbing'
11
11
 
12
+
12
13
  module Hardmock
13
14
 
14
15
  # Setup auto mock verification on teardown, being careful not to interfere
@@ -64,6 +64,7 @@ module Hardmock
64
64
  @options[:returns] = val
65
65
  self
66
66
  end
67
+ alias_method :and_return, :returns
67
68
 
68
69
  # Set the arguments for an expected method call.
69
70
  # Eg,
data/lib/hardmock/mock.rb CHANGED
@@ -113,9 +113,7 @@ module Hardmock
113
113
  expector.send(args.shift.to_sym, *args, &block)
114
114
  end
115
115
  alias_method :expect, :expects
116
- # def expect(*args, &block) #:nodoc:
117
- # raise DeprecationError.new("Please use 'expects' instead of 'expect'. Sorry about the inconvenience.")
118
- # end
116
+ alias_method :should_receive, :expects
119
117
 
120
118
  # Special-case convenience: #trap sets up an expectation for a method
121
119
  # that will take a block. That block, when sent to the expected method, will
@@ -341,6 +341,20 @@ class HardmockTest < Test::Unit::TestCase
341
341
  verify_mocks
342
342
  end
343
343
 
344
+ it "provides 'should_receive' as an alias for 'expects'" do
345
+ create_mock :foo
346
+ @foo.should_receive.boomboom
347
+ @foo.boomboom
348
+ verify_mocks
349
+ end
350
+
351
+ it "provides 'and_return' as an alias for 'returns'" do
352
+ create_mock :foo
353
+ @foo.expects(:boomboom).and_return :brick
354
+ assert_equal :brick, @foo.boomboom
355
+ verify_mocks
356
+ end
357
+
344
358
  it "does not interfere with a core subset of Object methods" do
345
359
  create_mock :foo
346
360
  @foo.method(:inspect)
metadata CHANGED
@@ -1,30 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
2
4
  name: hardmock
3
5
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
6
+ version: 1.3.5
7
+ date: 2007-12-10 00:00:00 -05:00
8
+ summary: A strict, ordered, expectation-oriented mock object library.
9
+ require_paths:
10
+ - lib
11
+ email: crosby@atomicobject.com
12
+ homepage: http://hardmock.rubyforge.org
13
+ rubyforge_project: hardmock
14
+ description:
15
+ autorequire: hardmock
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
5
25
  platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
6
29
  authors:
7
30
  - David Crosby
8
- autorequire: hardmock
9
- bindir: bin
10
- cert_chain: []
11
-
12
- date: 2007-12-06 00:00:00 -05:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description:
17
- email: crosby@atomicobject.com
18
- executables: []
19
-
20
- extensions: []
21
-
22
- extra_rdoc_files:
23
- - README
24
- - CHANGES
25
- - LICENSE
26
31
  files:
27
32
  - lib/assert_error.rb
33
+ - lib/hardmock.rb
28
34
  - lib/hardmock/errors.rb
29
35
  - lib/hardmock/expectation.rb
30
36
  - lib/hardmock/expectation_builder.rb
@@ -35,13 +41,12 @@ files:
35
41
  - lib/hardmock/stubbing.rb
36
42
  - lib/hardmock/trapper.rb
37
43
  - lib/hardmock/utils.rb
38
- - lib/hardmock.rb
44
+ - test/test_helper.rb
39
45
  - test/functional/assert_error_test.rb
40
46
  - test/functional/auto_verify_test.rb
41
47
  - test/functional/direct_mock_usage_test.rb
42
48
  - test/functional/hardmock_test.rb
43
49
  - test/functional/stubbing_test.rb
44
- - test/test_helper.rb
45
50
  - test/unit/expectation_builder_test.rb
46
51
  - test/unit/expectation_test.rb
47
52
  - test/unit/expector_test.rb
@@ -58,37 +63,6 @@ files:
58
63
  - README
59
64
  - CHANGES
60
65
  - LICENSE
61
- has_rdoc: true
62
- homepage: http://hardmock.rubyforge.org
63
- post_install_message:
64
- rdoc_options:
65
- - --line-numbers
66
- - --inline-source
67
- - --main
68
- - README
69
- - --title
70
- - Hardmock
71
- require_paths:
72
- - lib
73
- required_ruby_version: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
78
- version:
79
- required_rubygems_version: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: "0"
84
- version:
85
- requirements: []
86
-
87
- rubyforge_project: hardmock
88
- rubygems_version: 0.9.5
89
- signing_key:
90
- specification_version: 2
91
- summary: A strict, ordered, expectation-oriented mock object library.
92
66
  test_files:
93
67
  - test/functional/assert_error_test.rb
94
68
  - test/functional/auto_verify_test.rb
@@ -103,3 +77,22 @@ test_files:
103
77
  - test/unit/mock_test.rb
104
78
  - test/unit/trapper_test.rb
105
79
  - test/unit/verify_error_test.rb
80
+ rdoc_options:
81
+ - --line-numbers
82
+ - --inline-source
83
+ - --main
84
+ - README
85
+ - --title
86
+ - Hardmock
87
+ extra_rdoc_files:
88
+ - README
89
+ - CHANGES
90
+ - LICENSE
91
+ executables: []
92
+
93
+ extensions: []
94
+
95
+ requirements: []
96
+
97
+ dependencies: []
98
+