adamwiggins-sinatra 0.8.9 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +8 -7
 - data/CHANGES +211 -1
 - data/LICENSE +1 -1
 - data/README.rdoc +183 -139
 - data/Rakefile +20 -81
 - data/lib/sinatra.rb +5 -1
 - data/lib/sinatra/base.rb +569 -278
 - data/lib/sinatra/main.rb +12 -25
 - data/lib/sinatra/showexceptions.rb +303 -0
 - data/sinatra.gemspec +20 -44
 - data/test/base_test.rb +140 -52
 - data/test/builder_test.rb +14 -17
 - data/test/contest.rb +64 -0
 - data/test/erb_test.rb +42 -16
 - data/test/extensions_test.rb +100 -0
 - data/test/filter_test.rb +85 -13
 - data/test/haml_test.rb +39 -21
 - data/test/helper.rb +76 -0
 - data/test/helpers_test.rb +219 -84
 - data/test/mapped_error_test.rb +168 -146
 - data/test/middleware_test.rb +22 -17
 - data/test/options_test.rb +323 -54
 - data/test/render_backtrace_test.rb +145 -0
 - data/test/request_test.rb +28 -6
 - data/test/response_test.rb +42 -0
 - data/test/result_test.rb +27 -21
 - data/test/route_added_hook_test.rb +59 -0
 - data/test/routing_test.rb +558 -77
 - data/test/sass_test.rb +52 -13
 - data/test/server_test.rb +47 -0
 - data/test/sinatra_test.rb +3 -5
 - data/test/static_test.rb +57 -30
 - data/test/templates_test.rb +74 -25
 - data/test/views/error.builder +3 -0
 - data/test/views/error.erb +3 -0
 - data/test/views/error.haml +3 -0
 - data/test/views/error.sass +2 -0
 - data/test/views/foo/hello.test +1 -0
 - metadata +50 -46
 - data/compat/app_test.rb +0 -300
 - data/compat/application_test.rb +0 -334
 - data/compat/builder_test.rb +0 -101
 - data/compat/custom_error_test.rb +0 -62
 - data/compat/erb_test.rb +0 -136
 - data/compat/events_test.rb +0 -75
 - data/compat/filter_test.rb +0 -30
 - data/compat/haml_test.rb +0 -233
 - data/compat/helper.rb +0 -21
 - data/compat/mapped_error_test.rb +0 -72
 - data/compat/pipeline_test.rb +0 -71
 - data/compat/public/foo.xml +0 -1
 - data/compat/sass_test.rb +0 -57
 - data/compat/sessions_test.rb +0 -39
 - data/compat/streaming_test.rb +0 -121
 - data/compat/sym_params_test.rb +0 -19
 - data/compat/template_test.rb +0 -30
 - data/compat/use_in_file_templates_test.rb +0 -47
 - data/compat/views/foo.builder +0 -1
 - data/compat/views/foo.erb +0 -1
 - data/compat/views/foo.haml +0 -1
 - data/compat/views/foo.sass +0 -2
 - data/compat/views/foo_layout.erb +0 -2
 - data/compat/views/foo_layout.haml +0 -2
 - data/compat/views/layout_test/foo.builder +0 -1
 - data/compat/views/layout_test/foo.erb +0 -1
 - data/compat/views/layout_test/foo.haml +0 -1
 - data/compat/views/layout_test/foo.sass +0 -2
 - data/compat/views/layout_test/layout.builder +0 -3
 - data/compat/views/layout_test/layout.erb +0 -1
 - data/compat/views/layout_test/layout.haml +0 -1
 - data/compat/views/layout_test/layout.sass +0 -2
 - data/compat/views/no_layout/no_layout.builder +0 -1
 - data/compat/views/no_layout/no_layout.haml +0 -1
 - data/lib/sinatra/compat.rb +0 -239
 - data/lib/sinatra/test.rb +0 -112
 - data/lib/sinatra/test/rspec.rb +0 -2
 - data/lib/sinatra/test/spec.rb +0 -2
 - data/lib/sinatra/test/unit.rb +0 -11
 - data/test/reload_test.rb +0 -65
 
    
        data/compat/builder_test.rb
    DELETED
    
    | 
         @@ -1,101 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            context "Builder" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              setup do
         
     | 
