diff options
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/actionpack/controller/render_test.rb | 20 | ||||
-rw-r--r-- | actionview/test/template/digestor_test.rb | 20 | ||||
-rw-r--r-- | actionview/test/template/form_options_helper_test.rb | 7 | ||||
-rw-r--r-- | actionview/test/template/form_tag_helper_test.rb | 7 | ||||
-rw-r--r-- | actionview/test/template/record_tag_helper_test.rb | 3 |
5 files changed, 37 insertions, 20 deletions
diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb index c4228b5683..ebaf39a12d 100644 --- a/actionview/test/actionpack/controller/render_test.rb +++ b/actionview/test/actionpack/controller/render_test.rb @@ -1,6 +1,5 @@ require 'abstract_unit' require 'active_model' -require 'fileutils' class ApplicationController < ActionController::Base self.view_paths = File.join(FIXTURE_LOAD_PATH, "actionpack") @@ -679,14 +678,6 @@ class RenderTest < ActionController::TestCase ActionView::Base.logger = nil end - def case_sensitive_file_system? - fname = '.case_sensitive_file_system_test' - FileUtils.touch(fname) - !File.exist?(fname.upcase) - ensure - FileUtils.rm_f(fname) - end - # :ported: def test_simple_show get :hello_world @@ -753,15 +744,8 @@ class RenderTest < ActionController::TestCase end def test_render_action_upcased - action = :render_action_upcased_hello_world - - if case_sensitive_file_system? - assert_raise ActionView::MissingTemplate do - get action - end - else - get action - assert_equal 'Hello world!', @response.body + assert_raise ActionView::MissingTemplate do + get :render_action_upcased_hello_world end end diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index c2b8439df3..f0afcdb5ae 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -111,6 +111,18 @@ class TemplateDigestorTest < ActionView::TestCase end end + def test_logging_of_missing_template_for_dependencies + assert_logged "'messages/something_missing' file doesn't exist, so no dependencies" do + dependencies("messages/something_missing") + end + end + + def test_logging_of_missing_template_for_nested_dependencies + assert_logged "'messages/something_missing' file doesn't exist, so no dependencies" do + nested_dependencies("messages/something_missing") + end + end + def test_nested_template_directory assert_digest_difference("messages/show") do change_template("messages/actions/_move") @@ -298,6 +310,14 @@ class TemplateDigestorTest < ActionView::TestCase ActionView::Digestor.digest({ name: template_name, finder: finder }.merge(options)) end + def dependencies(template_name) + ActionView::Digestor.new({ name: template_name, finder: finder }).dependencies + end + + def nested_dependencies(template_name) + ActionView::Digestor.new({ name: template_name, finder: finder }).nested_dependencies + end + def finder @finder ||= FixtureFinder.new end diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index d25fa3706f..d7daba8bf3 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -645,6 +645,13 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_select_with_include_blank_false_and_required + @post = Post.new + @post.category = "<mus>" + e = assert_raises(ArgumentError) { select("post", "category", %w( abe <mus> hest), { include_blank: false }, required: 'required') } + assert_match(/include_blank cannot be false for a required field./, e.message) + end + def test_select_with_blank_as_string @post = Post.new @post.category = "<mus>" diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb index cad1c82309..f602c82c42 100644 --- a/actionview/test/template/form_tag_helper_test.rb +++ b/actionview/test/template/form_tag_helper_test.rb @@ -510,6 +510,13 @@ class FormTagHelperTest < ActionView::TestCase ) end + def test_button_tag_with_data_disable_with_option + assert_dom_equal( + %(<button name="button" type="submit" data-disable-with="Please wait...">Checkout</button>), + button_tag("Checkout", data: { disable_with: "Please wait..." }) + ) + end + def test_image_submit_tag_with_confirmation assert_dom_equal( %(<input alt="Save" type="image" src="/images/save.gif" data-confirm="Are you sure?" />), diff --git a/actionview/test/template/record_tag_helper_test.rb b/actionview/test/template/record_tag_helper_test.rb index 4b7b653916..bfc5d04bed 100644 --- a/actionview/test/template/record_tag_helper_test.rb +++ b/actionview/test/template/record_tag_helper_test.rb @@ -2,7 +2,7 @@ require 'abstract_unit' class RecordTagPost extend ActiveModel::Naming - include ActiveModel::Conversion + attr_accessor :id, :body def initialize @@ -14,7 +14,6 @@ class RecordTagPost end class RecordTagHelperTest < ActionView::TestCase - include RenderERBUtils tests ActionView::Helpers::RecordTagHelper |