mocha 0.9.12 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Gemfile +3 -0
  2. data/Gemfile.minitest.1.3.0 +7 -0
  3. data/Gemfile.minitest.1.4.0 +7 -0
  4. data/Gemfile.minitest.1.4.1 +7 -0
  5. data/Gemfile.minitest.1.4.2 +7 -0
  6. data/Gemfile.minitest.2.0.0 +7 -0
  7. data/Gemfile.minitest.2.0.1 +7 -0
  8. data/Gemfile.minitest.2.3.0 +7 -0
  9. data/Gemfile.minitest.latest +7 -0
  10. data/Gemfile.test-unit.2.0.0 +8 -0
  11. data/Gemfile.test-unit.2.0.1 +7 -0
  12. data/Gemfile.test-unit.2.0.3 +7 -0
  13. data/Gemfile.test-unit.latest +7 -0
  14. data/README.rdoc +4 -0
  15. data/RELEASE.rdoc +22 -3
  16. data/Rakefile +17 -90
  17. data/init.rb +3 -0
  18. data/lib/mocha.rb +1 -1
  19. data/lib/mocha/central.rb +4 -4
  20. data/lib/mocha/class_method.rb +20 -20
  21. data/lib/mocha/expectation.rb +33 -6
  22. data/lib/mocha/instance_method.rb +17 -1
  23. data/lib/mocha/integration/mini_test.rb +17 -13
  24. data/lib/mocha/integration/mini_test/{version_201_to_202.rb → version_201_to_222.rb} +9 -9
  25. data/lib/mocha/integration/mini_test/version_230_to_251.rb +59 -0
  26. data/lib/mocha/integration/test_unit.rb +17 -13
  27. data/lib/mocha/integration/test_unit/{gem_version_203_to_209.rb → gem_version_203_to_220.rb} +8 -8
  28. data/lib/mocha/integration/test_unit/gem_version_230_to_233.rb +58 -0
  29. data/lib/mocha/mock.rb +14 -14
  30. data/lib/mocha/object.rb +1 -1
  31. data/lib/mocha/thrower.rb +15 -0
  32. data/lib/mocha/version.rb +3 -0
  33. data/mocha.gemspec +43 -0
  34. data/test/acceptance/acceptance_test_helper.rb +3 -0
  35. data/test/acceptance/expectations_on_multiple_methods_test.rb +55 -0
  36. data/test/acceptance/minitest_test.rb +12 -7
  37. data/test/acceptance/raise_exception_test.rb +39 -0
  38. data/test/acceptance/{stub_class_method_test.rb → stub_class_method_defined_on_active_record_association_proxy_test.rb} +3 -103
  39. data/test/acceptance/stub_class_method_defined_on_class_test.rb +72 -0
  40. data/test/acceptance/stub_class_method_defined_on_module_test.rb +75 -0
  41. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +75 -0
  42. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +93 -0
  43. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +69 -0
  44. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +66 -0
  45. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +75 -0
  46. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +75 -0
  47. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +75 -0
  48. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +70 -0
  49. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +72 -0
  50. data/test/acceptance/throw_test.rb +45 -0
  51. data/test/method_definer.rb +3 -3
  52. data/test/test_helper.rb +0 -6
  53. data/test/unit/central_test.rb +7 -3
  54. data/test/unit/class_method_test.rb +10 -10
  55. data/test/unit/mockery_test.rb +1 -0
  56. data/test/unit/thrower_test.rb +20 -0
  57. metadata +110 -33
  58. data/lib/mocha/metaclass.rb +0 -13
  59. data/test/acceptance/stub_instance_method_test.rb +0 -206
  60. data/test/unit/metaclass_test.rb +0 -22
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "minitest", "1.3.0"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "minitest", "1.4.0"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "minitest", "1.4.1"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "minitest", "1.4.2"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "minitest", "2.0.0"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "minitest", "2.0.1"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "minitest", "2.3.0"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "minitest"
7
+ end
@@ -0,0 +1,8 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "test-unit", "2.0.0"
7
+ gem "hoe", "2.8.0" # later versions of hoe depend on Rubygems >= 1.4 which in turn depends on Ruby >= 1.8.7
8
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "test-unit", "2.0.1"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "test-unit", "2.0.3"
7
+ end
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem "test-unit"
7
+ end
@@ -8,6 +8,10 @@ Mocha provides a unified, simple and readable syntax for both traditional mockin
8
8
 