| 
       6 
     | 
    
         
            -
                Sinatra.application = nil
         
     | 
| 
       7 
     | 
    
         
            -
              end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              context "without layouts" do
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                setup do
         
     | 
| 
       12 
     | 
    
         
            -
                  Sinatra.application = nil
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                specify "should render" do
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                  get '/no_layout' do
         
     | 
| 
       18 
     | 
    
         
            -
                    builder 'xml.instruct!'
         
     | 
| 
       19 
     | 
    
         
            -
                  end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                  get_it '/no_layout'
         
     | 
| 
       22 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       23 
     | 
    
         
            -
                  body.should == %(<?xml version="1.0" encoding="UTF-8"?>\n)
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                specify "should render inline block" do
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                  get '/no_layout_and_inlined' do
         
     | 
| 
       30 
     | 
    
         
            -
                    @name = "Frank & Mary"
         
     | 
| 
       31 
     | 
    
         
            -
                    builder do |xml|
         
     | 
| 
       32 
     | 
    
         
            -
                      xml.couple @name
         
     | 
| 
       33 
     | 
    
         
            -
                    end
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                  get_it '/no_layout_and_inlined'
         
     | 
| 
       37 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       38 
     | 
    
         
            -
                  body.should == %(<couple>Frank & Mary</couple>\n)
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
              end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
              context "Templates (in general)" do
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                setup do
         
     | 
| 
       49 
     | 
    
         
            -
                  Sinatra.application = nil
         
     | 
| 
       50 
     | 
    
         
            -
                end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                specify "are read from files if Symbols" do
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                  get '/from_file' do
         
     | 
| 
       55 
     | 
    
         
            -
                    @name = 'Blue'
         
     | 
| 
       56 
     | 
    
         
            -
                    builder :foo, :views_directory => File.dirname(__FILE__) + "/views"
         
     | 
| 
       57 
     | 
    
         
            -
                  end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                  get_it '/from_file'
         
     | 
| 
       60 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       61 
     | 
    
         
            -
                  body.should.equal %(<exclaim>You rock Blue!</exclaim>\n)
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                specify "use layout.ext by default if available" do
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       68 
     | 
    
         
            -
                    builder :foo, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
         
     | 
| 
       69 
     | 
    
         
            -
                  end
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       72 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       73 
     | 
    
         
            -
                  body.should.equal "<layout>\n<this>is foo!</this>\n</layout>\n"
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                specify "renders without layout" do
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       80 
     | 
    
         
            -
                    builder :no_layout, :views_directory => File.dirname(__FILE__) + "/views/no_layout"
         
     | 
| 
       81 
     | 
    
         
            -
                  end
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       84 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       85 
     | 
    
         
            -
                  body.should.equal "<foo>No Layout!</foo>\n"
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
                end
         
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
                specify "raises error if template not found" do
         
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       92 
     | 
    
         
            -
                    builder :not_found
         
     | 
| 
       93 
     | 
    
         
            -
                  end
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
                  lambda { get_it '/' }.should.raise(Errno::ENOENT)
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
              end
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
            end
         
     | 
    
        data/compat/custom_error_test.rb
    DELETED
    
    | 
         @@ -1,62 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            context "Custom Errors" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              setup do
         
     | 
| 
       6 
     | 
    
         
            -
                Sinatra.application = nil
         
     | 
| 
       7 
     | 
    
         
            -
              end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              specify "override the default 404" do
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                get_it '/'
         
     | 
