|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
1 |
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper')) |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
2 |
require File.expand_path(File.join(File.dirname(__FILE__), '../app')) |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
3 |
|
|
b7750a58
»
|
ian |
2007-07-09 |
* Enclosed named paths use ... |
4 |
describe "Routing shortcuts for Forums should map" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
5 |
controller_name :forums |
| |
6 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
7 |
before(:each) do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
8 |
@forum = mock('Forum') |
| |
9 |
@forum.stub!(:to_param).and_return('2') |
| |
10 |
Forum.stub!(:find).and_return(@forum) |
| |
11 |
get :show, :id => "2" |
| |
12 |
end |
| |
13 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
14 |
it "resources_path to /forums" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
15 |
controller.resources_path.should == '/forums' |
| |
16 |
end |
| |
17 |
|
|
b7750a58
»
|
ian |
2007-07-09 |
* Enclosed named paths use ... |
18 |
it "resources_path(:foo => 'bar') to /forums?foo=bar" do |
| |
19 |
controller.resources_path(:foo => 'bar').should == '/forums?foo=bar' |
| |
20 |
end |
| |
21 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
22 |
it "resource_path to /forums/2" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
23 |
controller.resource_path.should == '/forums/2' |
| |
24 |
end |
|
b7750a58
»
|
ian |
2007-07-09 |
* Enclosed named paths use ... |
25 |
|
| |
26 |
it "resource_path(:foo => 'bar') to /forums/2?foo=bar" do |
| |
27 |
controller.resource_path(:foo => 'bar').should == '/forums/2?foo=bar' |
| |
28 |
end |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
29 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
30 |
it "resource_path(9) to /forums/9" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
31 |
controller.resource_path(9).should == '/forums/9' |
| |
32 |
end |
| |
33 |
|
|
b7750a58
»
|
ian |
2007-07-09 |
* Enclosed named paths use ... |
34 |
it "resource_path(9, :foo => 'bar') to /forums/2?foo=bar" do |
| |
35 |
controller.resource_path(9, :foo => 'bar').should == '/forums/9?foo=bar' |
| |
36 |
end |
| |
37 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
38 |
it "edit_resource_path to /forums/2/edit" do |
| |
39 |
controller.edit_resource_path.should == '/forums/2/edit' |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
40 |
end |
| |
41 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
42 |
it "edit_resource_path(9) to /forums/9/edit" do |
| |
43 |
controller.edit_resource_path(9).should == '/forums/9/edit' |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
44 |
end |
| |
45 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
46 |
it "new_resource_path to /forums/new" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
47 |
controller.new_resource_path.should == '/forums/new' |
| |
48 |
end |
|
f042826b
»
|
ian |
2007-05-10 |
resources_controller: Added... |
49 |
|
| |
50 |
it "resources_url to http://test.host/forums" do |
| |
51 |
controller.resources_url.should == 'http://test.host/forums' |
| |
52 |
end |
| |
53 |
|
| |
54 |
it "resource_url to http://test.host/forums/2" do |
| |
55 |
controller.resource_url.should == 'http://test.host/forums/2' |
| |
56 |
end |
| |
57 |
|
| |
58 |
it "resource_url(9) to http://test.host/forums/9" do |
| |
59 |
controller.resource_url(9).should == 'http://test.host/forums/9' |
| |
60 |
end |
| |
61 |
|
| |
62 |
it "edit_resource_url to http://test.host/forums/2/edit" do |
| |
63 |
controller.edit_resource_url.should == 'http://test.host/forums/2/edit' |
| |
64 |
end |
| |
65 |
|
| |
66 |
it "edit_resource_url(9) to http://test.host/forums/9/edit" do |
| |
67 |
controller.edit_resource_url(9).should == 'http://test.host/forums/9/edit' |
| |
68 |
end |
| |
69 |
|
| |
70 |
it "new_resource_url to http://test.host/forums/new" do |
| |
71 |
controller.new_resource_url.should == 'http://test.host/forums/new' |
| |
72 |
end |
|
b7750a58
»
|
ian |
2007-07-09 |
* Enclosed named paths use ... |
73 |
|
|
0181a4ad
»
|
ian |
2007-06-07 |
Now handles enclosing named... |
74 |
it "resource_interests_path to /forums/2/interests" do |
| |
75 |
controller.resource_interests_path.should == "/forums/2/interests" |
| |
76 |
end |
|
b7750a58
»
|
ian |
2007-07-09 |
* Enclosed named paths use ... |
77 |
|
| |
78 |
it "resource_interests_path(:foo => 'bar') to /forums/2/interests?foo=bar" do |
| |
79 |
controller.resource_interests_path(:foo => 'bar').should == '/forums/2/interests?foo=bar' |
| |
80 |
end |
| |
81 |
|
|
0181a4ad
»
|
ian |
2007-06-07 |
Now handles enclosing named... |
82 |
it "resource_interests_path(9) to /forums/9/interests" do |
| |
83 |
controller.resource_interests_path(9).should == "/forums/9/interests" |
| |
84 |
end |
| |
85 |
|
|
b7750a58
»
|
ian |
2007-07-09 |
* Enclosed named paths use ... |
86 |
it "resource_interests_path(9, :foo => 'bar') to /forums/9/interests?foo=bar" do |
| |
87 |
controller.resource_interests_path(9, :foo => 'bar').should == "/forums/9/interests?foo=bar" |
| |
88 |
end |
| |
89 |
|
|
0181a4ad
»
|
ian |
2007-06-07 |
Now handles enclosing named... |
90 |
it "resource_interest_path(5) to /forums/2/interests/5" do |
| |
91 |
controller.resource_interest_path(5).should == "/forums/2/interests/5" |
| |
92 |
end |
| |
93 |
|
| |
94 |
it "resource_interest_path(9,5) to /forums/9/interests/5" do |
| |
95 |
controller.resource_interest_path(9,5).should == "/forums/9/interests/5" |
| |
96 |
end |
| |
97 |
|
|
b7750a58
»
|
ian |
2007-07-09 |
* Enclosed named paths use ... |
98 |
it "resource_interest_path(9,5, :foo => 'bar') to /forums/9/interests/5?foo=bar" do |
| |
99 |
controller.resource_interest_path(9, 5, :foo => 'bar').should == "/forums/9/interests/5?foo=bar" |
| |
100 |
end |
| |
101 |
|
| |
102 |
it 'new_resource_interest_path(9) to /forums/9/interests/new' do |
| |
103 |
controller.new_resource_interest_path(9).should == "/forums/9/interests/new" |
| |
104 |
end |
| |
105 |
|
| |
106 |
it 'edit_resource_interest_path(5) to /forums/2/interests/5/edit' do |
| |
107 |
controller.edit_resource_interest_path(5).should == "/forums/2/interests/5/edit" |
| |
108 |
end |
| |
109 |
|
| |
110 |
it 'edit_resource_interest_path(9,5) to /forums/9/interests/5/edit' do |
| |
111 |
controller.edit_resource_interest_path(9,5).should == "/forums/9/interests/5/edit" |
| |
112 |
end |
| |
113 |
|
|
0c5fcae0
»
|
ian |
2007-07-30 |
Named path support is much ... |
114 |
it "respond_to?(:edit_resource_interest_path) should == true" do |
| |
115 |
controller.should respond_to(:edit_resource_interest_path) |
| |
116 |
end |
| |
117 |
|
|
125924dc
»
|
ian |
2007-08-01 |
resources_controller: infor... |
118 |
it "resource_users_path should raise informative NoMethodError" do |
|
2200ba91
»
|
ian |
2007-09-05 |
* Major internal changes, a... |
119 |
lambda{ controller.resource_users_path }.should raise_error(Ardes::ResourcesController::CantMapRoute, <<-end_str |
| |
120 |
Tried to map :resource_users_path to :forum_users_path, |
| |
121 |
which doesn't exist. You may not have defined the route in config/routes.rb. |
| |
122 |
|
| |
123 |
Or, if you have unconventianal route names or name prefixes, you may need |
| |
124 |
to explicictly set the :route option in resources_controller_for, and set |
| |
125 |
the :name_prefix option on your enclosing resources. |
| |
126 |
|
| |
127 |
Currently: |
| |
128 |
:route is 'forum' |
| |
129 |
generated name_prefix is '' |
|
68ddf96f
»
|
ian |
2007-08-18 |
* resources_controller now ... |
130 |
end_str |
|
125924dc
»
|
ian |
2007-08-01 |
resources_controller: infor... |
131 |
) |
| |
132 |
end |
| |
133 |
|
|
18e39391
»
|
ian |
2007-08-17 |
resources_controller: |
134 |
it "enclosing_resource_path should raise informative NoMethodError" do |
| |
135 |
lambda{ controller.enclosing_resource_path }.should raise_error(NoMethodError, "Tried to map :enclosing_resource_path but there is no enclosing_resource for this controller") |
| |
136 |
end |
| |
137 |
|
|
125924dc
»
|
ian |
2007-08-01 |
resources_controller: infor... |
138 |
it "any_old_missing_method should raise NoMethodError" do |
| |
139 |
lambda{ controller.any_old_missing_method }.should raise_error(NoMethodError) |
|
0181a4ad
»
|
ian |
2007-06-07 |
Now handles enclosing named... |
140 |
end |
|
0c5fcae0
»
|
ian |
2007-07-30 |
Named path support is much ... |
141 |
|
| |
142 |
it "respond_to?(:resource_users_path) should == false" do |
| |
143 |
controller.should_not respond_to(:resource_users_path) |
| |
144 |
end |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
145 |
end |
| |
146 |
|
|
983e0df4
»
|
ian |
2007-11-06 |
resources_controller: you c... |
147 |
describe ForumsController, " (checking that non actions are hidden)" do |
| |
148 |
it "should only have CRUD actions as action_methods" do |
|
67f1d622
»
|
ianwhite |
2008-09-01 |
Made specs which fail becau... |
149 |
pending "waiting for #469 on rspec to be accepted" do |
| |
150 |
@controller.class.send(:action_methods).should == Set.new([ |
| |
151 |
'index', 'show', 'edit', 'new', 'update', 'create', 'destroy' |
| |
152 |
]) |
| |
153 |
end |
|
983e0df4
»
|
ian |
2007-11-06 |
resources_controller: you c... |
154 |
end |
| |
155 |
end |
| |
156 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
157 |
describe "resource_service in ForumsController" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
158 |
controller_name :forums |
| |
159 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
160 |
before(:each) do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
161 |
@forum = Forum.create |
| |
162 |
|
| |
163 |
get :index |
| |
164 |
@resource_service = controller.send :resource_service |
| |
165 |
end |
| |
166 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
167 |
it "should build new forum with new" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
168 |
resource = @resource_service.new |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
169 |
resource.should be_kind_of(Forum) |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
170 |
end |
| |
171 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
172 |
it "should find @forum with find(@forum.id)" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
173 |
resource = @resource_service.find(@forum.id) |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
174 |
resource.should == @forum |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
175 |
end |
| |
176 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
177 |
it "should find all forums with find(:all)" do |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
178 |
resources = @resource_service.find(:all) |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
179 |
resources.should == Forum.find(:all) |
|
d649794b
»
|
ian |
2007-02-14 |
git-svn-id: https://svn.ard... |
180 |
end |
| |
181 |
end |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
182 |
|
|
1dca7585
»
|
ian |
2007-11-19 |
resources_controller: * cha... |
183 |
describe ForumsController, " requesting / (testing resource_path)" do |
| |
184 |
it "should generate params { :controller => 'forums', :action => 'index', :resource_path => '/forums' } from GET /" do |
| |
185 |
params_from(:get, "/").should == { :controller => 'forums', :action => 'index', :resource_path => '/forums' } |
|
6f90688e
»
|
ian |
2007-11-14 |
resources_controller: added... |
186 |
end |
| |
187 |
|
| |
188 |
before(:each) do |
| |
189 |
@mock_forums = mock('forums') |
| |
190 |
Forum.stub!(:find).and_return(@mock_forums) |
| |
191 |
end |
| |
192 |
|
| |
193 |
def do_get |
|
1dca7585
»
|
ian |
2007-11-19 |
resources_controller: * cha... |
194 |
get :index, :resource_path => '/forums' |
|
6f90688e
»
|
ian |
2007-11-14 |
resources_controller: added... |
195 |
end |
| |
196 |
|
| |
197 |
it "should be successful" do |
| |
198 |
do_get |
| |
199 |
response.should be_success |
| |
200 |
end |
| |
201 |
|
| |
202 |
it "should render index.rhtml" do |
| |
203 |
do_get |
| |
204 |
response.should render_template(:index) |
| |
205 |
end |
| |
206 |
|
| |
207 |
it "should find all forums" do |
| |
208 |
Forum.should_receive(:find).with(:all).and_return(@mock_forums) |
| |
209 |
do_get |
| |
210 |
end |
| |
211 |
|
| |
212 |
it "should assign the found forums for the view" do |
| |
213 |
do_get |
| |
214 |
assigns[:forums].should == @mock_forums |
| |
215 |
end |
| |
216 |
end |
| |
217 |
|
|
1dca7585
»
|
ian |
2007-11-19 |
resources_controller: * cha... |
218 |
describe ForumsController, " requesting /create_forum (testing resource_method)" do |
| |
219 |
it "should generate params { :controller => 'forums', :action => 'create', :resource_path => '/forums', :resource_method => :post } from GET /create_forum" do |
| |
220 |
params_from(:get, "/create_forum").should == { :controller => 'forums', :action => 'create', :resource_path => '/forums', :resource_method => :post } |
| |
221 |
end |
| |
222 |
|
| |
223 |
before(:each) do |
| |
224 |
@mock_forum = mock('Forum') |
| |
225 |
@mock_forum.stub!(:save).and_return(true) |
| |
226 |
@mock_forum.stub!(:to_param).and_return("1") |
| |
227 |
Forum.stub!(:new).and_return(@mock_forum) |
| |
228 |
end |
| |
229 |
|
| |
230 |
def do_post |
| |
231 |
post :create, :forum => {:name => 'Forum'}, :resource_path => '/forums', :resource_method => :post |
| |
232 |
|
| |
233 |
end |
| |
234 |
|
| |
235 |
it "should create a new forum" do |
| |
236 |
Forum.should_receive(:new).with({'name' => 'Forum'}).and_return(@mock_forum) |
| |
237 |
do_post |
| |
238 |
end |
| |
239 |
|
| |
240 |
it "should set the flash notice" do |
| |
241 |
do_post |
| |
242 |
flash[:notice].should == "Forum was successfully created." |
| |
243 |
end |
|
6f90688e
»
|
ian |
2007-11-14 |
resources_controller: added... |
244 |
|
|
1dca7585
»
|
ian |
2007-11-19 |
resources_controller: * cha... |
245 |
it "should redirect to the new forum" do |
| |
246 |
do_post |
| |
247 |
response.should be_redirect |
| |
248 |
response.redirect_url.should == "http://test.host/forums/1" |
| |
249 |
end |
| |
250 |
end |
|
6f90688e
»
|
ian |
2007-11-14 |
resources_controller: added... |
251 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
252 |
describe "Requesting /forums using GET" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
253 |
controller_name :forums |
| |
254 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
255 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
256 |
@mock_forums = mock('forums') |
| |
257 |
Forum.stub!(:find).and_return(@mock_forums) |
| |
258 |
end |
| |
259 |
|
| |
260 |
def do_get |
| |
261 |
get :index |
| |
262 |
end |
| |
263 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
264 |
it "should be successful" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
265 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
266 |
response.should be_success |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
267 |
end |
| |
268 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
269 |
it "should render index.rhtml" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
270 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
271 |
response.should render_template(:index) |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
272 |
end |
| |
273 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
274 |
it "should find all forums" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
275 |
Forum.should_receive(:find).with(:all).and_return(@mock_forums) |
| |
276 |
do_get |
| |
277 |
end |
| |
278 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
279 |
it "should assign the found forums for the view" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
280 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
281 |
assigns[:forums].should == @mock_forums |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
282 |
end |
| |
283 |
end |
| |
284 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
285 |
describe "Requesting /forums.xml using GET" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
286 |
controller_name :forums |
| |
287 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
288 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
289 |
@mock_forums = mock('forums') |
| |
290 |
@mock_forums.stub!(:to_xml).and_return("XML") |
| |
291 |
Forum.stub!(:find).and_return(@mock_forums) |
| |
292 |
end |
| |
293 |
|
| |
294 |
def do_get |
| |
295 |
@request.env["HTTP_ACCEPT"] = "application/xml" |
| |
296 |
get :index |
| |
297 |
end |
| |
298 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
299 |
it "should be successful" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
300 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
301 |
response.should be_success |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
302 |
end |
| |
303 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
304 |
it "should find all forums" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
305 |
Forum.should_receive(:find).with(:all).and_return(@mock_forums) |
| |
306 |
do_get |
| |
307 |
end |
| |
308 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
309 |
it "should render the found forums as xml" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
310 |
@mock_forums.should_receive(:to_xml).and_return("XML") |
| |
311 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
312 |
response.body.should eql("XML") |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
313 |
end |
| |
314 |
end |
| |
315 |
|
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
316 |
describe "Requesting /forums using XHR GET" do |
| |
317 |
controller_name :forums |
| |
318 |
|
| |
319 |
before(:each) do |
| |
320 |
@mock_forums = mock('forums') |
| |
321 |
Forum.stub!(:find).and_return(@mock_forums) |
| |
322 |
end |
| |
323 |
|
| |
324 |
def do_get |
| |
325 |
@request.env["HTTP_ACCEPT"] = "text/javascript" |
| |
326 |
xhr :get, :index |
| |
327 |
end |
| |
328 |
|
| |
329 |
it "should be successful" do |
| |
330 |
do_get |
| |
331 |
response.should be_success |
| |
332 |
end |
| |
333 |
|
| |
334 |
it "should find all forums" do |
| |
335 |
Forum.should_receive(:find).with(:all).and_return(@mock_forums) |
| |
336 |
do_get |
| |
337 |
end |
| |
338 |
|
| |
339 |
it "should render index.rjs" do |
| |
340 |
do_get |
| |
341 |
response.should render_template('index') |
| |
342 |
end |
| |
343 |
end |
| |
344 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
345 |
describe "Requesting /forums/1 using GET" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
346 |
controller_name :forums |
| |
347 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
348 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
349 |
@mock_forum = mock('Forum') |
| |
350 |
Forum.stub!(:find).and_return(@mock_forum) |
| |
351 |
end |
| |
352 |
|
| |
353 |
def do_get |
| |
354 |
get :show, :id => "1" |
| |
355 |
end |
| |
356 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
357 |
it "should be successful" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
358 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
359 |
response.should be_success |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
360 |
end |
| |
361 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
362 |
it "should render show.rhtml" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
363 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
364 |
response.should render_template(:show) |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
365 |
end |
| |
366 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
367 |
it "should find the forum requested" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
368 |
Forum.should_receive(:find).with("1").and_return(@mock_forum) |
| |
369 |
do_get |
| |
370 |
end |
| |
371 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
372 |
it "should assign the found forum for the view" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
373 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
374 |
assigns[:forum].should == @mock_forum |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
375 |
end |
| |
376 |
end |
| |
377 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
378 |
describe "Requesting /forums/1.xml using GET" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
379 |
controller_name :forums |
| |
380 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
381 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
382 |
@mock_forum = mock('Forum') |
| |
383 |
@mock_forum.stub!(:to_xml).and_return("XML") |
| |
384 |
Forum.stub!(:find).and_return(@mock_forum) |
| |
385 |
end |
| |
386 |
|
| |
387 |
def do_get |
| |
388 |
@request.env["HTTP_ACCEPT"] = "application/xml" |
| |
389 |
get :show, :id => "1" |
| |
390 |
end |
| |
391 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
392 |
it "should be successful" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
393 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
394 |
response.should be_success |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
395 |
end |
| |
396 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
397 |
it "should find the forum requested" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
398 |
Forum.should_receive(:find).with("1").and_return(@mock_forum) |
| |
399 |
do_get |
| |
400 |
end |
| |
401 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
402 |
it "should render the found forum as xml" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
403 |
@mock_forum.should_receive(:to_xml).and_return("XML") |
| |
404 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
405 |
response.body.should eql("XML") |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
406 |
end |
| |
407 |
end |
| |
408 |
|
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
409 |
describe "Requesting /forums/1 using XHR GET" do |
| |
410 |
controller_name :forums |
| |
411 |
|
| |
412 |
before(:each) do |
| |
413 |
@mock_forum = mock('Forum') |
| |
414 |
Forum.stub!(:find).and_return(@mock_forum) |
| |
415 |
end |
| |
416 |
|
| |
417 |
def do_get |
| |
418 |
xhr :get, :show, :id => "1" |
| |
419 |
end |
| |
420 |
|
| |
421 |
it "should be successful" do |
| |
422 |
do_get |
| |
423 |
response.should be_success |
| |
424 |
end |
| |
425 |
|
| |
426 |
it "should render show.rjs" do |
| |
427 |
do_get |
| |
428 |
response.should render_template('show') |
| |
429 |
end |
| |
430 |
|
| |
431 |
it "should find the forum requested" do |
| |
432 |
Forum.should_receive(:find).with("1").and_return(@mock_forum) |
| |
433 |
do_get |
| |
434 |
end |
| |
435 |
|
| |
436 |
it "should assign the found forum for the view" do |
| |
437 |
do_get |
| |
438 |
assigns[:forum].should == @mock_forum |
| |
439 |
end |
| |
440 |
end |
| |
441 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
442 |
describe "Requesting /forums/new using GET" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
443 |
controller_name :forums |
| |
444 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
445 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
446 |
@mock_forum = mock('Forum') |
| |
447 |
Forum.stub!(:new).and_return(@mock_forum) |
| |
448 |
end |
| |
449 |
|
| |
450 |
def do_get |
| |
451 |
get :new |
| |
452 |
end |
| |
453 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
454 |
it "should be successful" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
455 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
456 |
response.should be_success |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
457 |
end |
| |
458 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
459 |
it "should render new.rhtml" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
460 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
461 |
response.should render_template(:new) |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
462 |
end |
| |
463 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
464 |
it "should create an new forum" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
465 |
Forum.should_receive(:new).and_return(@mock_forum) |
| |
466 |
do_get |
| |
467 |
end |
| |
468 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
469 |
it "should not save the new forum" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
470 |
@mock_forum.should_not_receive(:save) |
| |
471 |
do_get |
| |
472 |
end |
| |
473 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
474 |
it "should assign the new forum for the view" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
475 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
476 |
assigns[:forum].should == @mock_forum |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
477 |
end |
| |
478 |
end |
| |
479 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
480 |
describe "Requesting /forums/1/edit using GET" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
481 |
controller_name :forums |
| |
482 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
483 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
484 |
@mock_forum = mock('Forum') |
| |
485 |
Forum.stub!(:find).and_return(@mock_forum) |
| |
486 |
end |
| |
487 |
|
| |
488 |
def do_get |
| |
489 |
get :edit, :id => "1" |
| |
490 |
end |
| |
491 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
492 |
it "should be successful" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
493 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
494 |
response.should be_success |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
495 |
end |
| |
496 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
497 |
it "should render edit.rhtml" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
498 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
499 |
response.should render_template(:edit) |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
500 |
end |
| |
501 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
502 |
it "should find the forum requested" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
503 |
Forum.should_receive(:find).and_return(@mock_forum) |
| |
504 |
do_get |
| |
505 |
end |
| |
506 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
507 |
it "should assign the found Forum for the view" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
508 |
do_get |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
509 |
assigns(:forum).should equal(@mock_forum) |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
510 |
end |
| |
511 |
end |
| |
512 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
513 |
describe "Requesting /forums using POST" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
514 |
controller_name :forums |
| |
515 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
516 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
517 |
@mock_forum = mock('Forum') |
| |
518 |
@mock_forum.stub!(:save).and_return(true) |
|
d233ff21
»
|
ian |
2007-02-02 |
Latest rails seems to requi... |
519 |
@mock_forum.stub!(:to_param).and_return("1") |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
520 |
Forum.stub!(:new).and_return(@mock_forum) |
| |
521 |
end |
| |
522 |
|
| |
523 |
def do_post |
| |
524 |
post :create, :forum => {:name => 'Forum'} |
| |
525 |
end |
| |
526 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
527 |
it "should create a new forum" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
528 |
Forum.should_receive(:new).with({'name' => 'Forum'}).and_return(@mock_forum) |
| |
529 |
do_post |
| |
530 |
end |
| |
531 |
|
|
8cf4badb
»
|
ian |
2007-07-23 |
resources_controller: Added... |
532 |
it "should set the flash notice" do |
| |
533 |
do_post |
| |
534 |
flash[:notice].should == "Forum was successfully created." |
| |
535 |
end |
| |
536 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
537 |
it "should redirect to the new forum" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
538 |
do_post |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
539 |
response.should be_redirect |
| |
540 |
response.redirect_url.should == "http://test.host/forums/1" |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
541 |
end |
| |
542 |
end |
| |
543 |
|
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
544 |
describe "Requesting /forums using XHR POST" do |
| |
545 |
controller_name :forums |
| |
546 |
|
| |
547 |
before(:each) do |
| |
548 |
@mock_forum = mock('Forum') |
| |
549 |
@mock_forum.stub!(:save).and_return(true) |
| |
550 |
@mock_forum.stub!(:to_param).and_return("1") |
| |
551 |
Forum.stub!(:new).and_return(@mock_forum) |
| |
552 |
end |
| |
553 |
|
| |
554 |
def do_post |
| |
555 |
xhr :post, :create, :forum => {:name => 'Forum'} |
| |
556 |
end |
| |
557 |
|
| |
558 |
it "should create a new forum" do |
| |
559 |
Forum.should_receive(:new).with({'name' => 'Forum'}).and_return(@mock_forum) |
| |
560 |
do_post |
| |
561 |
end |
| |
562 |
|
|
8cf4badb
»
|
ian |
2007-07-23 |
resources_controller: Added... |
563 |
it "should not set the flash notice" do |
| |
564 |
do_post |
| |
565 |
flash[:notice].should == nil |
| |
566 |
end |
| |
567 |
|
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
568 |
it "should render create.rjs" do |
| |
569 |
do_post |
| |
570 |
response.should render_template('create') |
| |
571 |
end |
|
71554792
»
|
ian |
2007-09-06 |
resources_controller:Minor ... |
572 |
|
| |
573 |
it "should render new.rjs if unsuccesful" do |
| |
574 |
@mock_forum.stub!(:save).and_return(false) |
| |
575 |
do_post |
| |
576 |
response.should render_template('new') |
| |
577 |
end |
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
578 |
end |
| |
579 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
580 |
describe "Requesting /forums/1 using PUT" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
581 |
controller_name :forums |
| |
582 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
583 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
584 |
@mock_forum = mock('Forum', :null_object => true) |
|
d233ff21
»
|
ian |
2007-02-02 |
Latest rails seems to requi... |
585 |
@mock_forum.stub!(:to_param).and_return("1") |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
586 |
Forum.stub!(:find).and_return(@mock_forum) |
| |
587 |
end |
| |
588 |
|
| |
589 |
def do_update |
| |
590 |
put :update, :id => "1" |
| |
591 |
end |
| |
592 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
593 |
it "should find the forum requested" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
594 |
Forum.should_receive(:find).with("1").and_return(@mock_forum) |
| |
595 |
do_update |
| |
596 |
end |
| |
597 |
|
|
8cf4badb
»
|
ian |
2007-07-23 |
resources_controller: Added... |
598 |
it "should set the flash notice" do |
| |
599 |
do_update |
| |
600 |
flash[:notice].should == "Forum was successfully updated." |
| |
601 |
end |
| |
602 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
603 |
it "should update the found forum" do |
|
dd20dcd5
»
|
ian |
2007-11-18 |
resources_controller: Added... |
604 |
@mock_forum.should_receive(:attributes=) |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
605 |
do_update |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
606 |
assigns(:forum).should == @mock_forum |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
607 |
end |
| |
608 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
609 |
it "should assign the found forum for the view" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
610 |
do_update |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
611 |
assigns(:forum).should == @mock_forum |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
612 |
end |
| |
613 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
614 |
it "should redirect to the forum" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
615 |
do_update |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
616 |
response.should be_redirect |
| |
617 |
response.redirect_url.should == "http://test.host/forums/1" |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
618 |
end |
| |
619 |
end |
| |
620 |
|
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
621 |
describe "Requesting /forums/1 using XHR PUT" do |
| |
622 |
controller_name :forums |
| |
623 |
|
| |
624 |
before(:each) do |
| |
625 |
@mock_forum = mock('Forum', :null_object => true) |
| |
626 |
@mock_forum.stub!(:to_param).and_return("1") |
| |
627 |
Forum.stub!(:find).and_return(@mock_forum) |
| |
628 |
end |
| |
629 |
|
| |
630 |
def do_update |
| |
631 |
xhr :put, :update, :id => "1" |
| |
632 |
end |
| |
633 |
|
| |
634 |
it "should find the forum requested" do |
| |
635 |
Forum.should_receive(:find).with("1").and_return(@mock_forum) |
| |
636 |
do_update |
| |
637 |
end |
| |
638 |
|
| |
639 |
it "should update the found forum" do |
|
dd20dcd5
»
|
ian |
2007-11-18 |
resources_controller: Added... |
640 |
@mock_forum.should_receive(:attributes=) |
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
641 |
do_update |
| |
642 |
assigns(:forum).should == @mock_forum |
| |
643 |
end |
| |
644 |
|
|
8cf4badb
»
|
ian |
2007-07-23 |
resources_controller: Added... |
645 |
it "should not set the flash notice" do |
| |
646 |
do_update |
| |
647 |
flash[:notice].should == nil |
| |
648 |
end |
| |
649 |
|
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
650 |
it "should assign the found forum for the view" do |
| |
651 |
do_update |
| |
652 |
assigns(:forum).should == @mock_forum |
| |
653 |
end |
| |
654 |
|
| |
655 |
it "should render update.rjs" do |
| |
656 |
do_update |
| |
657 |
response.should render_template('update') |
| |
658 |
end |
|
71554792
»
|
ian |
2007-09-06 |
resources_controller:Minor ... |
659 |
|
| |
660 |
it "should render edit.rjs, on unsuccessful save" do |
|
dd20dcd5
»
|
ian |
2007-11-18 |
resources_controller: Added... |
661 |
@mock_forum.stub!(:save).and_return(false) |
|
71554792
»
|
ian |
2007-09-06 |
resources_controller:Minor ... |
662 |
do_update |
| |
663 |
response.should render_template('edit') |
| |
664 |
end |
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
665 |
end |
| |
666 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
667 |
describe "Requesting /forums/1 using DELETE" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
668 |
controller_name :forums |
| |
669 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
670 |
before(:each) do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
671 |
@mock_forum = mock('Forum', :null_object => true) |
| |
672 |
Forum.stub!(:find).and_return(@mock_forum) |
| |
673 |
end |
| |
674 |
|
| |
675 |
def do_delete |
| |
676 |
delete :destroy, :id => "1" |
| |
677 |
end |
| |
678 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
679 |
it "should find the forum requested" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
680 |
Forum.should_receive(:find).with("1").and_return(@mock_forum) |
| |
681 |
do_delete |
| |
682 |
end |
| |
683 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
684 |
it "should call destroy on the found forum" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
685 |
@mock_forum.should_receive(:destroy) |
| |
686 |
do_delete |
| |
687 |
end |
| |
688 |
|
|
8cf4badb
»
|
ian |
2007-07-23 |
resources_controller: Added... |
689 |
it "should set the flash notice" do |
| |
690 |
do_delete |
| |
691 |
flash[:notice].should == 'Forum was successfully destroyed.' |
| |
692 |
end |
| |
693 |
|
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
694 |
it "should redirect to the forums list" do |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
695 |
do_delete |
|
6dccf6a7
»
|
ian |
2007-05-10 |
Upgraded specs for latest e... |
696 |
response.should be_redirect |
| |
697 |
response.redirect_url.should == "http://test.host/forums" |
|
122e9011
»
|
ian |
2007-01-31 |
git-svn-id: https://svn.ard... |
698 |
end |
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
699 |
end |
| |
700 |
|
| |
701 |
describe "Requesting /forums/1 using XHR DELETE" do |
| |
702 |
controller_name :forums |
| |
703 |
|
| |
704 |
before(:each) do |
| |
705 |
@mock_forum = mock('Forum', :null_object => true) |
| |
706 |
Forum.stub!(:find).and_return(@mock_forum) |
| |
707 |
end |
| |
708 |
|
| |
709 |
def do_delete |
| |
710 |
xhr :delete, :destroy, :id => "1" |
| |
711 |
end |
| |
712 |
|
| |
713 |
it "should find the forum requested" do |
| |
714 |
Forum.should_receive(:find).with("1").and_return(@mock_forum) |
| |
715 |
do_delete |
| |
716 |
end |
| |
717 |
|
|
8cf4badb
»
|
ian |
2007-07-23 |
resources_controller: Added... |
718 |
it "should not set the flash notice" do |
| |
719 |
do_delete |
| |
720 |
flash[:notice].should == nil |
| |
721 |
end |
| |
722 |
|
|
1535036c
»
|
ian |
2007-07-23 |
resources_controller: Added... |
723 |
it "should call destroy on the found forum" do |
| |
724 |
@mock_forum.should_receive(:destroy) |
| |
725 |
do_delete |
| |
726 |
end |
| |
727 |
|
| |
728 |
it "should render destroy.rjs" do |
| |
729 |
do_delete |
| |
730 |
response.should render_template('destroy') |
| |
731 |
end |
| |
732 |
end |