bourne 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/NEWS.md +10 -0
- data/bourne.gemspec +1 -1
- data/lib/bourne/mock.rb +7 -3
- data/lib/bourne/version.rb +1 -1
- data/test/unit/mock_test.rb +13 -9
- metadata +55 -66
data/.gitignore
CHANGED
data/NEWS.md
ADDED
data/bourne.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
|
-
s.add_dependency('mocha', '
|
23
|
+
s.add_dependency('mocha', '0.12.3') # follow instructions in mock.rb to update
|
24
24
|
|
25
25
|
s.add_development_dependency('rake')
|
26
26
|
end
|
data/lib/bourne/mock.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
require 'mocha/mock'
|
2
2
|
require 'bourne/expectation'
|
3
|
+
require 'mocha/expectation_error_factory'
|
3
4
|
|
4
5
|
module Mocha # :nodoc:
|
5
|
-
# Overwrites #method_missing on Mocha::Mock
|
6
|
-
#
|
6
|
+
# Overwrites #method_missing on Mocha::Mock
|
7
|
+
# - pass arguments to .invoke() calls to create Invocation
|
8
|
+
# - keep lowest else branch (bourne code)
|
9
|
+
# - update from https://github.com/freerange/mocha/blob/master/lib/mocha/mock.rb#L195
|
10
|
+
# - update test/unit/mock_test.rb
|
7
11
|
class Mock # :nodoc:
|
8
12
|
def method_missing(symbol, *arguments, &block)
|
9
13
|
if @responder and not @responder.respond_to?(symbol)
|
@@ -16,7 +20,7 @@ module Mocha # :nodoc:
|
|
16
20
|
matching_expectation.invoke(arguments, &block) if matching_expectation
|
17
21
|
message = UnexpectedInvocation.new(self, symbol, *arguments).to_s
|
18
22
|
message << @mockery.mocha_inspect
|
19
|
-
raise
|
23
|
+
raise ExpectationErrorFactory.build(message, caller)
|
20
24
|
else
|
21
25
|
target = if self.respond_to? :mocha
|
22
26
|
self.mocha
|
data/lib/bourne/version.rb
CHANGED
data/test/unit/mock_test.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# to update:
|
2
|
+
# - copy new code from https://raw.github.com/freerange/mocha/master/test/unit/mock_test.rb
|
3
|
+
# - keep: require 'bourne/mock'
|
4
|
+
# - keep: FakeExpectation test
|
1
5
|
require File.expand_path('../../test_helper', __FILE__)
|
2
6
|
require 'bourne/mock'
|
3
7
|
require 'mocha/expectation_error'
|
@@ -9,18 +13,18 @@ class MockTest < Test::Unit::TestCase
|
|
9
13
|
include Mocha
|
10
14
|
|
11
15
|
def test_should_set_single_expectation
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
mock = build_mock
|
17
|
+
mock.expects(:method1).returns(1)
|
18
|
+
assert_nothing_raised(ExpectationError) do
|
19
|
+
assert_equal 1, mock.method1
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
def test_should_build_and_store_expectations
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
mock = build_mock
|
25
|
+
expectation = mock.expects(:method1)
|
26
|
+
assert_not_nil expectation
|
27
|
+
assert_equal [expectation], mock.__expectations__.to_a
|
24
28
|
end
|
25
29
|
|
26
30
|
def test_should_not_stub_everything_by_default
|
metadata
CHANGED
@@ -1,69 +1,61 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bourne
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 2
|
10
|
-
version: 1.1.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Joe Ferris
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
|
-
requirements:
|
24
|
-
- - "="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
hash: 61
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
- 10
|
30
|
-
- 5
|
31
|
-
version: 0.10.5
|
32
|
-
prerelease: false
|
33
|
-
requirement: *id001
|
12
|
+
date: 2012-10-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
34
15
|
name: mocha
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
38
17
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
- 0
|
45
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.12.3
|
22
|
+
type: :runtime
|
46
23
|
prerelease: false
|
47
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.12.3
|
30
|
+
- !ruby/object:Gem::Dependency
|
48
31
|
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
49
38
|
type: :development
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: ! "Extends mocha to allow detailed tracking and querying of\n stub
|
47
|
+
and mock invocations. Allows test spies using the have_received rspec\n matcher
|
48
|
+
and assert_received for Test::Unit. Extracted from the\n jferris-mocha fork."
|
55
49
|
email: jferris@thoughtbot.com
|
56
50
|
executables: []
|
57
|
-
|
58
51
|
extensions: []
|
59
|
-
|
60
52
|
extra_rdoc_files: []
|
61
|
-
|
62
|
-
files:
|
53
|
+
files:
|
63
54
|
- .gitignore
|
64
55
|
- .travis.yml
|
65
56
|
- Gemfile
|
66
57
|
- LICENSE
|
58
|
+
- NEWS.md
|
67
59
|
- README.md
|
68
60
|
- Rakefile
|
69
61
|
- bourne.gemspec
|
@@ -93,38 +85,35 @@ files:
|
|
93
85
|
- test/unit/mockery_test.rb
|
94
86
|
homepage: http://github.com/thoughtbot/bourne
|
95
87
|
licenses: []
|
96
|
-
|
97
88
|
post_install_message:
|
98
89
|
rdoc_options: []
|
99
|
-
|
100
|
-
require_paths:
|
90
|
+
require_paths:
|
101
91
|
- lib
|
102
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
93
|
none: false
|
104
|
-
requirements:
|
105
|
-
- -
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
segments:
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
segments:
|
109
99
|
- 0
|
110
|
-
|
111
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
hash: -1504688863187069383
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
102
|
none: false
|
113
|
-
requirements:
|
114
|
-
- -
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
|
117
|
-
segments:
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
segments:
|
118
108
|
- 0
|
119
|
-
|
109
|
+
hash: -1504688863187069383
|
120
110
|
requirements: []
|
121
|
-
|
122
111
|
rubyforge_project:
|
123
|
-
rubygems_version: 1.8.
|
112
|
+
rubygems_version: 1.8.24
|
124
113
|
signing_key:
|
125
114
|
specification_version: 3
|
126
115
|
summary: Adds test spies to mocha.
|
127
|
-
test_files:
|
116
|
+
test_files:
|
128
117
|
- test/acceptance/acceptance_test_helper.rb
|
129
118
|
- test/acceptance/mocha_example_test.rb
|
130
119
|
- test/acceptance/spy_test.rb
|