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.
- data/.document +2 -2
- data/.gitignore +1 -0
- data/README.markdown +20 -4
- data/Rakefile +2 -12
- data/lib/rspec/mocks/extensions/instance_exec.rb +31 -0
- data/lib/rspec/mocks/message_expectation.rb +1 -1
- data/lib/rspec/mocks/version.rb +1 -1
- data/rspec-mocks.gemspec +9 -8
- data/spec/rspec/mocks/any_number_of_times_spec.rb +1 -1
- data/spec/rspec/mocks/argument_expectation_spec.rb +1 -1
- data/spec/rspec/mocks/at_least_spec.rb +1 -1
- data/spec/rspec/mocks/at_most_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_10260_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_11545_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_15719_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_496_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_600_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_7611_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_7805_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_8165_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_8302_spec.rb +1 -1
- data/spec/rspec/mocks/bug_report_830_spec.rb +1 -1
- data/spec/rspec/mocks/failing_argument_matchers_spec.rb +1 -1
- data/spec/rspec/mocks/hash_including_matcher_spec.rb +1 -1
- data/spec/rspec/mocks/hash_not_including_matcher_spec.rb +1 -1
- data/spec/rspec/mocks/mock_ordering_spec.rb +1 -1
- data/spec/rspec/mocks/mock_space_spec.rb +1 -1
- data/spec/rspec/mocks/mock_spec.rb +2 -2
- data/spec/rspec/mocks/multiple_return_value_spec.rb +1 -1
- data/spec/rspec/mocks/nil_expectation_warning_spec.rb +1 -1
- data/spec/rspec/mocks/null_object_mock_spec.rb +1 -1
- data/spec/rspec/mocks/once_counts_spec.rb +1 -1
- data/spec/rspec/mocks/options_hash_spec.rb +1 -1
- data/spec/rspec/mocks/partial_mock_spec.rb +1 -1
- data/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +1 -1
- data/spec/rspec/mocks/passing_argument_matchers_spec.rb +1 -1
- data/spec/rspec/mocks/precise_counts_spec.rb +1 -1
- data/spec/rspec/mocks/record_messages_spec.rb +1 -1
- data/spec/rspec/mocks/stub_chain_spec.rb +1 -1
- data/spec/rspec/mocks/stub_implementation_spec.rb +1 -1
- data/spec/rspec/mocks/stub_spec.rb +1 -1
- data/spec/rspec/mocks/stubbed_message_expectations_spec.rb +1 -1
- data/spec/rspec/mocks/twice_counts_spec.rb +1 -1
- metadata +5 -4
data/.document
CHANGED
data/.gitignore
CHANGED
data/README.markdown
CHANGED
@@ -1,8 +1,24 @@
|
|
1
|
-
#
|
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/
|
8
|
-
* [http://github.com/rspec/
|
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)
|
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 #{
|
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
|
data/lib/rspec/mocks/version.rb
CHANGED
data/rspec-mocks.gemspec
CHANGED
@@ -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.
|
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-
|
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.
|
134
|
-
s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.
|
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.
|
140
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.
|
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.
|
147
|
-
s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.
|
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
|
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
|
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
|
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.
|
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-
|
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.
|
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.
|
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
|