Sha256: 6d00a1cf36ed7f60a090670d8714630bebe36a3c077e6501d059b1b309a04ef5

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

$LOAD_PATH << File.expand_path("..", __FILE__)
$LOAD_PATH << File.expand_path("../../lib", __FILE__)

require 'rubygems'
require 'webmachine'
require 'rspec'
require 'logger'

RSpec.configure do |config|
  config.mock_with :rspec
  config.filter_run :focus => true
  config.run_all_when_everything_filtered = true
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.formatter = :documentation if ENV['CI']
  if defined?(::Java)
    config.seed = Time.now.utc
  else
    config.order = :random
  end

  config.before(:suite) do
    options = {
      :Logger => Logger.new("/dev/null"),
      :AccessLog => []
    }
    Webmachine::Adapters::WEBrick::DEFAULT_OPTIONS.merge! options
    Webmachine::Adapters::Rack::DEFAULT_OPTIONS.merge! options
  end
end

# For use in specs that need a fully initialized resource
shared_context "default resource" do
  let(:method) { 'GET' }
  let(:uri) { URI.parse("http://localhost/") }
  let(:headers) { Webmachine::Headers.new }
  let(:body) { "" }
  let(:request) { Webmachine::Request.new(method, uri, headers, body) }
  let(:response) { Webmachine::Response.new }

  let(:resource_class) do
    Class.new(Webmachine::Resource) do
      def to_html
        "<html><body>Hello, world!</body></html>"
      end
    end
  end
  let(:resource) { resource_class.new(request, response) }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webmachine-1.2.2 spec/spec_helper.rb
webmachine-1.2.0 spec/spec_helper.rb