rr 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/Rakefile +2 -2
- data/lib/rr/double_definition_creator_proxy.rb +3 -1
- data/spec/rr/double_definition_creator_proxy_spec.rb +54 -42
- metadata +3 -3
data/CHANGES
CHANGED
data/Rakefile
CHANGED
@@ -26,7 +26,7 @@ def run_suite
|
|
26
26
|
end
|
27
27
|
|
28
28
|
PKG_NAME = "rr"
|
29
|
-
PKG_VERSION = "0.4.
|
29
|
+
PKG_VERSION = "0.4.10"
|
30
30
|
PKG_FILES = FileList[
|
31
31
|
'[A-Z]*',
|
32
32
|
'*.rb',
|
@@ -48,7 +48,7 @@ spec = Gem::Specification.new do |s|
|
|
48
48
|
|
49
49
|
s.has_rdoc = true
|
50
50
|
s.extra_rdoc_files = [ "README.rdoc", "CHANGES" ]
|
51
|
-
s.rdoc_options = ["--main", "README", "--inline-source", "--line-numbers"]
|
51
|
+
s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers"]
|
52
52
|
|
53
53
|
s.test_files = Dir.glob('spec/*_spec.rb')
|
54
54
|
s.require_path = 'lib'
|
@@ -1,15 +1,6 @@
|
|
1
1
|
require "spec/spec_helper"
|
2
2
|
|
3
3
|
module RR
|
4
|
-
describe DoubleDefinitionCreatorProxy, "initializes proxy with passed in creator", :shared => true do
|
5
|
-
it "initializes proxy with passed in creator" do
|
6
|
-
class << the_proxy
|
7
|
-
attr_reader :creator
|
8
|
-
end
|
9
|
-
the_proxy.creator.should === creator
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
4
|
describe DoubleDefinitionCreatorProxy do
|
14
5
|
attr_reader :space, :subject, :creator, :the_proxy
|
15
6
|
it_should_behave_like "Swapped Space"
|
@@ -21,53 +12,74 @@ module RR
|
|
21
12
|
creator.mock
|
22
13
|
end
|
23
14
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
it "clears out all methods from proxy" do
|
31
|
-
proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
|
32
|
-
def i_should_be_a_double
|
15
|
+
class << self
|
16
|
+
define_method("initializes proxy with passed in creator") do
|
17
|
+
it "initializes proxy with passed in creator" do
|
18
|
+
class << the_proxy
|
19
|
+
attr_reader :creator
|
33
20
|
end
|
21
|
+
the_proxy.creator.should === creator
|
34
22
|
end
|
35
|
-
proxy_subclass.instance_methods.should include('i_should_be_a_double')
|
36
|
-
|
37
|
-
proxy = proxy_subclass.new(creator, subject)
|
38
|
-
proxy.i_should_be_a_double.should be_instance_of(DoubleDefinition)
|
39
23
|
end
|
40
24
|
end
|
41
25
|
|
42
|
-
describe ".new
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
b.foobar(1, 2) {:one_two}
|
47
|
-
b.foobar(1) {:one}
|
48
|
-
b.foobar.with_any_args {:default}
|
49
|
-
b.baz() {:baz_result}
|
50
|
-
end
|
26
|
+
describe ".new" do
|
27
|
+
it "does not undefine object_id" do
|
28
|
+
the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
|
29
|
+
the_proxy.object_id.class.should == Fixnum
|
51
30
|
end
|
52
31
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
32
|
+
context "without block" do
|
33
|
+
before do
|
34
|
+
@the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
|
35
|
+
end
|
36
|
+
|
37
|
+
send "initializes proxy with passed in creator"
|
38
|
+
|
39
|
+
it "clears out all methods from proxy" do
|
40
|
+
proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
|
41
|
+
def i_should_be_a_double
|
42
|
+
end
|
43
|
+
end
|
44
|
+
proxy_subclass.instance_methods.map {|m| m.to_s}.should include('i_should_be_a_double')
|
45
|
+
|
46
|
+
proxy = proxy_subclass.new(creator, subject)
|
47
|
+
proxy.i_should_be_a_double.should be_instance_of(DoubleDefinition)
|
48
|
+
end
|
58
49
|
end
|
59
50
|
|
60
|
-
|
61
|
-
|
62
|
-
|
51
|
+
context "with block" do
|
52
|
+
before do
|
53
|
+
@the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject) do |b|
|
54
|
+
b.foobar(1, 2) {:one_two}
|
55
|
+
b.foobar(1) {:one}
|
56
|
+
b.foobar.with_any_args {:default}
|
57
|
+
b.baz() {:baz_result}
|
63
58
|
end
|
64
59
|
end
|
65
|
-
proxy_subclass.instance_methods.should include('i_should_be_a_double')
|
66
60
|
|
67
|
-
|
68
|
-
|
61
|
+
send "initializes proxy with passed in creator"
|
62
|
+
|
63
|
+
it "creates double_injections" do
|
64
|
+
subject.foobar(1, 2).should == :one_two
|
65
|
+
subject.foobar(1).should == :one
|
66
|
+
subject.foobar(:something).should == :default
|
67
|
+
subject.baz.should == :baz_result
|
68
|
+
end
|
69
|
+
|
70
|
+
it "clears out all methods from proxy" do
|
71
|
+
proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
|
72
|
+
def i_should_be_a_double
|
73
|
+
end
|
74
|
+
end
|
75
|
+
proxy_subclass.instance_methods.map {|m| m.to_s}.should include('i_should_be_a_double')
|
76
|
+
|
77
|
+
proxy_subclass.new(creator, subject) do |m|
|
78
|
+
m.i_should_be_a_double.should be_instance_of(DoubleDefinition)
|
79
|
+
end
|
69
80
|
end
|
70
81
|
end
|
71
82
|
end
|
83
|
+
|
72
84
|
end
|
73
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Takita
|
@@ -9,7 +9,7 @@ autorequire: rr
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06
|
12
|
+
date: 2008-07-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -132,7 +132,7 @@ homepage: http://pivotallabs.com
|
|
132
132
|
post_install_message:
|
133
133
|
rdoc_options:
|
134
134
|
- --main
|
135
|
-
- README
|
135
|
+
- README.rdoc
|
136
136
|
- --inline-source
|
137
137
|
- --line-numbers
|
138
138
|
require_paths:
|