9
9
  Mocha was harvested from projects at {Reevoo}[http://www.reevoo.com/] by me ({James}[http://jamesmead.org/]) and my (then) colleagues {Ben}[http://www.techbelly.com/], {Chris}[http://chrisroos.co.uk/] and {Paul}[http://po-ru.com/].
10
10
 
11
+ == Build Status
12
+
13
+ https://secure.travis-ci.org/floehopper/mocha.png
14
+
11
15
  == Download and Installation
12
16
 
13
17
  Install the gem with the following command...
@@ -1,4 +1,23 @@
1
- = 0.9.12 ()
1
+ = 0.10.0 ()
2
+ * Add Expectation#throws to allow a stubbed method to use Kernel#throw.
3
+ * Updates for versions of Test::Unit up to and including v2.3.3 (including patch by Jens Fahnenbruck).
4
+ * Updates for versions of MiniTest up to and including v2.5.1.
5
+ * Since the singleton method added by Mocha masks the underlying instance method, there's no need to move it out the way and then back again. This fixes Github issue #20, because the original method is left unchanged - https://github.com/floehopper/mocha/issues/20 (thanks to Nick Lewis).
6
+ * Handle stubbing of a singleton method, leaving the original method unchanged after the test.
7
+ * When stubbing an instance method that was originally defined as a singleton method, the original method should still exist after the test.
8
+ * Fixed mis-print in Mocha::ObjectMethods#unstub documentation (patch by Gleb Pomykalov).
9
+ * Improved test coverage around stubbing of methods defined in different ways - this makes use of the newly extracted introspection gem (although this means some tests are now failing in Ruby v1.9.2).
10
+ * Added configuration for Travis continuous integration.
11
+ * Make the gemspec the canonical reference and stop generating it from the Rakefile.
12
+ * Use the built-in Bundler rake tasks for packaging the gem.
13
+ * Use the "release" rake task provided by Bundler instead of using the Rake::XForge::Release functionality.
14
+ * Extract Object#__metaclass__ into a new metaclass gem.
15
+ * Run rake tasks without `bundle exec`.
16
+ * Avoid deprecation warning for rdoc rake task.
17
+ * Remove the `use_test_unit_gem` MOCHA_OPTION which hasn't worked since we switched to bundler - we can now run the tests specifying a different Gemfile instead.
18
+ * Use multiple Gemfiles seems to run Travis CI builds against multiple version of test-unit & minitest.
19
+
20
+ = 0.9.12 (8bb523e8467626c23b271eb529c33fb118e368fe)
2
21
  * Make Mocha's tests pass under Ruby 1.9.2 i.e. using MiniTest. One of the main issues was that we were not parsing stacktraces on MiniTest errors comprehensively enough.
3
22
  * Avoid 'circular require considered harmful' warning when running Mocha's tests in Ruby 1.9.2
4
23
  * Make performance tests work on Ruby 1.9.2 i.e. using MiniTest.
@@ -104,7 +123,7 @@
104
123
  * when a method on a non-existent method is stubbed
105
124
  * when a method on a non-mock object is stubbed
106
125
  * when a method is stubbed unnecessarily (i.e. the stubbed method is not called during the test)
107
-
126
+
108
127
  * Improved error messages
109
128
  * User-friendly list of unsatisfied expectations, satisfied expectations and state machines.
110
129
  * Improved readability of cardinality description.
@@ -220,7 +239,7 @@
220
239
  Time.now # => Mon Jan 01 00:00:00 UTC 2007
221
240
  Time.stubs(:now).returns(Time.parse('Thu Feb 01 00:00:00 UTC 2007'))
222
241
  Time.now # => Thu Feb 01 00:00:00 UTC 2007
223
-
242
+
224
243
  - Deprecate passing an instance of Proc to Expectation#returns.
225
244
  - Explicitly include all Rakefile dependencies in project.
226
245
  - Fixed old Stubba example.
data/Rakefile CHANGED
@@ -1,10 +1,9 @@
1
- require 'rake/rdoctask'
2
- require 'rake/gempackagetask'
3
- require 'rake/testtask'
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
3
+ require "bundler/setup"
4
4
 
5
- module Mocha
6
- VERSION = "0.9.12"
7
- end
5
+ require 'rdoc/task'
6
+ require 'rake/testtask'
8
7
 
9
8
  desc "Run all tests"
10
9
  task 'default' => ['test', 'test:performance']
@@ -15,7 +14,9 @@ task 'test' => ['test:units', 'test:acceptance']
15
14
  namespace 'test' do
16
15
 
17
16
  unit_tests = FileList['test/unit/**/*_test.rb']
18
- acceptance_tests = FileList['test/acceptance/*_test.rb']
17
+ all_acceptance_tests = FileList['test/acceptance/*_test.rb']
18
+ ruby186_incompatible_acceptance_tests = FileList['test/acceptance/stub_class_method_defined_on_*_test.rb'] + FileList['test/acceptance/stub_instance_method_defined_on_*_test.rb']
19
+ ruby186_compatible_acceptance_tests = all_acceptance_tests - ruby186_incompatible_acceptance_tests
19
20
 
20
21
  desc "Run unit tests"
21
22
  Rake::TestTask.new('units') do |t|
@@ -28,11 +29,15 @@ namespace 'test' do
28
29
  desc "Run acceptance tests"
29
30
  Rake::TestTask.new('acceptance') do |t|
30
31
  t.libs << 'test'
31
- t.test_files = acceptance_tests
32
+ if defined?(RUBY_VERSION) && (RUBY_VERSION >= "1.8.7")
33
+ t.test_files = all_acceptance_tests
34
+ else
35
+ t.test_files = ruby186_compatible_acceptance_tests
36
+ end
32
37
  t.verbose = true
33
38
  t.warning = true
34
39
  end
35
-
40
+
36
41
  # require 'rcov/rcovtask'
37
42
  # Rcov::RcovTask.new('coverage') do |t|
38
43
  # t.libs << 'test'
@@ -104,11 +109,8 @@ Rake::RDocTask.new('rdoc') do |task|
104
109
  )
