Sha256: b52b8dec578a6be70c243fdeb6efe8bb8ad33200200d3e0bee2610aee1ad5c75

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

require "#{::File.dirname(__FILE__)}/../../test_helper"

class TestDrConfigure < Test::Unit::TestCase
  context "Rendering of a string" do
    before do
      @template_string = "Hello <%= name %>"
    end
    it "should have a method called compile_string on the class" do assert Template.respond_to?(:compile_string);end
    it "should return rendered content" do assert Template.compile_string(@template_string, {:name => "bob"}), "Hello bob" end
  end
  context "Rendering of a file" do
    before do
      @template_file = ::File.dirname(__FILE__) + "/../../fixtures/test_template.erb"
    end
    it "should have a method called compile_file on the class" do assert Template.respond_to?(:compile_file);end
    it "should return rendered content" do assert Template.compile_file(@template_file, {:friends => "bob"}), "Hello bob" end
  end
  context "render_as" do
    setup do
      @template_options = {:render_as => :erb}
    end

    should "should call render with as erb" do
      assert Template.compile_string("Hi <%= world %>", @template_options.merge(:world => "world")), "Hi world"
    end
    should "call render with haml if rendered with haml" do
      # assert Template.compile_string("Hi <%= world %>", @template_options.merge(:render_as => :haml, :world => "world")), nil
    end
  end
  
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
auser-poolparty-1.1.3 test/poolparty/poolparty/template_test.rb
auser-poolparty-1.1.4 test/poolparty/poolparty/template_test.rb
auser-poolparty-1.1.5 test/poolparty/poolparty/template_test.rb
fairchild-poolparty-1.1.3 test/poolparty/poolparty/template_test.rb
fairchild-poolparty-1.1.4 test/poolparty/poolparty/template_test.rb
fairchild-poolparty-1.1.5 test/poolparty/poolparty/template_test.rb