Sha256: b543ed48ffba2f83bb77eb8911076a2528a256f7e01d32af54c2510cb387bf42
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
# encoding: utf-8 require File.join(File.dirname(__FILE__), 'test_helper') class ErectorTest < ActionController::TestCase context "#render with :erector" do setup do @cell = cell_mock end should "render the erector widget when called with block" do @cell.instance_eval do def jam @key = "A" render :erector => true do h1 do text "Rock it in " b @key end end end end assert_equal "<h1>Rock it in <b>A</b></h1>", @cell.render_state(:jam) end should "have access to cell helpers" do @cell.instance_eval do #self.class.helper ActionView::Helpers::UrlHelper def jam @key = "A" render :erector => true do #url_for("Rock it", "/rock/it") h1 do link_to("Rock it in #{@key}", :url => "/rock/it") end #text raw link_to("Rock it") #h "test" end end end #erector_in_cell = Erector::Widget.new class Erector::InlineWidget def link_to(*args) text! "what-ever!" end end assert_equal "<h1><a href=\"Rock it in A\" url=\"/rock/it\">Rock it in A</a></h1>", @cell.render_state(:jam) end should "cry for beer!" do require 'erector' obj = Object.new obj.instance_eval do def beer; "beer!"; end end assert_equal "<p>Cry for beer!</p>", Erector.inline() { p "Cry for #{text beer} #{b 'yo'}" }.to_s(:parent => obj) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cells-3.3.2 | test/erector_test.rb |