Sha256: ddf5c4b851a27a9d37e46a910747a0c2091da157e02d7680fedc0a5bec7fe359

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

require 'rspec'
require 'spigot'
require 'hashie'
require 'active_record'
require "test/unit"
require "mocha/setup"

%w(fixtures support).each do |dir|
  Dir[File.join(Spigot.root, "spec/#{dir}/**/*.rb")].each {|f| require f}
end

# Mocked Classes
User = Class.new(Hashie::Mash)

class ActiveUser < ActiveRecord::Base
  include Spigot::Base
end

module Wrapper
  Post = Class.new(Hashie::Mash)
end

def with_mapping(name, map)
  before do
    instance_variable_set("@prior_#{name}".to_sym, Spigot.config.translations)
    Spigot.configure{|c| c.translations = map }
  end

  after do
    map_cache = instance_variable_get("@prior_#{name}".to_sym)
    Spigot.configure{|c| c.translations = map_cache }
  end
end

RSpec.configure do |config|
  config.after(:each) do
    ActiveUser.delete_all
    Spigot.config.reset
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spigot-0.1.0 spec/spec_helper.rb
spigot-0.0.1 spec/spec_helper.rb