Sha256: 6ec67b40251e3aa237b2f59123567d4cd3bd3dde3becb592da5eddd5d50a594f

Contents?: true

Size: 734 Bytes

Versions: 90

Compression:

Stored size: 734 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

context "Rendering in file templates" do

  setup do
    Sinatra.application = nil
    use_in_file_templates!
  end

  specify "should set template" do
    assert Sinatra.application.templates[:foo]
  end

  specify "should set layout" do
    assert Sinatra.application.templates[:layout]
  end

  specify "should render without layout if specified" do
    get '/' do
      haml :foo, :layout => false
    end

    get_it '/'
    assert_equal "this is foo\n", body
  end

  specify "should render with layout if specified" do
    get '/' do
      haml :foo
    end

    get_it '/'
    assert_equal "X\nthis is foo\nX\n", body
  end

end

__END__

@@ foo
this is foo

@@ layout
X
= yield
X

Version data entries

90 entries across 90 versions & 14 rubygems

Version Path
nbudin-castronaut-0.7.5 vendor/sinatra/compat/use_in_file_templates_test.rb
sinatra-0.9.6 compat/use_in_file_templates_test.rb
sinatra-0.9.5 compat/use_in_file_templates_test.rb
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.10.17 vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.10.16 vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.10.15 vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
middleman-0.10.14 vendor/gems/gems/sinatra-0.9.4/compat/use_in_file_templates_test.rb
sinatra-0.9.4 compat/use_in_file_templates_test.rb
sinatra-0.9.1.1 compat/use_in_file_templates_test.rb
sinatra-0.9.0.1 compat/use_in_file_templates_test.rb
sinatra-0.9.0.2 compat/use_in_file_templates_test.rb