Sha256: 2a01fd5db7e2ff3b042e30490bf64f4d4c0c1aebac102cac34bbe6066ca3e794

Contents?: true

Size: 900 Bytes

Versions: 6

Compression:

Stored size: 900 Bytes

Contents

require 'assert/factory'
require 'deas/logger'
require 'deas/router'
require 'deas/server_data'
require 'deas/template_source'
require 'test/support/fake_request'
require 'test/support/fake_sinatra_call'

module Factory
  extend Assert::Factory

  def self.exception(klass = nil, message = nil)
    klass ||= StandardError
    message ||= Factory.text
    exception = nil
    begin; raise(klass, message); rescue klass => exception; end
    exception.set_backtrace(nil) if Factory.boolean
    exception
  end

  def self.server_data(opts = nil)
    Deas::ServerData.new({
      :logger          => Deas::NullLogger.new,
      :router          => Deas::Router.new,
      :template_source => Deas::NullTemplateSource.new
    }.merge(opts || {}))
  end

  def self.request(args = nil)
    FakeRequest.new(args)
  end

  def self.sinatra_call(settings = nil)
    FakeSinatraCall.new(settings)
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
deas-0.42.0 test/support/factory.rb
deas-0.41.0 test/support/factory.rb
deas-0.40.0 test/support/factory.rb
deas-0.39.2 test/support/factory.rb
deas-0.39.1 test/support/factory.rb
deas-0.39.0 test/support/factory.rb