Sha256: 5d2f911b5f23a62b03631d68330e3aa5727c98978e6f787c083b25dba3eac7a2
Contents?: true
Size: 1.49 KB
Versions: 4
Compression:
Stored size: 1.49 KB
Contents
require 'test/unit' require 'rubygems' require "methodize" require "tilt" begin require 'ruby-debug' rescue Exception => e; end require "tokamak/hook/tilt" class Tokamak::Hook::TiltTest < Test::Unit::TestCase def test_tokamak_builder_integration_with_tilt @some_articles = [ {:id => 1, :title => "a great article", :updated => Time.now}, {:id => 2, :title => "another great article", :updated => Time.now} ] template = Tokamak::Hook::Tilt::TokamakTemplate.new(File.expand_path(File.dirname(__FILE__) + '/../../rails2_skel/app/views/test/show.tokamak'), :media_type => "application/json") json = template.render(self, :@some_articles => @some_articles) hash = JSON.parse(json).extend(Methodize) assert_equal "John Doe" , hash.author.first.name assert_equal "foobar@example.com" , hash.author.last.email assert_equal "http://example.com/json", hash.id assert_equal "http://a.link.com/next" , hash.link.first.href assert_equal "next" , hash.link.first.rel assert_equal "application/json" , hash.link.last.type assert_equal "uri:1" , hash.articles.first.id assert_equal "a great article" , hash.articles.first.title assert_equal "http://example.com/image/1" , hash.articles.last.link.first.href assert_equal "image" , hash.articles.last.link.first.rel assert_equal "application/json" , hash.articles.last.link.last.type end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tokamak-1.2.0 | test/tokamak/hook/tilt_test.rb |
tokamak-1.1.5 | test/tokamak/hook/tilt_test.rb |
tokamak-1.1.4 | test/tokamak/hook/tilt_test.rb |
tokamak-1.1.3 | test/tokamak/hook/tilt_test.rb |