105
110
  end
106
111
 
107
- desc "Generate all documentation"
108
- task 'generate_docs' => ['clobber_rdoc', 'rdoc', 'examples', 'agiledox.txt']
109
-
110
112
  desc "Upload RDoc to RubyForge"
111
- task 'publish_docs' do
113
+ task 'publish_docs' => ['clobber_rdoc', 'rdoc', 'examples', 'agiledox.txt'] do
112
114
  require 'rake/contrib/sshpublisher'
113
115
  Rake::SshDirPublisher.new("jamesmead@rubyforge.org", "/var/www/gforge-projects/mocha", "doc").upload
114
116
  end
@@ -150,81 +152,6 @@ task 'examples' do
150
152
  end
151
153
  end
152
154
 
153
- Gem.manage_gems if Gem::RubyGemsVersion < '1.2.0'
154
-
155
- def build_specification(version = Mocha::VERSION)
156
- Gem::Specification.new do |s|
157
- s.name = "mocha"
158
- s.summary = "Mocking and stubbing library"
159
- s.version = version
160
- s.platform = Gem::Platform::RUBY
161
- s.author = 'James Mead'
162
- s.description = <<-EOF
163
- Mocking and stubbing library with JMock/SchMock syntax, which allows mocking and stubbing of methods on real (non-mock) classes.
164
- EOF
165
- s.email = 'mocha-developer@googlegroups.com'
166
- s.homepage = 'http://mocha.rubyforge.org'
167
- s.rubyforge_project = 'mocha'
168
-
169
- s.has_rdoc = true
170
- s.extra_rdoc_files = ['README.rdoc', 'COPYING.rdoc']
171
- s.rdoc_options << '--title' << 'Mocha' << '--main' << 'README.rdoc' << '--line-numbers'
172
-
173
- if Gem::RubyGemsVersion < '1.2.0'
174
- s.add_dependency('rake')
175
- else
176
- s.add_development_dependency('rake')
177
- end
178
-
179
- s.files = FileList['{lib,test,examples}/**/*.rb', '[A-Z]*', '.gemtest'].exclude('TODO').to_a
180
- end
181
- end
182
-
183
- specification = build_specification
184
-
185
- Rake::GemPackageTask.new(specification) do |package|
186
- package.need_zip = true
187
- package.need_tar = true
188
- end
189
-
190
- desc 'Generate updated gemspec with unique version, which will cause gem to be auto-built on github.'
191
- task :gemspec do
192
- File.open('mocha.gemspec', 'w') do |output|
193
- output << build_specification(Mocha::VERSION + '.' + Time.now.strftime('%Y%m%d%H%M%S')).to_ruby
194
- end
195
- end
196
-
197
- task 'verify_user' do
198
- raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
199
- end
200
-
201
- task 'verify_password' do
202
- raise "RUBYFORGE_PASSWORD environment variable not set!" unless ENV['RUBYFORGE_PASSWORD']
203
- end
204
-
205
- desc "Publish package files on RubyForge."
206
- task 'publish_packages' => ['verify_user', 'verify_password', 'clobber_package', 'package'] do
207
- require 'meta_project'
208
- require 'rake/contrib/xforge'
209
- release_files = FileList[
210
- "pkg/mocha-#{Mocha::VERSION}.gem",
211
- "pkg/mocha-#{Mocha::VERSION}.tgz",
212
- "pkg/mocha-#{Mocha::VERSION}.zip"
213
- ]
214
-
215
- Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new('mocha')) do |release|
216
- release.user_name = ENV['RUBYFORGE_USER']
217
- release.password = ENV['RUBYFORGE_PASSWORD']
218
- release.files = release_files.to_a
219
- release.release_name = "Mocha #{Mocha::VERSION}"
220
- release.release_changes = ''
221
- release.release_notes = ''
222
- end
223
- end
224
-
225
- desc "Do a full release."
226
- task 'release' => ['default', 'generate_docs', 'publish_packages', 'publish_docs', 'gemspec'] do
227
- puts
228
- puts "*** Remember to commit newly generated gemspec after release ***"
229
- puts
155
+ task 'release' => 'default' do
156
+ Rake::Task['publish_docs'].invoke
230
157
  end
