Sha256: 8c82c89ebf0a802e28a3632debb4f79965ac6bf6455858a3eb1e15c60d7e9973
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require 'assert/factory' require 'deas/logger' require 'deas/request_data' require 'deas/router' require 'deas/server_data' require 'deas/template_source' require 'test/support/fake_request' require 'test/support/fake_response' 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.response(args = nil) FakeResponse.new(args) end def self.request_data(args = nil) args ||= {} Deas::RequestData.new({ :request => args[:request] || Factory.request, :response => args[:response] || Factory.response, :route_path => args[:route_path] || Factory.string, :params => args[:params] || { Factory.string => Factory.string } }) end def self.sinatra_call(settings = nil) FakeSinatraCall.new(settings) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
deas-0.43.5 | test/support/factory.rb |
deas-0.43.4 | test/support/factory.rb |