Sha256: 3313b739b99f6b521f196e88bf88e82a4ad32cc6fece5317c8b625eba02f6448
Contents?: true
Size: 896 Bytes
Versions: 3
Compression:
Stored size: 896 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 class ParentTag < Tag end class ChildTag < Tag belongs_to :parent_tag, foreign_key: :parent_id 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-3.0.1 | test/test_helper.rb |
postgres_ext-3.0.0 | test/test_helper.rb |
postgres_ext-2.4.1 | test/test_helper.rb |