Sha256: f178995ca0a6a45ba12c6a1dffd4d9cf65c65dcb914f8d62243be0cd9669354e

Contents?: true

Size: 666 Bytes

Versions: 3

Compression:

Stored size: 666 Bytes

Contents

require 'assert/factory'
require 'sanford/error_handler'

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.sanford_std_error(message = nil)
    self.exception(Sanford::ErrorHandler::STANDARD_ERROR_CLASSES.sample, message)
  end

  def self.protocol_response
    Sanford::Protocol::Response.new(
      [Factory.integer(999), Factory.text],
      { Factory.string => Factory.string }
    )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sanford-0.19.1 test/support/factory.rb
sanford-0.19.0 test/support/factory.rb
sanford-0.18.2 test/support/factory.rb