Sha256: 66627309c2a80b7bf0f3c3cfb30d360ae859c5224877d70dabcfd2f1c2558209

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Ki::Middleware::HamlCompiler do
  let(:compiler) { Ki::Middleware::HamlCompiler }

  it 'works' do
    # TODO: find out why twice
    expect_any_instance_of(compiler).to receive(:view_exists?).twice.and_return(true)
    expect(File).to receive(:read).twice.and_return('%p hello')
    get '/existing_haml'
    expect(last_response.body).to eq "<p>hello</p>\n"
  end

  it 'passes to next middleware' do
    expect_any_instance_of(compiler).to receive(:view_exists?).and_return(false)
    get '/inexisting_haml'
    expect(last_response.body).to eq '<h1>404</h1>'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ki-0.4.12 spec/lib/ki/middleware/haml_compiler_spec.rb