rspec-mocks 2.6.0 → 2.7.0.rc1

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.
Files changed (66) hide show
  1. data/features/Scope.md +17 -0
  2. data/features/argument_matchers/README.md +27 -0
  3. data/features/argument_matchers/explicit.feature +60 -0
  4. data/features/argument_matchers/general_matchers.feature +85 -0
  5. data/features/argument_matchers/type_matchers.feature +25 -0
  6. data/features/message_expectations/any_instance.feature +2 -0
  7. data/features/message_expectations/receive_counts.feature +209 -0
  8. data/features/method_stubs/README.md +6 -10
  9. data/features/method_stubs/any_instance.feature +111 -1
  10. data/features/method_stubs/simple_return_value.feature +34 -25
  11. data/features/method_stubs/stub_implementation.feature +1 -1
  12. data/features/method_stubs/to_ary.feature +12 -10
  13. data/features/support/env.rb +1 -1
  14. data/lib/rspec/mocks.rb +1 -1
  15. data/lib/rspec/mocks/any_instance.rb +8 -235
  16. data/lib/rspec/mocks/any_instance/chain.rb +49 -0
  17. data/lib/rspec/mocks/any_instance/expectation_chain.rb +33 -0
  18. data/lib/rspec/mocks/any_instance/message_chains.rb +48 -0
  19. data/lib/rspec/mocks/any_instance/recorder.rb +162 -0
  20. data/lib/rspec/mocks/any_instance/stub_chain.rb +35 -0
  21. data/lib/rspec/mocks/any_instance/stub_chain_chain.rb +34 -0
  22. data/lib/rspec/mocks/argument_expectation.rb +1 -1
  23. data/lib/rspec/mocks/extensions/marshal.rb +1 -1
  24. data/lib/rspec/mocks/extensions/psych.rb +1 -1
  25. data/lib/rspec/mocks/methods.rb +1 -1
  26. data/lib/rspec/mocks/mock.rb +2 -2
  27. data/lib/rspec/mocks/proxy.rb +1 -1
  28. data/lib/rspec/mocks/version.rb +1 -1
  29. data/spec/rspec/mocks/any_instance/message_chains_spec.rb +40 -0
  30. data/spec/rspec/mocks/any_instance_spec.rb +147 -2
  31. data/spec/rspec/mocks/any_number_of_times_spec.rb +2 -2
  32. data/spec/rspec/mocks/argument_expectation_spec.rb +15 -3
  33. data/spec/rspec/mocks/at_least_spec.rb +1 -1
  34. data/spec/rspec/mocks/at_most_spec.rb +1 -1
  35. data/spec/rspec/mocks/bug_report_10263_spec.rb +1 -1
  36. data/spec/rspec/mocks/bug_report_7611_spec.rb +1 -1
  37. data/spec/rspec/mocks/bug_report_8165_spec.rb +2 -2
  38. data/spec/rspec/mocks/bug_report_957_spec.rb +2 -2
  39. data/spec/rspec/mocks/failing_argument_matchers_spec.rb +1 -1
  40. data/spec/rspec/mocks/hash_including_matcher_spec.rb +11 -11
  41. data/spec/rspec/mocks/hash_not_including_matcher_spec.rb +6 -6
  42. data/spec/rspec/mocks/mock_spec.rb +49 -43
  43. data/spec/rspec/mocks/multiple_return_value_spec.rb +26 -26
  44. data/spec/rspec/mocks/partial_mock_spec.rb +3 -2
  45. data/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +1 -0
  46. data/spec/rspec/mocks/passing_argument_matchers_spec.rb +3 -3
  47. data/spec/rspec/mocks/precise_counts_spec.rb +1 -1
  48. data/spec/rspec/mocks/serialization_spec.rb +7 -2
  49. data/spec/rspec/mocks/stub_implementation_spec.rb +6 -6
  50. data/spec/rspec/mocks/stub_spec.rb +6 -6
  51. data/spec/rspec/mocks/to_ary_spec.rb +9 -0
  52. metadata +54 -47
  53. data/.autotest +0 -7
  54. data/.document +0 -5
  55. data/.gitignore +0 -10
  56. data/.travis.yml +0 -7
  57. data/Gemfile +0 -40
  58. data/Guardfile +0 -8
  59. data/License.txt +0 -22
  60. data/Rakefile +0 -75
  61. data/autotest/discover.rb +0 -1
  62. data/cucumber.yml +0 -2
  63. data/features/.nav +0 -17
  64. data/features/Changelog.md +0 -80
  65. data/rspec-mocks.gemspec +0 -25
  66. data/specs.watchr +0 -57
