Sha256: e7d612f9a1e043ca6ec51acf44a9a225a4ff8449329a05328fa8d8110800f358

Contents?: true

Size: 886 Bytes

Versions: 5

Compression:

Stored size: 886 Bytes

Contents

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

require 'sqlite3'
require 'popular'

Dir["./spec/support/**/*.rb"].sort.each { |f| require f }

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
  create_table :custom_popular_models
  create_table :friendship_profiles do |t|
    t.references :friendship
  end

end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
popular-0.7.4 spec/spec_helper.rb
popular-0.7.3 spec/spec_helper.rb
popular-0.7.2 spec/spec_helper.rb
popular-0.7.1 spec/spec_helper.rb
popular-0.7.0 spec/spec_helper.rb