| 
       12 
     | 
    
         
            -
                should.be.not_found
         
     | 
| 
       13 
     | 
    
         
            -
                body.should.equal '<h1>Not Found</h1>'
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                error Sinatra::NotFound do
         
     | 
| 
       16 
     | 
    
         
            -
                  'Custom 404'
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                get_it '/'
         
     | 
| 
       20 
     | 
    
         
            -
                should.be.not_found
         
     | 
| 
       21 
     | 
    
         
            -
                body.should.equal 'Custom 404'
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              specify "override the default 500" do
         
     | 
| 
       26 
     | 
    
         
            -
                Sinatra.application.options.raise_errors = false
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                get '/' do
         
     | 
| 
       29 
     | 
    
         
            -
                  raise 'asdf'
         
     | 
| 
       30 
     | 
    
         
            -
                end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                get_it '/'
         
     | 
| 
       33 
     | 
    
         
            -
                status.should.equal 500
         
     | 
| 
       34 
     | 
    
         
            -
                body.should.equal '<h1>Internal Server Error</h1>'
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                error do
         
     | 
| 
       38 
     | 
    
         
            -
                  'Custom 500 for ' + request.env['sinatra.error'].message
         
     | 
| 
       39 
     | 
    
         
            -
                end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                get_it '/'
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                get_it '/'
         
     | 
| 
       44 
     | 
    
         
            -
                status.should.equal 500
         
     | 
| 
       45 
     | 
    
         
            -
                body.should.equal 'Custom 500 for asdf'
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                Sinatra.application.options.raise_errors = true
         
     | 
| 
       48 
     | 
    
         
            -
              end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
              class UnmappedError < RuntimeError; end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
              specify "should bring unmapped error back to the top" do
         
     | 
| 
       53 
     | 
    
         
            -
                get '/' do
         
     | 
| 
       54 
     | 
    
         
            -
                  raise UnmappedError, 'test'
         
     | 
| 
       55 
     | 
    
         
            -
                end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                assert_raises(UnmappedError) do
         
     | 
| 
       58 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       59 
     | 
    
         
            -
                end
         
     | 
| 
       60 
     | 
    
         
            -
              end
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            end
         
     | 
    
        data/compat/erb_test.rb
    DELETED
    
    | 
         @@ -1,136 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            context "Erb" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              setup do
         
     | 
| 
       6 
     | 
    
         
            -
                Sinatra.application = nil
         
     | 
| 
       7 
     | 
    
         
            -
              end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              context "without layouts" do
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                setup do
         
     | 
| 
       12 
     | 
    
         
            -
                  Sinatra.application = nil
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                specify "should render" do
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                  get '/no_layout' do
         
     | 
| 
       18 
     | 
    
         
            -
                    erb '<%= 1 + 1 %>'
         
     | 
| 
       19 
     | 
    
         
            -
                  end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                  get_it '/no_layout'
         
     | 
| 
       22 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       23 
     | 
    
         
            -
                  body.should == '2'
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                specify "should take an options hash with :locals set with a string" do
         
     | 
| 
       28 
     | 
    
         
            -
                  get '/locals' do
         
     | 
| 
       29 
     | 
    
         
            -
                    erb '<%= foo %>', :locals => {:foo => "Bar"}
         
     | 
| 
       30 
     | 
    
         
            -
                  end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                  get_it '/locals'
         
     | 
| 
       33 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       34 
     | 
    
         
            -
                  body.should == 'Bar'
         
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                specify "should take an options hash with :locals set with a complex object" do
         
     | 
| 
       38 
     | 
    
         
            -
                  get '/locals-complex' do
         
     | 
| 
       39 
     | 
    
         
            -
                    erb '<%= foo[0] %>', :locals => {:foo => ["foo", "bar", "baz"]}
         
     | 
| 
       40 
     | 
    
         
            -
                  end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                  get_it '/locals-complex'
         
     | 
