Sha256: 8661506873496fe9aa670ed7a86483dc3d66ca1d1734f24140a719bd797f1f8a

Contents?: true

Size: 793 Bytes

Versions: 3

Compression:

Stored size: 793 Bytes

Contents

require 'active_record'
require 'minitest/autorun'
require 'bourne'
require 'database_cleaner'
unless ENV['CI'] || RUBY_PLATFORM =~ /java/
  require 'byebug'
end

require 'dotenv'
Dotenv.load

require 'postgres_ext'

ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])

class Person < ActiveRecord::Base
  has_many :hm_tags, class_name: 'Tag'
  has_and_belongs_to_many :habtm_tags, class_name: 'Tag'

  def self.wicked_people
    includes(:habtm_tags)
      .where(:tags => {:categories => ['wicked','awesome']})
  end
end

class Tag < ActiveRecord::Base
  belongs_to :person
end

DatabaseCleaner.strategy = :deletion

class MiniTest::Spec
  class << self
    alias :context :describe
  end

  before do
    DatabaseCleaner.start
  end

  after do
    DatabaseCleaner.clean
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
postgres_ext-2.4.0 test/test_helper.rb
postgres_ext-2.4.0.beta.1 test/test_helper.rb
postgres_ext-2.3.0 test/test_helper.rb