From eed1a5dfbd91d327aa4511bbebe4f549d3188478 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 18 Dec 2011 08:41:17 +0000 Subject: [PATCH] Makes tests inherit from ActionView::TestCase. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8277 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/helpers/issues_helper_test.rb | 40 +++++++------------------ 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/test/unit/helpers/issues_helper_test.rb b/test/unit/helpers/issues_helper_test.rb index 3242e2278..21cde20fe 100644 --- a/test/unit/helpers/issues_helper_test.rb +++ b/test/unit/helpers/issues_helper_test.rb @@ -17,7 +17,7 @@ require File.expand_path('../../../test_helper', __FILE__) -class IssuesHelperTest < HelperTestCase +class IssuesHelperTest < ActionView::TestCase include ApplicationHelper include IssuesHelper @@ -31,24 +31,10 @@ class IssuesHelperTest < HelperTestCase :enabled_modules, :workflows - # Used by assert_select - def html_document - HTML::Document.new(@response.body) - end - def setup super set_language_if_valid('en') User.current = nil - @response = ActionController::TestResponse.new - end - - def controller - @controller ||= IssuesController.new - end - - def request - @request ||= ActionController::TestRequest.new end def test_issue_heading @@ -95,29 +81,27 @@ class IssuesHelperTest < HelperTestCase context "with html" do should 'show a changing attribute with HTML highlights' do @detail = JournalDetail.generate!(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio') - @response.body = show_detail(@detail, false) + html = show_detail(@detail, false) - assert_select 'strong', :text => '% Done' - assert_select 'i', :text => '40' - assert_select 'i', :text => '100' + assert_include '% Done', html + assert_include '40', html + assert_include '100', html end should 'show a new attribute with HTML highlights' do @detail = JournalDetail.generate!(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio') - @response.body = show_detail(@detail, false) + html = show_detail(@detail, false) - assert_select 'strong', :text => '% Done' - assert_select 'i', :text => '100' + assert_include '% Done', html + assert_include '100', html end should 'show a deleted attribute with HTML highlights' do @detail = JournalDetail.generate!(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio') - @response.body = show_detail(@detail, false) + html = show_detail(@detail, false) - assert_select 'strong', :text => '% Done' - assert_select 'strike' do - assert_select 'i', :text => '50' - end + assert_include '% Done', html + assert_include '50', html end end @@ -183,7 +167,5 @@ class IssuesHelperTest < HelperTestCase should "test custom fields" should "test attachments" - end - end -- 2.39.5