rspec-mocks 2.0.0.a2 → 2.0.0.a3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.document +2 -2
  2. data/.gitignore +1 -0
  3. data/README.markdown +20 -4
  4. data/Rakefile +2 -12
  5. data/lib/rspec/mocks/extensions/instance_exec.rb +31 -0
  6. data/lib/rspec/mocks/message_expectation.rb +1 -1
  7. data/lib/rspec/mocks/version.rb +1 -1
  8. data/rspec-mocks.gemspec +9 -8
  9. data/spec/rspec/mocks/any_number_of_times_spec.rb +1 -1
  10. data/spec/rspec/mocks/argument_expectation_spec.rb +1 -1
  11. data/spec/rspec/mocks/at_least_spec.rb +1 -1
  12. data/spec/rspec/mocks/at_most_spec.rb +1 -1
  13. data/spec/rspec/mocks/bug_report_10260_spec.rb +1 -1
  14. data/spec/rspec/mocks/bug_report_11545_spec.rb +1 -1
  15. data/spec/rspec/mocks/bug_report_15719_spec.rb +1 -1
  16. data/spec/rspec/mocks/bug_report_496_spec.rb +1 -1
  17. data/spec/rspec/mocks/bug_report_600_spec.rb +1 -1
  18. data/spec/rspec/mocks/bug_report_7611_spec.rb +1 -1
  19. data/spec/rspec/mocks/bug_report_7805_spec.rb +1 -1
  20. data/spec/rspec/mocks/bug_report_8165_spec.rb +1 -1
  21. data/spec/rspec/mocks/bug_report_8302_spec.rb +1 -1
  22. data/spec/rspec/mocks/bug_report_830_spec.rb +1 -1
  23. data/spec/rspec/mocks/failing_argument_matchers_spec.rb +1 -1
  24. data/spec/rspec/mocks/hash_including_matcher_spec.rb +1 -1
  25. data/spec/rspec/mocks/hash_not_including_matcher_spec.rb +1 -1
  26. data/spec/rspec/mocks/mock_ordering_spec.rb +1 -1
  27. data/spec/rspec/mocks/mock_space_spec.rb +1 -1
  28. data/spec/rspec/mocks/mock_spec.rb +2 -2
  29. data/spec/rspec/mocks/multiple_return_value_spec.rb +1 -1
  30. data/spec/rspec/mocks/nil_expectation_warning_spec.rb +1 -1
  31. data/spec/rspec/mocks/null_object_mock_spec.rb +1 -1
  32. data/spec/rspec/mocks/once_counts_spec.rb +1 -1
  33. data/spec/rspec/mocks/options_hash_spec.rb +1 -1
  34. data/spec/rspec/mocks/partial_mock_spec.rb +1 -1
  35. data/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +1 -1
  36. data/spec/rspec/mocks/passing_argument_matchers_spec.rb +1 -1
  37. data/spec/rspec/mocks/precise_counts_spec.rb +1 -1
  38. data/spec/rspec/mocks/record_messages_spec.rb +1 -1
  39. data/spec/rspec/mocks/stub_chain_spec.rb +1 -1
  40. data/spec/rspec/mocks/stub_implementation_spec.rb +1 -1
  41. data/spec/rspec/mocks/stub_spec.rb +1 -1
  42. data/spec/rspec/mocks/stubbed_message_expectations_spec.rb +1 -1
  43. data/spec/rspec/mocks/twice_counts_spec.rb +1 -1
  44. metadata +5 -4
data/.document CHANGED
@@ -1,5 +1,5 @@
1
- README.rdoc
1
+ README.markdown
2
2
  lib/**/*.rb
3
3
  bin/*
4
4
  features/**/*.feature
5
- LICENSE
5
+ License.txt
data/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  coverage
4
4
  rdoc
5
5
  pkg
6
+ doc
@@ -1,8 +1,24 @@
1
- # RSpec Mocks
1
+ # Rspec Mocks
2
+
3
+ rspec-mocks provides a test-double framework for rspec including support
4
+ for method stubs, fakes, and message expectations.
5
+
6
+ rspec-mocks is currently in alpha release. While you are welcome to
7
+ track, fork, explore, etc, we're too early in the process to start fielding
8
+ pull requests and or issues from outside the core development team, so please
9
+ don't waste your time until this notice changes.
10
+
11
+ ## Install
12
+
13
+ [sudo] gem install rspec --prerelease
14
+
15
+ This will install rspec, rspec-core, rspec-expectations and rspec-mocks.
2
16
 
