require File.dirname(__FILE__) + '/../abstract_unit' require File.dirname(__FILE__) + '/../../lib/action_view/helpers/date_helper' require File.dirname(__FILE__) + '/../../lib/action_view/helpers/number_helper' require File.dirname(__FILE__) + '/../../lib/action_view/helpers/asset_tag_helper' require File.dirname(__FILE__) + '/../../lib/action_view/helpers/form_tag_helper' require File.dirname(__FILE__) + '/../../lib/action_view/helpers/tag_helper' require File.dirname(__FILE__) + '/../../lib/action_view/helpers/javascript_helper' require File.dirname(__FILE__) + '/../../lib/action_view/helpers/upload_progress_helper' require File.dirname(__FILE__) + '/../../../activesupport/lib/active_support/core_ext/hash' #for stringify keys class MockProgress def initialize(started, finished) @started, @finished = [started, finished] end def started? @started end def finished? @finished end def message "A message" end def method_missing(meth, *args) # Just return some consitant number meth.to_s.hash.to_i.abs + args.hash.to_i.abs end end class UploadProgressHelperTest < Test::Unit::TestCase include ActionView::Helpers::DateHelper include ActionView::Helpers::NumberHelper include ActionView::Helpers::AssetTagHelper include ActionView::Helpers::FormTagHelper include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper include ActionView::Helpers::JavaScriptHelper include ActionView::Helpers::UploadProgressHelper def next_upload_id; @upload_id = last_upload_id.succ; end def last_upload_id; @upload_id ||= 0; end def current_upload_id; last_upload_id; end def upload_progress(upload_id = nil); @upload_progress ||= MockProgress.new(false, true); end def setup @controller = Class.new do def url_for(options, *parameters_for_method_reference) "http://www.example.com" end end @controller = @controller.new end def test_upload_status_tag assert_dom_equal( '