Sha256: 75e2b04a2502bc879e95b978e45fd009d6fceb6b289f73d089fd1feb29a34c19

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'active_record/railtie'
require 'temping'
ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.logger.level = 3

require 'acts-as-taggable-array-on'

#Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

ActiveRecord::Migration.verbose = false

class User < ActiveRecord::Base; end

RSpec.configure do |config|
  config.before(:all) do
    ActiveRecord::Base.establish_connection(
      adapter: "postgresql",
      encoding: 'unicode',
      database: "acts-as-taggable-array-on_test",
      username: "acts-as-taggable-array-on"
    )
    create_database
  end

  config.after(:all) do
    drop_database
  end

  config.after(:each) do
    User.delete_all
  end
end

def create_database
  ActiveRecord::Schema.define(:version => 1) do
    create_table :users do |t|
      t.string :name
      t.string :colors, array: true, default: []
      t.text :sizes, array:true, default: []
      t.integer :codes, array: true, default: []
      t.timestamps null: true
    end
  end
end

def drop_database
  ActiveRecord::Base.connection.tables.each do |table|
    ActiveRecord::Base.connection.drop_table(table)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts-as-taggable-array-on-0.5 spec/spec_helper.rb