| 
       43 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       44 
     | 
    
         
            -
                  body.should == 'foo'
         
     | 
| 
       45 
     | 
    
         
            -
                end
         
     | 
| 
       46 
     | 
    
         
            -
              end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
              context "with layouts" do
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                setup do
         
     | 
| 
       51 
     | 
    
         
            -
                  Sinatra.application = nil
         
     | 
| 
       52 
     | 
    
         
            -
                end
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                specify "can be inline" do
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                  layout do
         
     | 
| 
       57 
     | 
    
         
            -
                    %Q{This is <%= yield %>!}
         
     | 
| 
       58 
     | 
    
         
            -
                  end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  get '/lay' do
         
     | 
| 
       61 
     | 
    
         
            -
                    erb 'Blake'
         
     | 
| 
       62 
     | 
    
         
            -
                  end
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                  get_it '/lay'
         
     | 
| 
       65 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       66 
     | 
    
         
            -
                  body.should.equal 'This is Blake!'
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                specify "can use named layouts" do
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                  layout :pretty do
         
     | 
| 
       73 
     | 
    
         
            -
                    %Q{<h1><%= yield %></h1>}
         
     | 
| 
       74 
     | 
    
         
            -
                  end
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                  get '/pretty' do
         
     | 
| 
       77 
     | 
    
         
            -
                    erb 'Foo', :layout => :pretty
         
     | 
| 
       78 
     | 
    
         
            -
                  end
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                  get '/not_pretty' do
         
     | 
| 
       81 
     | 
    
         
            -
                    erb 'Bar'
         
     | 
| 
       82 
     | 
    
         
            -
                  end
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                  get_it '/pretty'
         
     | 
| 
       85 
     | 
    
         
            -
                  body.should.equal '<h1>Foo</h1>'
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
                  get_it '/not_pretty'
         
     | 
| 
       88 
     | 
    
         
            -
                  body.should.equal 'Bar'
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                end
         
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                specify "can be read from a file if they're not inlined" do
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
                  get '/foo' do
         
     | 
| 
       95 
     | 
    
         
            -
                    @title = 'Welcome to the Hello Program'
         
     | 
| 
       96 
     | 
    
         
            -
                    erb 'Blake', :layout => :foo_layout,
         
     | 
| 
       97 
     | 
    
         
            -
                                 :views_directory => File.dirname(__FILE__) + "/views"
         
     | 
| 
       98 
     | 
    
         
            -
                  end
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
                  get_it '/foo'
         
     | 
| 
       101 
     | 
    
         
            -
                  body.should.equal "Welcome to the Hello Program\nHi Blake\n"
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
                end
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
              end
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
              context "Templates (in general)" do
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                specify "are read from files if Symbols" do
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                  get '/from_file' do
         
     | 
| 
       112 
     | 
    
         
            -
                    @name = 'Alena'
         
     | 
| 
       113 
     | 
    
         
            -
                    erb :foo, :views_directory => File.dirname(__FILE__) + "/views"
         
     | 
| 
       114 
     | 
    
         
            -
                  end
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                  get_it '/from_file'
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                  body.should.equal 'You rock Alena!'
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                specify "use layout.ext by default if available" do
         
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
                  get '/layout_from_file' do
         
     | 
| 
       125 
     | 
    
         
            -
                    erb :foo, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
         
     | 
| 
       126 
     | 
    
         
            -
                  end
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
                  get_it '/layout_from_file'
         
     | 
| 
       129 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       130 
     | 
    
         
            -
                  body.should.equal "x This is foo! x \n"
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                end
         
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
              end
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
            end
         
     | 
    
        data/compat/events_test.rb
    DELETED
    
    | 
         @@ -1,75 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            context "Simple Events" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              def simple_request_hash(method, path)
         
     | 
