Sha256: 344477053d05340b6d9e163ed26a121b70def0f4ebec870ca143ec1f87742a5a

Contents?: true

Size: 967 Bytes

Versions: 6

Compression:

Stored size: 967 Bytes

Contents

require_relative '../spec_helper'
require 'angelo/tilt/erb'

describe Angelo::Base do
  describe Angelo::Tilt::ERB do

    define_app do

      include Angelo::Tilt::ERB

      @root = TEST_APP_ROOT

      def set_vars
        @title = 'test'
        @foo = params[:foo]
      end

      get '/' do
        set_vars
        erb :index, locals: {bar: 'bat'}
      end

      get '/no_layout' do
        set_vars
        erb :index, layout: false, locals: {bar: 'bat'}
      end

    end

    it 'renders templates with layout' do
      get '/', foo: 'asdf'
      expected = <<HTML
<!doctype html>
<html>
  <head>
    <title>test</title>
  </head>
  <body>
    foo - asdf
locals :bar - bat

  </body>
</html>
HTML
      last_response_should_be_html expected
    end

    it 'renders templates without layout' do
      get '/no_layout', foo: 'asdf'
      expected = <<HTML
foo - asdf
locals :bar - bat
HTML
      last_response_should_be_html expected
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
angelo-0.1.7 spec/angelo/erb_spec.rb
angelo-0.1.6 spec/angelo/erb_spec.rb
angelo-0.1.5 spec/angelo/erb_spec.rb
angelo-0.1.4 spec/angelo/erb_spec.rb
angelo-0.1.3 spec/angelo/erb_spec.rb
angelo-0.1.2 spec/angelo/erb_spec.rb