Sha256: 44a00804d8c625c60364557a2af46e6a3b3ae35eaebf7e99d13118b8c623deff

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require 'hotcell'
require 'awesome_print'

AwesomePrint::Formatter.class_eval do
  def cast_with_hotcell_node(object, type)
    cast = cast_without_hotcell_node(object, type)
    cast = :hotcell_node if object.is_a?(Hotcell::Node)
    cast
  end

  def awesome_hotcell_node(object)
    "#{colorize(object.class.to_s, :class)} #{colorize(object.name.to_s, :method)}" +
      ((awesome_hash(object.options) + "\n") if object.options.present?).to_s +
      awesome_array(object.children)
  end

  alias_method_chain :cast, :hotcell_node
end

RSpec::Matchers.define :be_equal_node_to do |expected|
  match do |actual|
    actual == expected
  end

  failure_message_for_should do |actual|
    "expected:\n#{expected.ai(raw: true, indent: 2)}\ngot:\n#{actual.ai(raw: true, indent: 2)}"
  end
end

RSpec.configure do |config|
  def data_path name
    File.join(File.dirname(__FILE__), 'data', name)
  end

  def data name
    File.read data_path(name)
  end

  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true
  config.filter_run :focus

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = 'random'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hotcell-0.3.0 spec/spec_helper.rb
hotcell-0.2.0 spec/spec_helper.rb
hotcell-0.1.0 spec/spec_helper.rb