| 
       6 
     | 
    
         
            -
                Rack::Request.new({
         
     | 
| 
       7 
     | 
    
         
            -
                  'REQUEST_METHOD' => method.to_s.upcase,
         
     | 
| 
       8 
     | 
    
         
            -
                  'PATH_INFO' => path
         
     | 
| 
       9 
     | 
    
         
            -
                })
         
     | 
| 
       10 
     | 
    
         
            -
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              class MockResult < Struct.new(:block, :params)
         
     | 
| 
       13 
     | 
    
         
            -
              end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              def invoke_simple(path, request_path, &b)
         
     | 
| 
       16 
     | 
    
         
            -
                params = nil
         
     | 
| 
       17 
     | 
    
         
            -
                mock_app {
         
     | 
| 
       18 
     | 
    
         
            -
                  get path do
         
     | 
| 
       19 
     | 
    
         
            -
                    params = self.params
         
     | 
| 
       20 
     | 
    
         
            -
                    b.call if b
         
     | 
| 
       21 
     | 
    
         
            -
                  end
         
     | 
| 
       22 
     | 
    
         
            -
                }
         
     | 
| 
       23 
     | 
    
         
            -
                get_it request_path
         
     | 
| 
       24 
     | 
    
         
            -
                MockResult.new(b, params)
         
     | 
| 
       25 
     | 
    
         
            -
              end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              specify "return last value" do
         
     | 
| 
       28 
     | 
    
         
            -
                block = Proc.new { 'Simple' }
         
     | 
| 
       29 
     | 
    
         
            -
                result = invoke_simple('/', '/', &block)
         
     | 
| 
       30 
     | 
    
         
            -
                result.should.not.be.nil
         
     | 
| 
       31 
     | 
    
         
            -
                result.block.should.be block
         
     | 
| 
       32 
     | 
    
         
            -
                result.params.should.equal Hash.new
         
     | 
| 
       33 
     | 
    
         
            -
              end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
              specify "takes params in path" do
         
     | 
| 
       36 
     | 
    
         
            -
                result = invoke_simple('/:foo/:bar', '/a/b')
         
     | 
| 
       37 
     | 
    
         
            -
                result.should.not.be.nil
         
     | 
| 
       38 
     | 
    
         
            -
                result.params.should.equal "foo" => 'a', "bar" => 'b'
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                # unscapes
         
     | 
| 
       41 
     | 
    
         
            -
                result = invoke_simple('/:foo/:bar', '/a/blake%20mizerany')
         
     | 
| 
       42 
     | 
    
         
            -
                result.should.not.be.nil
         
     | 
| 
       43 
     | 
    
         
            -
                result.params.should.equal "foo" => 'a', "bar" => 'blake mizerany'
         
     | 
| 
       44 
     | 
    
         
            -
              end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
              specify "takes optional params in path" do
         
     | 
| 
       47 
     | 
    
         
            -
                result = invoke_simple('/?:foo?/?:bar?', '/a/b')
         
     | 
| 
       48 
     | 
    
         
            -
                result.should.not.be.nil
         
     | 
| 
       49 
     | 
    
         
            -
                result.params.should.equal "foo" => 'a', "bar" => 'b'
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                result = invoke_simple('/?:foo?/?:bar?', '/a/')
         
     | 
| 
       52 
     | 
    
         
            -
                result.should.not.be.nil
         
     | 
| 
       53 
     | 
    
         
            -
                result.params.should.equal "foo" => 'a', "bar" => nil
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                result = invoke_simple('/?:foo?/?:bar?', '/a')
         
     | 
| 
       56 
     | 
    
         
            -
                result.should.not.be.nil
         
     | 
| 
       57 
     | 
    
         
            -
                result.params.should.equal "foo" => 'a', "bar" => nil
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                result = invoke_simple('/:foo?/?:bar?', '/')
         
     | 
| 
       60 
     | 
    
         
            -
                result.should.not.be.nil
         
     | 
