test/jbuilder_template_test.rb in jbuilder-2.2.2 vs test/jbuilder_template_test.rb in jbuilder-2.2.3
- old
+ new
@@ -3,11 +3,10 @@
require 'action_view'
require 'action_view/testing/resolvers'
require 'active_support/cache'
require 'jbuilder/jbuilder_template'
-
BLOG_POST_PARTIAL = <<-JBUILDER
json.extract! blog_post, :id, :body
json.author do
name = blog_post.author_name.split(nil, 2)
json.first_name name[0]
@@ -22,9 +21,11 @@
BlogPost = Struct.new(:id, :body, :author_name)
Collection = Struct.new(:id, :name)
blog_authors = [ 'David Heinemeier Hansson', 'Pavel Pravosud' ].cycle
BLOG_POST_COLLECTION = 10.times.map{ |i| BlogPost.new(i+1, "post body #{i+1}", blog_authors.next) }
COLLECTION_COLLECTION = 5.times.map{ |i| Collection.new(i+1, "collection #{i+1}") }
+
+ActionView::Template.register_template_handler :jbuilder, JbuilderHandler
module Rails
def self.cache
@cache ||= ActiveSupport::Cache::MemoryStore.new
end