Sha256: da52b25d43440d064eaece7f6db0a9a124bd86563c87c3f5ca26624d4eff9729

Contents?: true

Size: 672 Bytes

Versions: 8

Compression:

Stored size: 672 Bytes

Contents

require 'test_helper'

class MiddlewareTest < Test::Unit::TestCase
  context 'the Middleware class' do
    setup do
      @app = Bunch::Middleware.new(nil,
        :root_url => '/javascripts',
        :path => '/example/js'
      )
      @mock = mock
      @mock.expects(:call).returns([200, {}, ['hello']])
    end

    should 'ignore requests without the correct url' do
      @app.app = @mock
      perform_request('/not_javascripts/hello.html')
      assert_equal @body, 'hello'
    end

    should 'pass on requests with the correct url' do
      @app.endpoint = @mock
      perform_request('/javascripts/hello.js')
      assert_equal @body, 'hello'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bunch-0.2.2 test/middleware_test.rb
bunch-0.2.1 test/middleware_test.rb
bunch-0.2.0 test/middleware_test.rb
bunch-0.1.0 test/middleware_test.rb
bunch-0.0.11 test/middleware_test.rb
bunch-0.0.10 test/middleware_test.rb
bunch-0.0.9 test/middleware_test.rb
bunch-0.0.8 test/middleware_test.rb