diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/mime_type_test.rb | 18 | ||||
-rw-r--r-- | actionpack/test/template/form_tag_helper_test.rb | 2 |
2 files changed, 17 insertions, 3 deletions
diff --git a/actionpack/test/controller/mime_type_test.rb b/actionpack/test/controller/mime_type_test.rb index 65acbbf36e..0755f9d62d 100644 --- a/actionpack/test/controller/mime_type_test.rb +++ b/actionpack/test/controller/mime_type_test.rb @@ -1,8 +1,8 @@ require File.dirname(__FILE__) + '/../abstract_unit' class MimeTypeTest < Test::Unit::TestCase - Mime::PNG = Mime::Type.new("image/png") - Mime::PLAIN = Mime::Type.new("text/plain") + Mime::Type.register "image/png", :png + Mime::Type.register "text/plain", :plain def test_parse_single Mime::LOOKUP.keys.each do |mime_type| @@ -30,4 +30,18 @@ class MimeTypeTest < Test::Unit::TestCase end Mime.send :remove_const, :GIF end + + def test_type_convenience_methods + types = [:html, :xml, :png, :plain, :yaml] + types.each do |type| + mime = Mime.const_get(type.to_s.upcase) + assert mime.send("#{type}?"), "Mime::#{type.to_s.upcase} is not #{type}?" + (types - [type]).each { |t| assert !mime.send("#{t}?"), "Mime::#{t.to_s.upcase} is #{t}?" } + end + end + + def test_mime_all_is_html + assert Mime::ALL.all?, "Mime::ALL is not all?" + assert Mime::ALL.html?, "Mime::ALL is not html?" + end end
\ No newline at end of file diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index e7fd3b0823..cc5ab1e7f4 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -132,7 +132,7 @@ class FormTagHelperTest < Test::Unit::TestCase def test_submit_tag assert_dom_equal( - %(<input name='commit' type='submit' value='Save' onclick="this.disabled=true;this.value='Saving...';alert('hello!');return (this.form.onsubmit ? this.form.onsubmit() : true)" />), + %(<input name='commit' type='submit' value='Save' onclick="this.disabled=true;this.value='Saving...';alert('hello!');return (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit())" />), submit_tag("Save", :disable_with => "Saving...", :onclick => "alert('hello!')") ) end |