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 CHANGED
@@ -5,3 +5,5 @@ pkg
5
5
  tags
6
6
  rdoc
7
7
  *.gem
8
+ Gemfile.lock
9
+ .bundle
data/NEWS.md ADDED
@@ -0,0 +1,10 @@
1
+ 1.1.2 (2012-03-23)
2
+ * Mention when a method is unstubbed
3
+ * Compatible with Mocha 0.10.5
4
+
5
+ 1.1.1 (2012-03-04)
6
+ * Exactly the same as 1.1.0, but built with 1.8.7 so people with 1.8.7 can
7
+ install the gem.
8
+
9
+ 1.1.0 (2012-02-24)
10
+ * 1.9 compatible
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', '= 0.10.5')
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 so pass arguments to
6
- # Mocha::Expectation#invoke so that an Invocation can be created.
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 ExpectationError.new(message, caller)
23
+ raise ExpectationErrorFactory.build(message, caller)
20
24
  else
21
25
  target = if self.respond_to? :mocha
22
26
  self.mocha
@@ -1,3 +1,3 @@
1
1
  module Bourne
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
@@ -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
- mock = build_mock
13
- mock.expects(:method1).returns(1)
14
- assert_nothing_raised(ExpectationError) do
15
- assert_equal 1, mock.method1
16
- end
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
- mock = build_mock
21
- expectation = mock.expects(:method1)
22
- assert_not_nil expectation
23
- assert_equal [expectation], mock.__expectations__.to_a
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
- hash: 23
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
- date: 2012-03-23 00:00:00 Z
19
- dependencies:
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
- type: :runtime
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
- hash: 3
43
- segments:
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
- requirement: *id002
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
- description: |-
51
- Extends mocha to allow detailed tracking and querying of
52
- stub and mock invocations. Allows test spies using the have_received rspec
53
- matcher and assert_received for Test::Unit. Extracted from the
54
- jferris-mocha fork.
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
- hash: 3
108
- segments:
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ segments:
109
99
  - 0
110
- version: "0"
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
- hash: 3
117
- segments:
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ segments:
118
108
  - 0
119
- version: "0"
109
+ hash: -1504688863187069383
120
110
  requirements: []
121
-
122
111
  rubyforge_project:
123
- rubygems_version: 1.8.15
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