Sha256: 98ae3638b4b0485a642a076582df254271e17d36e94c553dcbd6a0a5e2780e10

Contents?: true

Size: 730 Bytes

Versions: 4

Compression:

Stored size: 730 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])

require "her"
require "fakeweb"
require "mocha"

module Helpers
end

RSpec.configure do |c|
  c.include Helpers
end

class Hash
  def to_json; MultiJson.dump(self); end
end

class Array
  def to_json; MultiJson.dump(self); end
end

def spawn_model(klass, &block)
  Object.instance_eval { remove_const klass } if Object.const_defined?(klass)
  Object.const_set(klass, Class.new).send(:include, Her::Model)
  Object.const_get(klass).class_eval(&block) if block_given?
end

def spawn_submodel(mod, klass)
  Object.instance_eval { remove_const mod } if Object.const_defined?(mod)
  Object.const_set(mod, Module.new).const_set(klass, Class.new).send(:include, Her::Model)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
her-0.2.5 spec/spec_helper.rb
her-0.2.4 spec/spec_helper.rb
her-0.2.3 spec/spec_helper.rb
her-0.2.2 spec/spec_helper.rb