Sha256: a457d917701094296b5cd7c2ed3e1d8bc8d0c020d64cc202c28dc7759a25bb66

Contents?: true

Size: 883 Bytes

Versions: 3

Compression:

Stored size: 883 Bytes

Contents

$: << '.'
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), "/../lib"))
require 'hashmodel'
require 'rspec'
require 'rspec/matchers'

# Make a new class with the given name and create instance variables set using key,value pairs.
# e.g. new_class = create_class "Dummy", {:x=>"x", :y=>String, :z=>["1",2,:three]}
def create_proc_tester(property_value_hash)
  proc_test = Class.new.new

  # Add an evaluator method to make it more clear what we are doing
  proc_test.class.class_eval do
     define_method(:xql?) { |&block| instance_eval &block }
  end

  # Add the property values to this instance of the class
  property_value_hash.each do |key, value| 
    proc_test.instance_variable_set("@#{key}", value)
  end

  proc_test
end


# Debug print
module Kernel
  def dp(value)
    puts ""
    puts "*" * 40
    puts value
    puts "&" * 40
    puts ""
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hashmodel-0.3.1 spec/spec_helper.rb
hashmodel-0.3.0 spec/spec_helper.rb
hashmodel-0.3.0.beta2 spec/spec_helper.rb