Sha256: 646622e7e0b80ef100c32225df852e247520f4883bfd6f036a09a96a5cb3677d

Contents?: true

Size: 607 Bytes

Versions: 7

Compression:

Stored size: 607 Bytes

Contents

require 'date'
require 'bigdecimal'

module SpecHelpers

  T_DATE       = Date.new(2012, 4, 10)
  T_DATETIME   = DateTime.new(2012, 4, 11, 23, 33, 42)
  T_TIME       = Time.new(2012, 4, 11, 23, 33, 42, "+02:00")
  T_BIGDECIMAL = BigDecimal('1.33')

  # This method is cool beyond any argument about the imperfect name.
  #
  def assert_size(collection, expected_size)
    expect(collection.size).to eql(expected_size)

    yield(*collection) if block_given?
  end

  def stub_initializer(klazz, *args)
    instance = klazz.new(*args)

    allow(klazz).to receive(:new) { instance }

    instance
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spreadbase-0.6.0 spec/spec_helpers.rb
spreadbase-0.5.0 spec/spec_helpers.rb
spreadbase-0.4.0 spec/spec_helpers.rb
spreadbase-0.3.0 spec/spec_helpers.rb
spreadbase-0.2.1 spec/spec_helpers.rb
spreadbase-0.2.0 spec/spec_helpers.rb
spreadbase-0.1.4 spec/spec_helpers.rb