##// END OF EJS Templates
Makes tests inherit from ActionView::TestCase....
Jean-Philippe Lang -
r8157:eed1a5dfbd91
parent child
Show More
@@ -17,7 +17,7
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class IssuesHelperTest < HelperTestCase
20 class IssuesHelperTest < ActionView::TestCase
21 include ApplicationHelper
21 include ApplicationHelper
22 include IssuesHelper
22 include IssuesHelper
23
23
@@ -31,24 +31,10 class IssuesHelperTest < HelperTestCase
31 :enabled_modules,
31 :enabled_modules,
32 :workflows
32 :workflows
33
33
34 # Used by assert_select
35 def html_document
36 HTML::Document.new(@response.body)
37 end
38
39 def setup
34 def setup
40 super
35 super
41 set_language_if_valid('en')
36 set_language_if_valid('en')
42 User.current = nil
37 User.current = nil
43 @response = ActionController::TestResponse.new
44 end
45
46 def controller
47 @controller ||= IssuesController.new
48 end
49
50 def request
51 @request ||= ActionController::TestRequest.new
52 end
38 end
53
39
54 def test_issue_heading
40 def test_issue_heading
@@ -95,29 +81,27 class IssuesHelperTest < HelperTestCase
95 context "with html" do
81 context "with html" do
96 should 'show a changing attribute with HTML highlights' do
82 should 'show a changing attribute with HTML highlights' do
97 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
83 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
98 @response.body = show_detail(@detail, false)
84 html = show_detail(@detail, false)
99
85
100 assert_select 'strong', :text => '% Done'
86 assert_include '<strong>% Done</strong>', html
101 assert_select 'i', :text => '40'
87 assert_include '<i>40</i>', html
102 assert_select 'i', :text => '100'
88 assert_include '<i>100</i>', html
103 end
89 end
104
90
105 should 'show a new attribute with HTML highlights' do
91 should 'show a new attribute with HTML highlights' do
106 @detail = JournalDetail.generate!(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
92 @detail = JournalDetail.generate!(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
107 @response.body = show_detail(@detail, false)
93 html = show_detail(@detail, false)
108
94
109 assert_select 'strong', :text => '% Done'
95 assert_include '<strong>% Done</strong>', html
110 assert_select 'i', :text => '100'
96 assert_include '<i>100</i>', html
111 end
97 end
112
98
113 should 'show a deleted attribute with HTML highlights' do
99 should 'show a deleted attribute with HTML highlights' do
114 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
100 @detail = JournalDetail.generate!(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
115 @response.body = show_detail(@detail, false)
101 html = show_detail(@detail, false)
116
102
117 assert_select 'strong', :text => '% Done'
103 assert_include '<strong>% Done</strong>', html
118 assert_select 'strike' do
104 assert_include '<strike><i>50</i></strike>', html
119 assert_select 'i', :text => '50'
120 end
121 end
105 end
122 end
106 end
123
107
@@ -183,7 +167,5 class IssuesHelperTest < HelperTestCase
183
167
184 should "test custom fields"
168 should "test custom fields"
185 should "test attachments"
169 should "test attachments"
186
187 end
170 end
188
189 end
171 end
General Comments 0
You need to be logged in to leave comments. Login now