Commit c6ec2f1e0d8b0d6b97328722714bc9a94f67fdfc

Authored by Rodrigo Souto
1 parent 4acbfa29

rails3: fix folder_helper test

Showing 1 changed file with 4 additions and 5 deletions   Show diff stats
test/unit/folder_helper_test.rb
1 1 require File.dirname(__FILE__) + '/../test_helper'
2 2  
3   -class FolderHelperTest < ActiveSupport::TestCase
  3 +class FolderHelperTest < ActionView::TestCase
4 4  
5 5 include ActionView::Helpers::TagHelper
6 6 include ActionView::Helpers::UrlHelper
7   - include ActionController::UrlWriter
8 7 include ActionView::Helpers::AssetTagHelper
9 8 include DatesHelper
10 9  
... ... @@ -25,7 +24,7 @@ class FolderHelperTest &lt; ActiveSupport::TestCase
25 24  
26 25 should 'display icon for images' do
27 26 profile = fast_create(Profile)
28   - file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => profile)
  27 + file = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => profile)
29 28 process_delayed_job_queue
30 29  
31 30 assert_match /rails_icon\.png/, icon_for_article(file.reload)
... ... @@ -96,7 +95,7 @@ class FolderHelperTest &lt; ActiveSupport::TestCase
96 95 article2 = fast_create(Article, {:name => 'Article2', :parent_id => folder.id, :profile_id => profile.id, :updated_at => DateTime.now })
97 96 self.stubs(:params).returns({:npage => nil})
98 97  
99   - articles = folder.children.find(:all, :order => 'updated_at DESC').paginate(:per_page => 10, :page => params[:npage])
  98 + articles = folder.children.order('updated_at DESC').paginate(:per_page => 10, :page => params[:npage])
100 99 expects(:user).returns(profile).at_least_once
101 100 expects(:recursive).returns(false).at_least_once
102 101 expects(:pagination_links).with(anything, anything).returns('')
... ... @@ -127,7 +126,7 @@ class FolderHelperTest &lt; ActiveSupport::TestCase
127 126  
128 127 private
129 128 def render(template, the_binding)
130   - ERB.new(File.read(Rails.root + '/app/views/' + template + '.rhtml')).result(the_binding)
  129 + ERB.new(File.read(File.join(Rails.root, 'app/views', template + '.html.erb'))).result(the_binding)
131 130 end
132 131  
133 132 end
... ...