| 
       61 
     | 
    
         
            -
                result.params.should.equal "foo" => nil, "bar" => nil
         
     | 
| 
       62 
     | 
    
         
            -
              end
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
              specify "ignores to many /'s" do
         
     | 
| 
       65 
     | 
    
         
            -
                result = invoke_simple('/x/y', '/x//y')
         
     | 
| 
       66 
     | 
    
         
            -
                result.should.not.be.nil
         
     | 
| 
       67 
     | 
    
         
            -
              end
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
              specify "understands splat" do
         
     | 
| 
       70 
     | 
    
         
            -
                invoke_simple('/foo/*', '/foo/bar').should.not.be.nil
         
     | 
| 
       71 
     | 
    
         
            -
                invoke_simple('/foo/*', '/foo/bar/baz').should.not.be.nil
         
     | 
| 
       72 
     | 
    
         
            -
                invoke_simple('/foo/*', '/foo/baz').should.not.be.nil
         
     | 
| 
       73 
     | 
    
         
            -
              end
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
            end
         
     | 
    
        data/compat/filter_test.rb
    DELETED
    
    | 
         @@ -1,30 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            context "before filters" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              setup do
         
     | 
| 
       6 
     | 
    
         
            -
                Sinatra.application = nil
         
     | 
| 
       7 
     | 
    
         
            -
                @app = Sinatra.application
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              specify "should be executed in the order defined" do
         
     | 
| 
       11 
     | 
    
         
            -
                invoked = 0x0
         
     | 
| 
       12 
     | 
    
         
            -
                @app.before { invoked = 0x01 }
         
     | 
| 
       13 
     | 
    
         
            -
                @app.before { invoked |= 0x02 }
         
     | 
| 
       14 
     | 
    
         
            -
                @app.get('/') { 'Hello World' }
         
     | 
| 
       15 
     | 
    
         
            -
                get_it '/'
         
     | 
| 
       16 
     | 
    
         
            -
                should.be.ok
         
     | 
| 
       17 
     | 
    
         
            -
                body.should.be == 'Hello World'
         
     | 
| 
       18 
     | 
    
         
            -
                invoked.should.be == 0x03
         
     | 
| 
       19 
     | 
    
         
            -
              end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              specify "should be capable of modifying the request" do
         
     | 
| 
       22 
     | 
    
         
            -
                @app.get('/foo') { 'foo' }
         
     | 
| 
       23 
     | 
    
         
            -
                @app.get('/bar') { 'bar' }
         
     | 
| 
       24 
     | 
    
         
            -
                @app.before { request.path_info = '/bar' }
         
     | 
| 
       25 
     | 
    
         
            -
                get_it '/foo'
         
     | 
| 
       26 
     | 
    
         
            -
                should.be.ok
         
     | 
| 
       27 
     | 
    
         
            -
                body.should.be == 'bar'
         
     | 
| 
       28 
     | 
    
         
            -
              end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
            end
         
     | 
    
        data/compat/haml_test.rb
    DELETED
    
    | 
         @@ -1,233 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            context "Haml" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              setup do
         
     | 
| 
       6 
     | 
    
         
            -
                Sinatra.application = nil
         
     | 
| 
       7 
     | 
    
         
            -
              end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              context "without layouts" do
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                setup do
         
     | 
| 
       12 
     | 
    
         
            -
                  Sinatra.application = nil
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                specify "should render" do
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                  get '/no_layout' do
         
     | 
| 
       18 
     | 
    
         
            -
                    haml '== #{1+1}'
         
     | 
| 
       19 
     | 
    
         
            -
                  end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                  get_it '/no_layout'
         
     | 
| 
       22 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       23 
     | 
    
         
            -
                  body.should == "2\n"
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
              end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              context "with layouts" do
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                setup do
         
     | 
| 
       31 
     | 
    
         
            -
                  Sinatra.application = nil
         
     | 
