flexmock 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/Rakefile +1 -1
- data/lib/flexmock/mock_container.rb +1 -0
- data/lib/flexmock/rails/view_mocking.rb +22 -1
- metadata +2 -2
data/README
CHANGED
data/Rakefile
CHANGED
@@ -211,6 +211,7 @@ class FlexMock
|
|
211
211
|
|
212
212
|
mock_errors = container.flexmock("errors")
|
213
213
|
mock_errors.should_receive(:count).and_return(0).by_default
|
214
|
+
mock_errors.should_receive(:full_messages).and_return([]).by_default
|
214
215
|
|
215
216
|
mock.should_receive(:id).and_return(id).by_default
|
216
217
|
mock.should_receive(:to_params).and_return(id.to_s).by_default
|
@@ -29,8 +29,10 @@ class FlexMock
|
|
29
29
|
should_render_view_after_version_124(template_name)
|
30
30
|
elsif rails_version < '2.2'
|
31
31
|
should_render_view_after_version_202(template_name)
|
32
|
-
|
32
|
+
elsif rails_version < '2.3'
|
33
33
|
should_render_view_22x(template_name)
|
34
|
+
else
|
35
|
+
should_render_view_23x(template_name)
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
@@ -43,6 +45,7 @@ class FlexMock
|
|
43
45
|
view.should_receive(
|
44
46
|
:assigns => {},
|
45
47
|
:render_file => true,
|
48
|
+
:render_partial => true,
|
46
49
|
:first_render => "dummy_template"
|
47
50
|
)
|
48
51
|
if template_name
|
@@ -63,6 +66,7 @@ class FlexMock
|
|
63
66
|
view.should_receive(
|
64
67
|
:assigns => {},
|
65
68
|
:render_file => true,
|
69
|
+
:render_partial => true,
|
66
70
|
:template_format => :dummy_format,
|
67
71
|
:view_paths => :dummy_view_paths,
|
68
72
|
:pick_template_extension => :dummy_extension
|
@@ -119,5 +123,22 @@ class FlexMock
|
|
119
123
|
end
|
120
124
|
flexmock(ActionView::Base).should_receive(:new).and_return(viewmock)
|
121
125
|
end
|
126
|
+
|
127
|
+
# This version of should_render_view will work with versions of
|
128
|
+
# Rails at Version 2.3.x.
|
129
|
+
def should_render_view_23x(template_name)
|
130
|
+
viewmock = flexmock("ViewMock")
|
131
|
+
viewmock.should_receive(
|
132
|
+
:view_paths => viewmock,
|
133
|
+
:render => "RENDERED TEXT")
|
134
|
+
if template_name
|
135
|
+
viewmock.should_receive(:find_template).
|
136
|
+
with(/\/#{template_name}$/, any).
|
137
|
+
and_return(FlexMock.undefined).
|
138
|
+
at_least.once
|
139
|
+
end
|
140
|
+
viewmock.should_ignore_missing
|
141
|
+
flexmock(ActionView::Base).should_receive(:new).and_return(viewmock)
|
142
|
+
end
|
122
143
|
end
|
123
144
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-15 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|