3
- See README.markdown at [http://github.com/rspec/meta](http://github.com/rspec/meta)
4
17
 
5
18
  #### Also see
6
19
 
7
- * [http://github.com/rspec/core](http://github.com/rspec/core)
8
- * [http://github.com/rspec/expectations](http://github.com/rspec/expectations)
20
+ * [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
21
+ * [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core)
22
+ * [http://github.com/rspec/rspec-expectations](http://github.com/rspec/rspec-expectations)
23
+ * [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev)
24
+
data/Rakefile CHANGED
@@ -28,12 +28,9 @@ end
28
28
 
29
29
  begin
30
30
  require 'rspec/core/rake_task'
31
- Rspec::Core::RakeTask.new(:spec) do |spec|
32
- spec.pattern = 'spec/**/*_spec.rb'
33
- end
31
+ Rspec::Core::RakeTask.new(:spec)
34
32
 
35
33
  Rspec::Core::RakeTask.new(:rcov) do |spec|
36
- spec.pattern = 'spec/**/*_spec.rb'
37
34
  spec.rcov = true
38
35
  spec.rcov_opts = %[--exclude "core,expectations,gems/*,spec/resources,spec/spec,spec/spec_helper.rb,db/*,/Library/Ruby/*,config/*" --text-summary --sort coverage]
39
36
  end
@@ -49,15 +46,8 @@ task :default => [:check_dependencies, :spec]
49
46
 
50
47
  require 'rake/rdoctask'
51
48
  Rake::RDocTask.new do |rdoc|
52
- if File.exist?('VERSION.yml')
53
- config = YAML.load(File.read('VERSION.yml'))
54
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
55
- else
56
- version = ""
57
- end
58
-
59
49
  rdoc.rdoc_dir = 'rdoc'
60
- rdoc.title = "rspec-mocks #{version}"
50
+ rdoc.title = "rspec-mocks #{Rspec::Mocks::Version::STRING}"
61
51
  rdoc.rdoc_files.include('README*')
62
52
  rdoc.rdoc_files.include('lib/**/*.rb')
63
53
  end
@@ -0,0 +1,31 @@
1
+ module Rspec
2
+ module Core
3
+ module InstanceExec
4
+ unless respond_to?(:instance_exec)
5
+ # based on Bounded Spec InstanceExec (Mauricio Fernandez)
6
+ # http://eigenclass.org/hiki/bounded+space+instance_exec
7
+ # - uses singleton_class of matcher instead of global
8
+ # InstanceExecHelper module
9
+ # - this keeps it scoped to this class only, which is the
10
+ # only place we need it
11
+ # - only necessary for ruby 1.8.6
12
+ def instance_exec(*args, &block)
13
+ singleton_class = (class << self; self; end)
14
+ begin
15
+ orig_critical, Thread.critical = Thread.critical, true
16
+ n = 0
17
+ n += 1 while respond_to?(method_name="__instance_exec#{n}")
18
+ singleton_class.module_eval{ define_method(:__instance_exec, &block) }
19
+ ensure
20
+ Thread.critical = orig_critical
21
+ end
22
+ begin
23
+ return send(:__instance_exec, *args)
24
+ ensure
25
+ singleton_class.module_eval{ remove_method(:__instance_exec) } rescue nil
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -88,7 +88,7 @@ module Rspec
88
88
  end
89
89
 
90
90
  if block
91
- require 'rspec/core/extensions/instance_exec'
91
+ require 'rspec/mocks/extensions/instance_exec'
92
92
  @eval_context = Object.new
93
93
  @eval_context.extend Rspec::Core::InstanceExec
94
94
  yield @eval_context
@@ -5,7 +5,7 @@ module Rspec # :nodoc:
5
5
  MAJOR = 2
6
6
  MINOR = 0
7
7
  TINY = 0
8
- PRE = 'a2'
8
+ PRE = 'a3'
9
9
 
10
10
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
11
11
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rspec-mocks}
8
- s.version = "2.0.0.a2"
8
+ s.version = "2.0.0.a3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Chelimsky", "Chad Humphries"]
12
- s.date = %q{2010-01-24}
12
+ s.date = %q{2010-02-03}
13
13
  s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README.markdown"
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  "lib/rspec/mocks/error_generator.rb",
27
27
  "lib/rspec/mocks/errors.rb",
28
28
  "lib/rspec/mocks/extensions.rb",
29
+ "lib/rspec/mocks/extensions/instance_exec.rb",
29
30
  "lib/rspec/mocks/extensions/object.rb",
30
31
  "lib/rspec/mocks/framework.rb",
31
32
  "lib/rspec/mocks/message_expectation.rb",
@@ -130,21 +131,21 @@ Gem::Specification.new do |s|
130
131
  s.specification_version = 3
131
132
 
132
133
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
133
- s.add_development_dependency(%q<rspec-core>, [">= 2.0.0.a2"])
134
- s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.a2"])
134
+ s.add_development_dependency(%q<rspec-core>, [">= 2.0.0.a3"])
135
+ s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.a3"])
135
136
  s.add_development_dependency(%q<mocha>, [">= 0"])
136
137
  s.add_development_dependency(%q<flexmock>, [">= 0"])
137
138
  s.add_development_dependency(%q<rr>, [">= 0"])
138
139
  else
139
- s.add_dependency(%q<rspec-core>, [">= 2.0.0.a2"])
140
- s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.a2"])
140
+ s.add_dependency(%q<rspec-core>, [">= 2.0.0.a3"])
141
+ s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.a3"])
141
142
  s.add_dependency(%q<mocha>, [">= 0"])
142
143
  s.add_dependency(%q<flexmock>, [">= 0"])
143
144
  s.add_dependency(%q<rr>, [">= 0"])
144
145
  end
145
146
  else
146
- s.add_dependency(%q<rspec-core>, [">= 2.0.0.a2"])
147
- s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.a2"])
147
+ s.add_dependency(%q<rspec-core>, [">= 2.0.0.a3"])
148
+ s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.a3"])
148
149
  s.add_dependency(%q<mocha>, [">= 0"])
149
150
  s.add_dependency(%q<flexmock>, [">= 0"])
150
151
  s.add_dependency(%q<rr>, [">= 0"])
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  describe "An RSpec Mock" do
4
4
  it "should hide internals in its inspect representation" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  class LiarLiarPantsOnFire
4
4
  def respond_to?(sym, incl_private=false)
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module BugReport496
4
4
  class BaseClass
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module BugReport600
4
4
  class ExampleClass
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Bug7611
4
4
  class Foo
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Bug7805
4
4
  #This is really a duplicate of 8302
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  describe "An object where respond_to? is true and does not have method" do
4
4
  # When should_receive(:sym) is sent to any object, the Proxy sends
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Bug8302
4
4
  class Foo
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
  require 'rspec/mocks'
3
3
 
4
4
  module Rspec
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -135,7 +135,7 @@ module Rspec
135
135
  @mock.should_receive(:something) {| bool | bool.should be_true}
136
136
  lambda {
137
137
  @mock.something false
138
- }.should raise_error(MockExpectationError, /Mock 'test mock' received :something but passed block failed with: expected true, got false/)
138
+ }.should raise_error(MockExpectationError, /Mock 'test mock' received :something but passed block failed with: expected false to be true/)
139
139
  end
140
140
 
141
141
  it "should fail right away when method defined as never is received" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  def remove_last_describe_from_world
4
4
  Rspec::Core.world.behaviours.pop
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  def include_mock_argument_matchers
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper.rb'
1
+ require 'spec_helper'
2
2
 
3
3
  module Rspec
4
4
  module Mocks
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-mocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.a2
4
+ version: 2.0.0.a3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-24 00:00:00 -06:00
13
+ date: 2010-02-03 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 2.0.0.a2
24
+ version: 2.0.0.a3
25
25
  version:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec-expectations
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 2.0.0.a2
34
+ version: 2.0.0.a3
35
35
  version:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mocha
@@ -83,6 +83,7 @@ files:
83
83
  - lib/rspec/mocks/error_generator.rb
84
84
  - lib/rspec/mocks/errors.rb
85
85
  - lib/rspec/mocks/extensions.rb
86
+ - lib/rspec/mocks/extensions/instance_exec.rb
86
87
  - lib/rspec/mocks/extensions/object.rb
87
88
  - lib/rspec/mocks/framework.rb
88
89
  - lib/rspec/mocks/message_expectation.rb