data/init.rb ADDED
@@ -0,0 +1,3 @@
1
+ # Mocha should no longer be loaded at plugin load time
2
+ # You should explicitly load Mocha *after* Test::Unit or MiniTest have been loaded
3
+ # e.g. by adding "require 'mocha'" at the bottom of test/test_helper.rb
@@ -1,4 +1,4 @@
1
- require 'mocha/options'
1
+ require 'mocha/version'
2
2
  require 'mocha_standalone'
3
3
  require 'mocha/configuration'
4
4
  require 'mocha/integration'
@@ -9,16 +9,16 @@ module Mocha
9
9
  end
10
10
 
11
11
  def stub(method)
12
- unless stubba_methods.include?(method)
12
+ unless stubba_methods.detect { |m| m.matches?(method) }
13
13
  method.stub
14
14
  stubba_methods.push(method)
15
15
  end
16
16
  end
17
17
 
18
18
  def unstub(method)
19
- if stubba_methods.include?(method)
20
- method.unstub
21
- stubba_methods.delete(method)
19
+ if existing = stubba_methods.detect { |m| m.matches?(method) }
20
+ existing.unstub
21
+ stubba_methods.delete(existing)
22
22
  end
23
23
  end
24
24
 
@@ -1,31 +1,31 @@
1
- require 'mocha/metaclass'
1
+ require 'metaclass'
2
2
 
3
3
  module Mocha
4
4
 
5
5
  class ClassMethod
6
-
6
+
7
7
  attr_reader :stubbee, :method
8
-
8
+
9
9
  def initialize(stubbee, method)
10
10
  @stubbee = stubbee
11
11
  @method = RUBY_VERSION < '1.9' ? method.to_s : method.to_sym
12
12
  end
13
-
13
+
14
14
  def stub
15
15
  hide_original_method
16
16
  define_new_method
17
17
  end
18
-
18
+
19
19
  def unstub
20
20
  remove_new_method
21
21
  restore_original_method
22
22
  stubbee.reset_mocha
23
23
  end
24
-
24
+
25
25
  def mock
26
26
  stubbee.mocha
27
27
  end
28
-
28
+
29
29
  def hide_original_method
30
30
  if method_exists?(method)
31
31
  begin
@@ -35,7 +35,7 @@ module Mocha
35
35
  end
36
36
  end
37
37
  end
38
-
38
+
39
39
  def define_new_method
40
40
  stubbee.__metaclass__.class_eval(%{
41
41
  def #{method}(*args, &block)
@@ -43,11 +43,11 @@ module Mocha
43
43
  end
44
44
  }, __FILE__, __LINE__)
45
45
  end
46
-
46
+
47
47
  def remove_new_method
48
48
  stubbee.__metaclass__.send(:remove_method, method)
49
49
  end
50
-
50
+
51
51
  def restore_original_method
52
52
  if method_exists?(hidden_method)
53
53
  begin
@@ -58,7 +58,7 @@ module Mocha
58
58
  end
59
59
  end
60
60
  end
61
-
61
+
62
62
  def hidden_method
63
63
  if RUBY_VERSION < '1.9'
64
64
  method_name = method.to_s.gsub(/\W/) { |s| "_substituted_character_#{s[0]}_" }
@@ -67,25 +67,25 @@ module Mocha
67
67
  end
68
68
  hidden_method = "__stubba__#{method_name}__stubba__"
69
69
  RUBY_VERSION < '1.9' ? hidden_method.to_s : hidden_method.to_sym
70
- end
71
-
72
- def eql?(other)
70
+ end
71
+
72
+ def matches?(other)
73
73
  return false unless (other.class == self.class)
74
74
  (stubbee.object_id == other.stubbee.object_id) and (method == other.method)
