Sha256: 3225e3fb06462e812ef977c9ae61cf4b668afcaa0a9f5cb281d230efbf899436

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# coding: utf-8

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'simplecov'
require 'sqlite3'
require 'mongoid'
require 'active_record'
require 'database_cleaner'
require 'database_cleaner-mongoid'
require 'pry'
SimpleCov.start
require 'russian_phone'

Mongoid.configure do |config|
  ENV["MONGOID_ENV"] = "test"
  Mongoid.load!("spec/support/mongoid.yml")
end

ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
ActiveRecord::Schema.define do
  self.verbose = false
  create_table :ar_users, force: true do |t|
    t.string :name
    t.string :phone
    t.string :validated_phone
  end
end
ActiveRecord::Base.send :include, RussianPhone::ActiveRecord

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

# DatabaseCleaner.orm = "mongoid"

RSpec.configure do |config|
  config.before(:all) do
    DatabaseCleaner.strategy = :deletion
  end

  config.before(:each) do
    DatabaseCleaner[:mongoid].start
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner[:mongoid].clean
    DatabaseCleaner.clean
    ArUser.destroy_all
  end

  config.expect_with(:rspec) { |c| c.syntax = :should }
  config.mock_with :rspec
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
russian_phone-0.8.0 spec/spec_helper.rb