data/.autotest DELETED
@@ -1,7 +0,0 @@
1
- Autotest.add_hook :initialize do |at|
2
- at.clear_mappings
3
- at.add_mapping(%r%\.rb$%) {
4
- at.files_matching %r%^spec/.*_spec\.rb$%
5
- }
6
- end
7
-
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.markdown
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- License.txt
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
6
- doc
7
- tmp
8
- rerun.txt
9
- Gemfile.lock
10
- .bundle
@@ -1,7 +0,0 @@
1
- script: "rake"
2
- rvm:
3
- - 1.8.6
4
- - 1.8.7
5
- - 1.9.1
6
- - 1.9.2
7
- - ree
data/Gemfile DELETED
@@ -1,40 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- ### rspec libs
4
- %w[rspec rspec-core rspec-expectations rspec-mocks].each do |lib|
5
- library_path = File.expand_path("../../#{lib}", __FILE__)
6
- if File.exist?(library_path)
7
- gem lib, :path => library_path
8
- else
9
- gem lib, :git => "git://github.com/rspec/#{lib}.git"
10
- end
11
- end
12
-
13
- ### dev dependencies
14
- gem "rake", "0.8.7"
15
- gem "cucumber", "~> 0.10.2"
16
- gem "aruba", "~> 0.3.6"
17
- gem "rcov", "0.9.9", :platforms => :mri
18
- gem "relish", "0.2.0"
19
- gem "guard-rspec", "0.1.9"
20
- gem "growl", "1.0.3"
21
- gem "nokogiri", "1.4.4"
22
-
23
- platforms :mri_18 do
24
- gem 'ruby-debug'
25
- end
26
-
27
- platforms :mri_19 do
28
- gem 'linecache19', '0.5.11' # 0.5.12 cannot install on 1.9.1, and 0.5.11 appears to work with both 1.9.1 & 1.9.2
29
- gem 'ruby-debug19'
30
- gem 'ruby-debug-base19', RUBY_VERSION == '1.9.1' ? '0.11.23' : '~> 0.11.24'
31
- end
32
-
33
- platforms :mri_18, :mri_19 do
34
- gem "rb-fsevent", "~> 0.3.9"
35
- gem "ruby-prof", "~> 0.9.2"
36
- end
37
-
38
- platforms :jruby do
39
- gem "jruby-openssl"
40
- end
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at http://github.com/guard/guard#readme
3
-
4
- guard 'rspec', :version => 2 do
5
- watch(/^spec\/(.*)_spec.rb/)
6
- watch(/^lib\/(.*)\.rb/) { "spec" }
7
- watch(/^spec\/spec_helper.rb/) { "spec" }
8
- end
@@ -1,22 +0,0 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2005 The RSpec Development Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,75 +0,0 @@
1
- require 'bundler'
2
- Bundler.setup
3
- Bundler::GemHelper.install_tasks
4
-
5
- require 'rake'
6
- require 'rspec/core/rake_task'
7
- require 'rspec/mocks/version'
8
-
9
- task :cleanup_rcov_files do
10
- rm_rf 'coverage.data'
11
- end
12
-
13
- desc "Run all examples"
14
- RSpec::Core::RakeTask.new(:spec) do |t|
15
- t.rspec_opts = %w[--color]
16
- end
17
-
18
- namespace :spec do
19
- desc "Run all examples using rcov"
20
- RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
21
- t.rcov = true
22
- t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
23
- t.rcov_opts << %[--text-report --sort coverage --no-html --aggregate coverage.data]
24
- end
25
- end
26
-
27
- task :default => :spec
28
-
29
- begin
30
- require 'cucumber/rake/task'
31
-
32
- class Cucumber::Rake::Task::ForkedCucumberRunner
33
- # When cucumber shells out, we still need it to run in the context of our
34
- # bundle.
35
- def run
36
- sh "bundle exec #{RUBY} " + args.join(" ")
37
- end
38
- end
39
-
40
- Cucumber::Rake::Task.new(:cucumber)
41
-
42
- namespace :cucumber do
43
- desc "Run cucumber features using rcov"
44
- Cucumber::Rake::Task.new :rcov => :cleanup_rcov_files do |t|
45
- t.cucumber_opts = %w{--format progress}
46
- t.rcov = true
47
- t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
48
- t.rcov_opts << %[--text-report --sort coverage --aggregate coverage.data]
49
- end
50
- end
51
-
52
- task :default => :cucumber
53
- rescue LoadError
54
- $stderr.puts "unable to load cucumber, some tasks unavailable"
55
- end
56
-
57
- task :clobber do
58
- rm_rf 'pkg'
59
- rm_rf 'tmp'
60
- rm_rf 'coverage'
61
- end
62
-
63
- require 'rake/rdoctask'
64
- Rake::RDocTask.new do |rdoc|
65
- rdoc.rdoc_dir = 'rdoc'
66
- rdoc.title = "rspec-mocks #{RSpec::Mocks::Version::STRING}"
67
- rdoc.rdoc_files.include('README*')
68
- rdoc.rdoc_files.include('lib/**/*.rb')
69
- end
70
-
71
- desc "Push docs/cukes to relishapp using the relish-client-gem"
72
- task :relish, :version do |t, args|
73
- raise "rake relish[VERSION]" unless args[:version]
74
- sh "relish push rspec/rspec-mocks:#{args[:version]}"
75
- end
@@ -1 +0,0 @@
1
- Autotest.add_discovery { "rspec2" }
@@ -1,2 +0,0 @@
1
- default: --require features --tags ~@wip features --format progress
2
- wip: --require features --tags @wip:3 --wip features
@@ -1,17 +0,0 @@
1
- - Upgrade.md
2
- - Changelog.md
3
- - method_stubs:
4
- - simple_return_value.feature
5
- - stub_implementation.feature
6
- - stub_chain.feature
7
- - any_instance.feature
8
- - as_null_object.feature
9
- - to_ary.feature
10
- - message_expectations:
11
- - expect_message.feature
12
- - any_instance.feature
13
- - block_local_expectations.feature.pending
14
- - warn_when_expectation_is_set_on_nil.feature
15
- - outside_rspec:
16
- - configuration.feature
17
- - standalone.feature
@@ -1,80 +0,0 @@
1
- ### 2.6.0 / 2011-05-12
2
-
3
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.5.0...v2.6.0)
4
-
5
- * Enhancements
6
- * Add support for `any_instance.stub` and `any_instance.should_receive` (Sidu
7
- Ponnappa and Andy Lindeman)
8
-
9
- * Bug fixes
10
- * fix bug in which multiple chains with shared messages ending in hashes
11
- failed to return the correct value
12
-
13
- ### 2.5.0 / 2011-02-05
14
-
15
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.4.0...v2.5.0)
16
-
17
- * Bug fixes
18
- * message expectation counts now work in combination with a stub (Damian
19
- Nurzynski)
20
- * fix failure message when message received with incorrect args (Josep M.
21
- Bach)
22
-
23
- ### 2.4.0 / 2011-01-02
24
-
25
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.3.0...v2.4.0)
26
-
27
- No functional changes in this release, which was made to align with the
28
- rspec-core-2.4.0 release.
29
-
30
- ### 2.3.0 / 2010-12-12
31
-
32
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.2.0...v2.3.0)
33
-
34
- * Bug fixes
35
- * Fix our Marshal extension so that it does not interfere with objects that
36
- have their own @mock_proxy instance variable. (Myron Marston)
37
-
38
- ### 2.2.0 / 2010-11-28
39
-
40
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.1.0...v2.2.0)
41
-
42
- * Enhancements
43
- * Added "rspec/mocks/standalone" for exploring the rspec-mocks in irb.
44
-
45
- * Bug fix
46
- * Eliminate warning on splat args without parens (Gioele Barabucci)
47
- * Fix bug where obj.should_receive(:foo).with(stub.as_null_object) would
48
- pass with a false positive.
49
-
50
- ### 2.1.0 / 2010-11-07
51
-
52
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.1...v2.1.0)
53
-
54
- * Bug fixes
55
- * Fix serialization of stubbed object (Josep M Bach)
56
-
57
- ### 2.0.0 / 2010-10-10
58
-
59
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.22...v2.0.0)
60
-
61
- ### 2.0.0.rc / 2010-10-05
62
-
63
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.22...v2.0.0.rc)
64
-
65
- * Enhancements
66
- * support passing a block to an expecttation block (Nicolas Braem)
67
- * obj.should_receive(:msg) {|&block| ... }
68
-
69
- * Bug fixes
70
- * Fix YAML serialization of stub (Myron Marston)
71
- * Fix rdoc rake task (Hans de Graaff)
72
-
73
- ### 2.0.0.beta.22 / 2010-09-12
74
-
75
- [full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.20...v2.0.0.beta.22)
76
-
77
- * Bug fixes
78
- * fixed regression that broke obj.stub_chain(:a, :b => :c)
79
- * fixed regression that broke obj.stub_chain(:a, :b) { :c }
80
- * respond_to? always returns true when using as_null_object
@@ -1,25 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
- require "rspec/mocks/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "rspec-mocks"
7
- s.version = RSpec::Mocks::Version::STRING
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["David Chelimsky", "Chad Humphries"]
10
- s.email = "dchelimsky@gmail.com;chad.humphries@gmail.com"
11
- s.homepage = "http://github.com/rspec/rspec-mocks"
12
- s.summary = "rspec-mocks-#{RSpec::Mocks::Version::STRING}"
13
- s.description = "RSpec's 'test double' framework, with support for stubbing and mocking"
14
-
15
- s.rubygems_version = "1.3.7"
16
- s.rubyforge_project = "rspec"
17
-
18
- s.files = `git ls-files`.split("\n")
19
- s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
20
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
- s.extra_rdoc_files = [ "README.md" ]
22
- s.rdoc_options = ["--charset=UTF-8"]
23
- s.require_path = "lib"
24
- end
25
-
@@ -1,57 +0,0 @@
1
- # Run me with:
2
- #
3
- # $ watchr specs.watchr
4
-
5
- # --------------------------------------------------
6
- # Convenience Methods
7
- # --------------------------------------------------
8
- def all_test_files
9
- Dir['spec/**/*_spec.rb']
10
- end
11
-
12
- def run_test_matching(thing_to_match)
13
- matches = all_test_files.grep(/#{thing_to_match}/i)
14
- if matches.empty?
15
- puts "Sorry, thanks for playing, but there were no matches for #{thing_to_match}"
16
- else
17
- run matches.join(' ')
18
- end
19
- end
20
-
21
- def run(files_to_run)
22
- puts("Running: #{files_to_run}")
23
- system("clear;rspec -cfs #{files_to_run}")
24
- no_int_for_you
25
- end
26
-
27
- def run_all
28
- run(all_test_files.join(' '))
29
- end
30
-
31
- # --------------------------------------------------
32
- # Watchr Rules
33
- # --------------------------------------------------
34
- watch('^spec/(.*)_spec\.rb') { run_all }
35
- watch('^lib/(.*)\.rb') { run_all }
36
-
37
- # --------------------------------------------------
38
- # Signal Handling
39
- # --------------------------------------------------
40
-
41
- def no_int_for_you
42
- @sent_an_int = nil
43
- end
44
-
45
- Signal.trap 'INT' do
46
- if @sent_an_int then
47
- puts " A second INT? Ok, I get the message. Shutting down now."
48
- exit
49
- else
50
- puts " Did you just send me an INT? Ugh. I'll quit for real if you do it again."
51
- @sent_an_int = true
52
- Kernel.sleep 1.5
53
- run_all
54
- end
55
- end
56
-
57
- # vim:ft=ruby