Sha256: acaa8f9850424b4168b3ed09b929e1c382adf5b6231f2687c9012d5bf41310c3

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe JettyRails::Handler::DelegateOnErrorsHandler do
  it "should decorate the original HttpServletResponse" do
    original = mock("original handler", :null_object => true)
    original.should_receive(:handle).once do |target, request, response, dispatch|
      response.should be_kind_of(JettyRails::Handler::DelegateOnErrorsResponse)
    end
    delegator = JettyRails::Handler::DelegateOnErrorsHandler.new
    delegator.handler = original
    delegator.handle('/any/target', mock("request"), mock("response"), 0)
  end
end

describe JettyRails::Handler::DelegateOnErrorsResponse do
  it "should delegate all method calls to wrapped response" do
    response = mock('original response')
    response.should_receive(:getContentType).once.and_return('text/html; charset=UTF-8')
    wrapper = JettyRails::Handler::DelegateOnErrorsResponse.new response, mock('request')
    wrapper.getContentType.should == 'text/html; charset=UTF-8'
  end
  
  it "should set request to not handled state on error" do
    request = mock('request')
    request.should_receive(:handled=).once.with(false)
    wrapper = JettyRails::Handler::DelegateOnErrorsResponse.new mock('response'), request
    wrapper.sendError(403)
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
mikewadhera-jetty-rails-0.9.1 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
mikewadhera-jetty-rails-0.9.2 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
mikewadhera-jetty-rails-0.9.3 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
mikewadhera-jetty-rails-0.9 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
nolman-jetty-rails-0.9.6-jruby spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
jetty-rails-0.8.1 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
jetty-rails-0.6 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
jetty-rails-0.5 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
jetty-rails-0.8 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
jetty-rails-0.7 spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb