test/jbuilder_template_test.rb in jbuilder-2.0.7 vs test/jbuilder_template_test.rb in jbuilder-2.0.8
- old
+ new
@@ -214,22 +214,22 @@
test 'fragment caching deserializes an array' do
undef_context_methods :fragment_name_with_digest, :cache_fragment_name
render_jbuilder <<-JBUILDER
json.cache! 'cachekey' do
- json.array! %w(a b c)
+ json.array! %w[a b c]
end
JBUILDER
json = render_jbuilder <<-JBUILDER
json.cache! 'cachekey' do
- json.array! %w(1 2 3)
+ json.array! %w[1 2 3]
end
JBUILDER
parsed = MultiJson.load(json)
- assert_equal %w(a b c), parsed
+ assert_equal %w[a b c], parsed
end
test 'fragment caching works with previous version of cache digests' do
undef_context_methods :cache_fragment_name
@@ -244,10 +244,11 @@
test 'fragment caching works with current cache digests' do
undef_context_methods :fragment_name_with_digest
@context.expects :cache_fragment_name
+ ActiveSupport::Cache.expects :expand_cache_key
render_jbuilder <<-JBUILDER
json.cache! 'cachekey' do
json.name 'Cache'
end
@@ -256,10 +257,11 @@
test 'current cache digest option accepts options' do
undef_context_methods :fragment_name_with_digest
@context.expects(:cache_fragment_name).with('cachekey', skip_digest: true)
+ ActiveSupport::Cache.expects :expand_cache_key
render_jbuilder <<-JBUILDER
json.cache! 'cachekey', skip_digest: true do
json.name 'Cache'
end
@@ -273,20 +275,8 @@
json.name 'Cache'
end
JBUILDER
assert_equal Rails.cache.inspect[/entries=(\d+)/, 1], '0'
- end
-
- test 'fragment caching falls back on ActiveSupport::Cache.expand_cache_key' do
- undef_context_methods :fragment_name_with_digest, :cache_fragment_name
-
- ActiveSupport::Cache.expects :expand_cache_key
-
- render_jbuilder <<-JBUILDER
- json.cache! 'cachekey' do
- json.name 'Cache'
- end
- JBUILDER
end
end