File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,14 +18,14 @@ def collection_path
1818 end
1919
2020 def edit_resource_path
21- edit_support_question_path
21+ edit_support_question_path ( @support_question )
2222 end
2323
2424 def resource_path ( question )
2525 if question
2626 support_question_path ( question )
2727 else
28- support_question_path ( @question )
28+ support_question_path ( @support_question )
2929 end
3030 end
3131
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe SupportPresenter do
4+
5+ let ( :question ) { Fabricate ( :question ) }
6+ let ( :another_question ) { Fabricate ( :question , :id => 'AnotherID' ) }
7+
8+ before do
9+ @sp = SupportPresenter . new ( question )
10+ end
11+
12+ context 'page_title' do
13+ it 'returns support questions title' do
14+ @sp . page_title . should == 'Support Questions'
15+ end
16+ end
17+
18+ context 'collection_path' do
19+ it 'returns support questions_path' do
20+ @sp . collection_path . should == '/support/questions'
21+ end
22+ end
23+
24+ context 'edit_resource_path' do
25+ it 'returns edit_support_question_path' do
26+ @sp . edit_resource_path . should == '/support/questions/RandomID/edit'
27+ end
28+ end
29+
30+ context 'new_resource_path' do
31+ it 'returns new_support_question_path' do
32+ @sp . new_resource_path . should == '/support/questions/new'
33+ end
34+ end
35+
36+ context 'resource_path' do
37+ it 'returns self question path if nil' do
38+ @sp . resource_path ( nil ) . should == '/support/questions/RandomID'
39+ end
40+
41+ it 'returns question path if not nil' do
42+ @sp . resource_path ( another_question ) . should == '/support/questions/AnotherID'
43+ end
44+ end
45+ end
You can’t perform that action at this time.
0 commit comments