Sha256: 6b12b32450a33264656cd653d51f0ad8c4bbe1fedb953a5ccdfd92194c5fd6a6

Contents?: true

Size: 793 Bytes

Versions: 2

Compression:

Stored size: 793 Bytes

Contents

if ENV['CODECLIMATE_REPO_TOKEN']
  require "codeclimate-test-reporter"
  CodeClimate::TestReporter.start
end

require 'sqlite3'
require 'popular'

ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"

ActiveRecord::Schema.define version: 1 do

  create_table :friendships do |t|
    t.references :popular_model, polymorphic: true,  null: false
    t.references :friend, polymorphic: true, null: false
  end

  create_table :popular_models

end

UnpopularModel = Class.new ActiveRecord::Base

class PopularModel < ActiveRecord::Base
  popular
end

RSpec.configure do |config|
  config.order = 'random'
end

def clean_database
  [PopularModel, Popular::Friendship].each do |model|
    ActiveRecord::Base.connection.execute "DELETE FROM #{model.table_name}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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