rspec-mocks 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +27 -9
- data/History.markdown +8 -0
- data/README.md +2 -2
- data/lib/rspec/mocks/extensions/marshal.rb +2 -0
- data/lib/rspec/mocks/version.rb +1 -1
- data/spec/rspec/mocks/null_object_mock_spec.rb +5 -0
- data/spec/rspec/mocks/serialization_spec.rb +21 -0
- metadata +7 -6
data/Gemfile
CHANGED
@@ -1,21 +1,39 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
+
### rspec libs
|
3
4
|
%w[rspec-core rspec-expectations rspec-mocks].each do |lib|
|
4
|
-
|
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
|
10
|
+
end
|
5
11
|
end
|
6
12
|
|
7
|
-
|
13
|
+
### dev dependencies
|
14
|
+
gem "rake", "0.8.7"
|
8
15
|
gem "cucumber", "0.9.4"
|
9
16
|
gem "aruba", "0.2.2"
|
10
|
-
gem "
|
11
|
-
gem "relish"
|
12
|
-
gem "guard-rspec"
|
13
|
-
gem "growl"
|
17
|
+
gem "rcov", "0.9.9"
|
18
|
+
gem "relish", "0.2.0"
|
19
|
+
gem "guard-rspec", "0.1.9"
|
20
|
+
gem "growl", "1.0.3"
|
21
|
+
gem "ZenTest", "~> 4.4.2"
|
22
|
+
|
23
|
+
if RUBY_PLATFORM =~ /darwin/
|
24
|
+
gem "autotest-fsevent", "~> 0.2.4"
|
25
|
+
gem "autotest-growl", "~> 0.2.9"
|
26
|
+
end
|
14
27
|
|
15
28
|
gem "ruby-debug", :platforms => :ruby_18
|
16
|
-
gem "ruby-debug19", :platforms => :ruby_19
|
29
|
+
gem "ruby-debug19", "~> 0.11.6", :platforms => :ruby_19
|
17
30
|
|
18
31
|
platforms :ruby_18, :ruby_19 do
|
19
|
-
gem "rb-fsevent"
|
20
|
-
gem "ruby-prof"
|
32
|
+
gem "rb-fsevent", "~> 0.3.9"
|
33
|
+
gem "ruby-prof", "~> 0.9.2"
|
21
34
|
end
|
35
|
+
|
36
|
+
platforms :jruby do
|
37
|
+
gem "jruby-openssl"
|
38
|
+
end
|
39
|
+
|
data/History.markdown
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## rspec-mocks release history (incomplete)
|
2
2
|
|
3
|
+
### 2.3.0 / 2010-12-12
|
4
|
+
|
5
|
+
[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.2.1...v2.3.0)
|
6
|
+
|
7
|
+
* Bug fixes
|
8
|
+
* Fix our Marshal extension so that it does not interfere with objects that
|
9
|
+
have their own @mock_proxy instance variable. (Myron Marston)
|
10
|
+
|
3
11
|
### 2.2.0 / 2010-11-28
|
4
12
|
|
5
13
|
[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.1.0...v2.2.0)
|
data/README.md
CHANGED
@@ -5,10 +5,10 @@ for method stubs, fakes, and message expectations.
|
|
5
5
|
|
6
6
|
## Documentation
|
7
7
|
|
8
|
-
The [Cucumber features](http://relishapp.com/rspec/rspec-mocks
|
8
|
+
The [Cucumber features](http://relishapp.com/rspec/rspec-mocks) are the
|
9
9
|
most comprehensive and up-to-date docs for end-users.
|
10
10
|
|
11
|
-
The [RDoc](http://rubydoc.info/gems/rspec-mocks/2.
|
11
|
+
The [RDoc](http://rubydoc.info/gems/rspec-mocks/2.3.0/frames) provides additional
|
12
12
|
information for contributors and/or extenders.
|
13
13
|
|
14
14
|
All of the documentation is open source and a work in progress. If you find it
|
@@ -7,6 +7,8 @@ module Marshal
|
|
7
7
|
return dump_without_mocks(*args.unshift(object)) unless object.instance_variable_defined?(:@mock_proxy)
|
8
8
|
|
9
9
|
mp = object.instance_variable_get(:@mock_proxy)
|
10
|
+
return dump_without_mocks(*args.unshift(object)) unless mp.is_a?(::RSpec::Mocks::Proxy)
|
11
|
+
|
10
12
|
object.send(:remove_instance_variable, :@mock_proxy)
|
11
13
|
|
12
14
|
begin
|
data/lib/rspec/mocks/version.rb
CHANGED
@@ -26,6 +26,11 @@ module RSpec
|
|
26
26
|
@double.should respond_to(:any_message_it_gets)
|
27
27
|
end
|
28
28
|
|
29
|
+
it "allows explicit stubs" do
|
30
|
+
@double.stub(:foo) { "bar" }
|
31
|
+
@double.foo.should eq("bar")
|
32
|
+
end
|
33
|
+
|
29
34
|
it "allows explicit expectation" do
|
30
35
|
@double.should_receive(:something)
|
31
36
|
@double.something
|
@@ -5,6 +5,18 @@ module RSpec
|
|
5
5
|
module Mocks
|
6
6
|
class SerializableStruct < Struct.new(:foo, :bar); end
|
7
7
|
|
8
|
+
class SerializableMockProxy
|
9
|
+
attr_reader :mock_proxy
|
10
|
+
|
11
|
+
def initialize(mock_proxy)
|
12
|
+
@mock_proxy = mock_proxy
|
13
|
+
end
|
14
|
+
|
15
|
+
def ==(other)
|
16
|
+
other.class == self.class && other.mock_proxy == mock_proxy
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
8
20
|
describe Serialization do
|
9
21
|
def self.with_yaml_loaded(&block)
|
10
22
|
context 'with YAML loaded' do
|
@@ -62,6 +74,15 @@ module RSpec
|
|
62
74
|
it 'marshals the same with and without stubbing' do
|
63
75
|
expect { set_stub }.to_not change { Marshal.dump(subject) }
|
64
76
|
end
|
77
|
+
|
78
|
+
describe "an object that has its own mock_proxy instance variable" do
|
79
|
+
subject { SerializableMockProxy.new(:my_mock_proxy) }
|
80
|
+
|
81
|
+
it 'does not interfere with its marshalling' do
|
82
|
+
marshalled_copy = Marshal.load(Marshal.dump(subject))
|
83
|
+
marshalled_copy.should == subject
|
84
|
+
end
|
85
|
+
end
|
65
86
|
end
|
66
87
|
end
|
67
88
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-mocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 2
|
7
|
-
-
|
8
|
+
- 3
|
8
9
|
- 0
|
9
|
-
version: 2.
|
10
|
+
version: 2.3.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- David Chelimsky
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-12-12 00:00:00 -06:00
|
19
20
|
default_executable:
|
20
21
|
dependencies: []
|
21
22
|
|
@@ -129,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
130
|
requirements:
|
130
131
|
- - ">="
|
131
132
|
- !ruby/object:Gem::Version
|
132
|
-
hash:
|
133
|
+
hash: 3
|
133
134
|
segments:
|
134
135
|
- 0
|
135
136
|
version: "0"
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
requirements:
|
139
140
|
- - ">="
|
140
141
|
- !ruby/object:Gem::Version
|
141
|
-
hash:
|
142
|
+
hash: 3
|
142
143
|
segments:
|
143
144
|
- 0
|
144
145
|
version: "0"
|
@@ -148,7 +149,7 @@ rubyforge_project: rspec
|
|
148
149
|
rubygems_version: 1.3.7
|
149
150
|
signing_key:
|
150
151
|
specification_version: 3
|
151
|
-
summary: rspec-mocks-2.
|
152
|
+
summary: rspec-mocks-2.3.0
|
152
153
|
test_files:
|
153
154
|
- features/README.markdown
|
154
155
|
- features/message_expectations/block_local_expectations.feature.pending
|