| 
       32 
     | 
    
         
            -
                end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                specify "can be inline" do
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                  layout do
         
     | 
| 
       37 
     | 
    
         
            -
                    '== This is #{yield}!'
         
     | 
| 
       38 
     | 
    
         
            -
                  end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                  get '/lay' do
         
     | 
| 
       41 
     | 
    
         
            -
                    haml 'Blake'
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                  get_it '/lay'
         
     | 
| 
       45 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       46 
     | 
    
         
            -
                  body.should.equal "This is Blake\n!\n"
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                specify "can use named layouts" do
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                  layout :pretty do
         
     | 
| 
       53 
     | 
    
         
            -
                    '%h1== #{yield}'
         
     | 
| 
       54 
     | 
    
         
            -
                  end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                  get '/pretty' do
         
     | 
| 
       57 
     | 
    
         
            -
                    haml 'Foo', :layout => :pretty
         
     | 
| 
       58 
     | 
    
         
            -
                  end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  get '/not_pretty' do
         
     | 
| 
       61 
     | 
    
         
            -
                    haml 'Bar'
         
     | 
| 
       62 
     | 
    
         
            -
                  end
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                  get_it '/pretty'
         
     | 
| 
       65 
     | 
    
         
            -
                  body.should.equal "<h1>Foo</h1>\n"
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                  get_it '/not_pretty'
         
     | 
| 
       68 
     | 
    
         
            -
                  body.should.equal "Bar\n"
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                specify "can be read from a file if they're not inlined" do
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                  get '/foo' do
         
     | 
| 
       75 
     | 
    
         
            -
                    @title = 'Welcome to the Hello Program'
         
     | 
| 
       76 
     | 
    
         
            -
                    haml 'Blake', :layout => :foo_layout,
         
     | 
| 
       77 
     | 
    
         
            -
                                  :views_directory => File.dirname(__FILE__) + "/views"
         
     | 
| 
       78 
     | 
    
         
            -
                  end
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                  get_it '/foo'
         
     | 
| 
       81 
     | 
    
         
            -
                  body.should.equal "Welcome to the Hello Program\nHi Blake\n"
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                end
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                specify "can be read from file and layout from text" do
         
     | 
| 
       86 
     | 
    
         
            -
                  get '/foo' do
         
     | 
| 
       87 
     | 
    
         
            -
                    haml 'Test', :layout => '== Foo #{yield}'
         
     | 
| 
       88 
     | 
    
         
            -
                  end
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                  get_it '/foo'
         
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                  body.should.equal "Foo Test\n"
         
     | 
| 
       93 
     | 
    
         
            -
                end
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
              end
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
              context "Templates (in general)" do
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                setup do
         
     | 
| 
       100 
     | 
    
         
            -
                  Sinatra.application = nil
         
     | 
| 
       101 
     | 
    
         
            -
                end
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
                specify "are read from files if Symbols" do
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                  get '/from_file' do
         
     | 
| 
       106 
     | 
    
         
            -
                    @name = 'Alena'
         
     | 
| 
       107 
     | 
    
         
            -
                    haml :foo, :views_directory => File.dirname(__FILE__) + "/views"
         
     | 
| 
       108 
     | 
    
         
            -
                  end
         
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
                  get_it '/from_file'
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
                  body.should.equal "You rock Alena!\n"
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
                end
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                specify "use layout.ext by default if available" do
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       119 
     | 
    
         
            -
                    haml :foo, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
         
     | 
| 
       120 
     | 
    
         
            -
                  end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       123 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       124 
     | 
    
         
            -
                  body.should.equal "x This is foo!\n x\n"
         
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
                end
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
                specify "renders without layout" do
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       131 
     | 
    
         
            -
                    haml :no_layout, :views_directory => File.dirname(__FILE__) + "/views/no_layout"
         
     | 
