Sha256: dec196b892683c16c0d73eae0662146e7af084edcbe984048ffa533eb4661b23

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require 'spec/spec_helper'

describe "esi try" do
  
  it "should raise on try block without except" do
    proc {
      build_app('spec/tags/fixtures/try/malformed_attempt.html', {'/great' => "<p>This is great</p>"})
    }.should raise_error
  end
  
  it "should raise on try block without attempt" do
    proc {
      build_app('spec/tags/fixtures/try/malformed_attempt.html', {'/great' => "<p>This is great</p>"})
    }.should raise_error
  end
  
  it "should include normally within an attempt block" do
    build_app('spec/tags/fixtures/try/include.html', {'/great' => "<p>This is great</p>"}).last.should == 
      ["<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body><p>This is great</p></body></html>\n"]
  end
  
  it "should render the except block when the include fails within an attempt block" do
    build_app('spec/tags/fixtures/try/include.html', {}).last.should == 
      ["<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body>This is bad</body></html>\n"]
  end
  
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
joshbuddy-esi-for-rack-0.0.1 spec/tags/try_spec.rb
joshbuddy-esi-for-rack-0.0.2 spec/tags/try_spec.rb
joshbuddy-esi-for-rack-0.0.3 spec/tags/try_spec.rb