Sha256: 7ed34f70a25d6f9b4913e4d40c87b0fa3c88ae0f7fabd4a43ea15486cf1d3743

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'
require 'xml/xslt'

class RackXslviewTest < Test::Unit::TestCase

  def call_args(overrides={})
    {'REQUEST_URI' => '/rlksdjfkj', 'PATH_INFO' => '/notsure', 'RACK_MOUNT_PATH' => '/something'}.merge(overrides)

  end

  def self.should_not_halt
    should "not halt the rack chain" do
      @app.expects(:call).once
      @rack.call(call_args)
    end
  end

  context 'Given an app' do
    setup do
      @app = Class.new { def call(app); true; end }.new
    end
  
    context 'Still learning how to write these tests...' do
      setup {
        omitpaths = [/^\/raw/, '/s/js/', '/s/css/']
        passenv = ['PATH_INFO', 'RACK_MOUNT_PATH']
        @rack = Rack::XSLView.new(@app, :noxsl => omitpaths, :passenv => passenv)
      }
      should_not_halt
    end
    context 'Trying out the xslhash' do
      setup {
        omitpaths = [/^\/raw/, '/s/js/', '/s/css/']
        xslhash = { "/path/alskjddf" => "test.xsl",  /specific\.xml$/ => 'different.xsl' }
        xslhash.default("/path/to/output.xhtml10.xsl")
        @rack = Rack::XSLView.new(@app, :noxsl => omitpaths, :xslhash => xslhash)
      }
      should_not_halt
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rack-xslview-0.1.3 test/rack-xslview_test.rb
rack-xslview-0.1.2 test/rack-xslview_test.rb
rack-xslview-0.1.1 test/rack-xslview_test.rb
rack-xslview-0.1.0 test/rack-xslview_test.rb