| 
       132 
     | 
    
         
            -
                  end
         
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       135 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       136 
     | 
    
         
            -
                  body.should.equal "<h1>No Layout!</h1>\n"
         
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
       138 
     | 
    
         
            -
                end
         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
                specify "can render with no layout" do
         
     | 
| 
       141 
     | 
    
         
            -
                  layout do
         
     | 
| 
       142 
     | 
    
         
            -
                    "X\n= yield\nX"
         
     | 
| 
       143 
     | 
    
         
            -
                  end
         
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       146 
     | 
    
         
            -
                    haml 'blake', :layout => false
         
     | 
| 
       147 
     | 
    
         
            -
                  end
         
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
                  body.should.equal "blake\n"
         
     | 
| 
       152 
     | 
    
         
            -
                end
         
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
                specify "raises error if template not found" do
         
     | 
| 
       155 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       156 
     | 
    
         
            -
                    haml :not_found
         
     | 
| 
       157 
     | 
    
         
            -
                  end
         
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
                  lambda { get_it '/' }.should.raise(Errno::ENOENT)
         
     | 
| 
       160 
     | 
    
         
            -
                end
         
     | 
| 
       161 
     | 
    
         
            -
             
     | 
| 
       162 
     | 
    
         
            -
                specify "use layout.ext by default if available" do
         
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
                  template :foo do
         
     | 
| 
       165 
     | 
    
         
            -
                    'asdf'
         
     | 
| 
       166 
     | 
    
         
            -
                  end
         
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       169 
     | 
    
         
            -
                    haml :foo, :layout => false,
         
     | 
| 
       170 
     | 
    
         
            -
                               :views_directory => File.dirname(__FILE__) + "/views/layout_test"
         
     | 
| 
       171 
     | 
    
         
            -
                  end
         
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       174 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       175 
     | 
    
         
            -
                  body.should.equal "asdf\n"
         
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
                end
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
              end
         
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
              describe 'Options passed to the HAML interpreter' do
         
     | 
| 
       182 
     | 
    
         
            -
                setup do
         
     | 
| 
       183 
     | 
    
         
            -
                  Sinatra.application = nil
         
     | 
| 
       184 
     | 
    
         
            -
                end
         
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
                specify 'are empty be default' do
         
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       189 
     | 
    
         
            -
                    haml 'foo'
         
     | 
| 
       190 
     | 
    
         
            -
                  end
         
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
                  Haml::Engine.expects(:new).with('foo', {}).returns(stub(:render => 'foo'))
         
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       195 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
       197 
     | 
    
         
            -
                end
         
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
                specify 'can be configured by passing :options to haml' do
         
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       202 
     | 
    
         
            -
                    haml 'foo', :options => {:format => :html4}
         
     | 
| 
       203 
     | 
    
         
            -
                  end
         
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
                  Haml::Engine.expects(:new).with('foo', {:format => :html4}).returns(stub(:render => 'foo'))
         
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       208 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
                end
         
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
                specify 'can be configured using set_option :haml' do
         
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
                  configure do
         
     | 
| 
       215 
     | 
    
         
            -
                    set_option :haml, :format       => :html4,
         
     | 
| 
       216 
     | 
    
         
            -
                                      :escape_html  => true
         
     | 
| 
       217 
     | 
    
         
            -
                  end
         
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
                  get '/' do
         
     | 
| 
       220 
     | 
    
         
            -
                    haml 'foo'
         
     | 
| 
       221 
     | 
    
         
            -
                  end
         
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
                  Haml::Engine.expects(:new).with('foo', {:format => :html4,
         
     | 
| 
       224 
     | 
    
         
            -
                    :escape_html => true}).returns(stub(:render => 'foo'))
         
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
                  get_it '/'
         
     | 
| 
       227 
     | 
    
         
            -
                  should.be.ok
         
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
       229 
     | 
    
         
            -
                end
         
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
       231 
     | 
    
         
            -
              end
         
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
     | 
    
         
            -
            end
         
     |