Sha256: 53572b4cd2b3be7cc23ef1cac1d6883b988f926564d436bb0e7899429572e532

Contents?: true

Size: 1.38 KB

Versions: 22

Compression:

Stored size: 1.38 KB

Contents

require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))

begin
  require 'tilt/erb'
rescue LoadError
  warn "tilt not installed, skipping multi_view plugin test"  
else
describe "multi_view plugin" do 
  before do
    app(:bare) do
      plugin :render, :views=>'spec/views', :layout=>'layout-yield'
      plugin :multi_view

      route do |r|
        r.multi_view(['a', 'b', 'c'])
      end
    end
  end

  it "supports easy rendering of multiple views by name" do
    body('/a').gsub(/\s+/, '').must_equal "HeaderaFooter"
    body('/b').gsub(/\s+/, '').must_equal "HeaderbFooter"
    body('/c').gsub(/\s+/, '').must_equal "HeadercFooter"
    status('/d').must_equal 404
    status('/a', 'REQUEST_METHOD'=>'POST').must_equal 404
  end
end

describe "multi_view plugin multi_view_compile method " do 
  before do
    app(:bare) do
      plugin :render, :views=>'spec/views', :layout=>'layout-yield'
      plugin :multi_view
      regexp = multi_view_compile(['a', 'b', 'c'])

      route do |r|
        r.multi_view(regexp)
      end
    end
  end

  it "supports easy rendering of multiple views by name" do
    body('/a').gsub(/\s+/, '').must_equal "HeaderaFooter"
    body('/b').gsub(/\s+/, '').must_equal "HeaderbFooter"
    body('/c').gsub(/\s+/, '').must_equal "HeadercFooter"
    status('/d').must_equal 404
    status('/a', 'REQUEST_METHOD'=>'POST').must_equal 404
  end
end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
roda-2.29.0 spec/plugin/multi_view_spec.rb
roda-2.28.0 spec/plugin/multi_view_spec.rb
roda-2.27.0 spec/plugin/multi_view_spec.rb
roda-2.26.0 spec/plugin/multi_view_spec.rb
roda-2.25.0 spec/plugin/multi_view_spec.rb
roda-2.24.0 spec/plugin/multi_view_spec.rb
roda-2.23.0 spec/plugin/multi_view_spec.rb
roda-2.22.0 spec/plugin/multi_view_spec.rb
roda-2.21.0 spec/plugin/multi_view_spec.rb
roda-2.20.0 spec/plugin/multi_view_spec.rb
roda-2.19.0 spec/plugin/multi_view_spec.rb
roda-2.18.0 spec/plugin/multi_view_spec.rb
roda-2.17.0 spec/plugin/multi_view_spec.rb
roda-2.16.0 spec/plugin/multi_view_spec.rb
roda-2.15.0 spec/plugin/multi_view_spec.rb
roda-2.14.0 spec/plugin/multi_view_spec.rb
roda-2.13.0 spec/plugin/multi_view_spec.rb
roda-2.12.0 spec/plugin/multi_view_spec.rb
roda-2.11.0 spec/plugin/multi_view_spec.rb
roda-2.10.0 spec/plugin/multi_view_spec.rb