75
75
  end
76
-
76
+
77
77
  alias_method :==, :eql?
78
-
78
+
79
79
  def to_s
80
80
  "#{stubbee}.#{method}"
81
81
  end
82
-
82
+
83
83
  def method_exists?(method)
84
84
  symbol = method.to_sym
85
- metaclass = stubbee.__metaclass__
86
- metaclass.public_method_defined?(symbol) || metaclass.protected_method_defined?(symbol) || metaclass.private_method_defined?(symbol)
85
+ __metaclass__ = stubbee.__metaclass__
86
+ __metaclass__.public_method_defined?(symbol) || __metaclass__.protected_method_defined?(symbol) || __metaclass__.private_method_defined?(symbol)
87
87
  end
88
88
 
89
89
  end
90
-
90
+
91
91
  end
@@ -3,6 +3,7 @@ require 'mocha/parameters_matcher'
3
3
  require 'mocha/expectation_error'
4
4
  require 'mocha/return_values'
5
5
  require 'mocha/exception_raiser'
6
+ require 'mocha/thrower'
6
7
  require 'mocha/yield_parameters'
7
8
  require 'mocha/is_a'
8
9
  require 'mocha/in_state_ordering_constraint'
@@ -287,20 +288,20 @@ module Mocha # :nodoc:
287
288
  # :call-seq: raises(exception = RuntimeError, message = nil) -> expectation
288
289
  #
289
290
  # Modifies expectation so that when the expected method is called, it raises the specified +exception+ with the specified +message+ i.e. calls Kernel#raise(exception, message).
290
- # object = mock()
291
- # object.expects(:expected_method).raises(Exception, 'message')
291
+ # object = stub()
292
+ # object.stubs(:expected_method).raises(Exception, 'message')
292
293
  # object.expected_method # => raises exception of class Exception and with message 'message'
293
294
  # Note that if you have a custom exception class with extra constructor parameters, you can pass in an instance of the exception (just as you can for Kernel#raise).
294
- # object = mock()
295
- # object.expects(:expected_method).raises(MyException.new('message', 1, 2, 3))
295
+ # object = stub()
296
+ # object.stubs(:expected_method).raises(MyException.new('message', 1, 2, 3))
296
297
  # object.expected_method # => raises the specified instance of MyException
297
298
  # May be called multiple times on the same expectation. Also see Expectation#then.
298
- # object = mock()
299
+ # object = stub()
299
300
  # object.stubs(:expected_method).raises(Exception1).then.raises(Exception2)
300
301
  # object.expected_method # => raises exception of class Exception1
301
302
  # object.expected_method # => raises exception of class Exception2
302
303
  # May be called in conjunction with Expectation#returns on the same expectation.
303
- # object = mock()
304
+ # object = stub()
304
305
  # object.stubs(:expected_method).raises(Exception).then.returns(2, 3)
305
306
  # object.expected_method # => raises exception of class Exception1
306
307
  # object.expected_method # => 2
@@ -310,6 +311,32 @@ module Mocha # :nodoc:
310
311
  self
311
312
  end
312
313
 
314
+ # :call-seq: throws(tag, object = nil) -> expectation
315
+ #
316
+ # Modifies expectation so that when the expected method is called, it throws the specified +tag+ with the specific return value +object+ i.e. calls Kernel#throw(tag, object).
317
+ # object = stub()
318
+ # object.stubs(:expected_method).throws(:done)
319
+ # object.expected_method # => throws tag :done
320
+ # Note you can also pass in an optional return value +object+ (just as you can for Kernel#throw).
321
+ # object = stub()
322
+ # object.stubs(:expected_method).throws(:done, 'result')
323
+ # object.expected_method # => throws tag :done and causes catch block to return 'result'
324
+ # May be called multiple times on the same expectation. Also see Expectation#then.
325
+ # object = stub()
326
+ # object.stubs(:expected_method).throws(:done).then.throws(:continue)
327
+ # object.expected_method # => throws :done
328
+ # object.expected_method # => throws :continue
329
+ # May be called in conjunction with Expectation#returns on the same expectation.
330
+ # object = stub()
331
+ # object.stubs(:expected_method).throws(:done).then.returns(2, 3)
332
+ # object.expected_method # => throws :done
333
+ # object.expected_method # => 2
334
+ # object.expected_method # => 3
335
+ def throws(tag, object = nil)
336
+ @return_values += ReturnValues.new(Thrower.new(tag, object))
337
+ self
338
+ end
339
+
313
340
  # :call-seq: then() -> expectation
314
341
  # then(state_machine.is(state)) -> expectation
315
342
  #