diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-16 02:08:34 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-16 02:09:16 +0100 |
commit | 8dd731bc502a07f4fb76eb2706a1f3bca479ef63 (patch) | |
tree | 469e95a8f2f17b06250189d34211cef435a885c7 /actionpack/test | |
parent | 1f5e2f2bad3c33ec52312a1700bacf06a71875a5 (diff) | |
download | rails-8dd731bc502a07f4fb76eb2706a1f3bca479ef63.tar.gz rails-8dd731bc502a07f4fb76eb2706a1f3bca479ef63.tar.bz2 rails-8dd731bc502a07f4fb76eb2706a1f3bca479ef63.zip |
Move more normalization up to the lookup context, so it does not have to repeat in every resolver.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/lib/fixture_template.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/lookup_context_test.rb | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/actionpack/test/lib/fixture_template.rb b/actionpack/test/lib/fixture_template.rb index 02248d84ad..2e876d9249 100644 --- a/actionpack/test/lib/fixture_template.rb +++ b/actionpack/test/lib/fixture_template.rb @@ -12,7 +12,7 @@ module ActionView #:nodoc: def query(partial, path, exts) query = Regexp.escape(path) exts.each do |ext| - query << '(' << ext.map {|e| e && Regexp.escape(".#{e}") }.join('|') << ')' + query << '(' << ext.map {|e| e && Regexp.escape(".#{e}") }.join('|') << '|)' end templates = [] diff --git a/actionpack/test/template/lookup_context_test.rb b/actionpack/test/template/lookup_context_test.rb index 697ebc694a..37526957bc 100644 --- a/actionpack/test/template/lookup_context_test.rb +++ b/actionpack/test/template/lookup_context_test.rb @@ -22,14 +22,14 @@ class LookupContextTest < ActiveSupport::TestCase end test "normalizes details on initialization" do - formats = Mime::SET + [nil] - locale = [I18n.locale, nil] + formats = Mime::SET + locale = [I18n.locale] assert_equal Hash[:formats => formats, :locale => locale], @lookup_context.details end test "allows me to set details" do @lookup_context.details = { :formats => [:html], :locale => :pt } - assert_equal Hash[:formats => [:html, nil], :locale => [:pt, nil]], @lookup_context.details + assert_equal Hash[:formats => [:html], :locale => [:pt]], @lookup_context.details end test "does not allow details to be modified in place" do @@ -39,17 +39,17 @@ class LookupContextTest < ActiveSupport::TestCase test "allows me to update an specific detail" do @lookup_context.update_details(:locale => :pt) assert_equal :pt, I18n.locale - formats = Mime::SET + [nil] - locale = [I18n.locale, nil] + formats = Mime::SET + locale = [I18n.locale] assert_equal Hash[:formats => formats, :locale => locale], @lookup_context.details end test "allows me to change some details to execute an specific block of code" do - formats = Mime::SET + [nil] + formats = Mime::SET @lookup_context.update_details(:locale => :pt) do - assert_equal Hash[:formats => formats, :locale => [:pt, nil]], @lookup_context.details + assert_equal Hash[:formats => formats, :locale => [:pt]], @lookup_context.details end - assert_equal Hash[:formats => formats, :locale => [:en, nil]], @lookup_context.details + assert_equal Hash[:formats => formats, :locale => [:en]], @lookup_context.details end test "provides getters and setters for formats" do |