Sha256: fa0bc9f56bf7c2aeb6c510e9c0b41137a5638ade520476c4011f77c1a5445ef8

Contents?: true

Size: 963 Bytes

Versions: 23

Compression:

Stored size: 963 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_must_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_must_be_html expected
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
angelo-0.3.1 test/angelo/erb_spec.rb
angelo-0.3.0 test/angelo/erb_spec.rb
angelo-0.2.4 test/angelo/erb_spec.rb
angelo-0.2.3 test/angelo/erb_spec.rb
angelo-0.2.2 test/angelo/erb_spec.rb
angelo-0.2.1 test/angelo/erb_spec.rb
angelo-0.2.0 test/angelo/erb_spec.rb
angelo-0.1.24 test/angelo/erb_spec.rb
angelo-0.1.23 test/angelo/erb_spec.rb
angelo-0.1.22 test/angelo/erb_spec.rb
angelo-0.1.21 test/angelo/erb_spec.rb
angelo-0.1.19 test/angelo/erb_spec.rb
angelo-0.1.18 test/angelo/erb_spec.rb
angelo-0.1.17 test/angelo/erb_spec.rb
angelo-0.1.16 test/angelo/erb_spec.rb
angelo-0.1.15 test/angelo/erb_spec.rb
angelo-0.1.14 test/angelo/erb_spec.rb
angelo-0.1.13 test/angelo/erb_spec.rb
angelo-0.1.12 test/angelo/erb_spec.rb
angelo-0.1.11 test/angelo/erb_spec.rb