aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-01-28 11:43:23 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2019-01-28 11:43:23 -0800
commita2be6ce3eb94516a57c07c98f3cb19502b05cff1 (patch)
tree91610361db7cab6cdd5c37652fc3f37c01335286 /actionview
parent2f9f699a2f6c6d470d2c639fe07d7850f6858c53 (diff)
downloadrails-a2be6ce3eb94516a57c07c98f3cb19502b05cff1.tar.gz
rails-a2be6ce3eb94516a57c07c98f3cb19502b05cff1.tar.bz2
rails-a2be6ce3eb94516a57c07c98f3cb19502b05cff1.zip
Remove method named "hash"
We can't use the FixtureResolver as a hash key because it doesn't implement `hash` correctly. This commit renames the method to "data" (which is just as unfortunately named :( )
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/testing/resolvers.rb6
-rw-r--r--actionview/test/template/lookup_context_test.rb12
2 files changed, 10 insertions, 8 deletions
diff --git a/actionview/lib/action_view/testing/resolvers.rb b/actionview/lib/action_view/testing/resolvers.rb
index 1fad08a689..d6203b95c5 100644
--- a/actionview/lib/action_view/testing/resolvers.rb
+++ b/actionview/lib/action_view/testing/resolvers.rb
@@ -8,13 +8,15 @@ module ActionView #:nodoc:
# useful for testing extensions that have no way of knowing what the file
# system will look like at runtime.
class FixtureResolver < PathResolver
- attr_reader :hash
-
def initialize(hash = {}, pattern = nil)
super(pattern)
@hash = hash
end
+ def data
+ @hash
+ end
+
def to_s
@hash.keys.join(", ")
end
diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb
index 68e151f154..02b5d48e5a 100644
--- a/actionview/test/template/lookup_context_test.rb
+++ b/actionview/test/template/lookup_context_test.rb
@@ -162,7 +162,7 @@ class LookupContextTest < ActiveSupport::TestCase
# Now we are going to change the template, but it won't change the returned template
# since we will hit the cache.
- @lookup_context.view_paths.first.hash["test/_foo.erb"] = "Bar"
+ @lookup_context.view_paths.first.data["test/_foo.erb"] = "Bar"
template = @lookup_context.find("foo", %w(test), true)
assert_equal "Foo", template.source
@@ -221,12 +221,12 @@ class LookupContextWithFalseCaching < ActiveSupport::TestCase
# Now we are going to change the template, but it won't change the returned template
# since the timestamp is the same.
- @resolver.hash["test/_foo.erb"][0] = "Bar"
+ @resolver.data["test/_foo.erb"][0] = "Bar"
template = @lookup_context.find("foo", %w(test), true)
assert_equal "Foo", template.source
# Now update the timestamp.
- @resolver.hash["test/_foo.erb"][1] = Time.now.utc
+ @resolver.data["test/_foo.erb"][1] = Time.now.utc
template = @lookup_context.find("foo", %w(test), true)
assert_equal "Bar", template.source
end
@@ -237,7 +237,7 @@ class LookupContextWithFalseCaching < ActiveSupport::TestCase
template = @lookup_context.find("foo", %w(test), true)
assert_equal "Foo", template.source
- @resolver.hash.clear
+ @resolver.data.clear
assert_raise ActionView::MissingTemplate do
@lookup_context.find("foo", %w(test), true)
end
@@ -246,12 +246,12 @@ class LookupContextWithFalseCaching < ActiveSupport::TestCase
test "if no template was cached in the first lookup, retrieval should work in the second call" do
ActionView::Resolver.stub(:caching?, false) do
- @resolver.hash.clear
+ @resolver.data.clear
assert_raise ActionView::MissingTemplate do
@lookup_context.find("foo", %w(test), true)
end
- @resolver.hash["test/_foo.erb"] = ["Foo", Time.utc(2000)]
+ @resolver.data["test/_foo.erb"] = ["Foo", Time.utc(2000)]
template = @lookup_context.find("foo", %w(test), true)
assert_equal "Foo", template.source
end