Sha256: 9a18ae57d6cf53cdec7acf6900677235113a8af8ac5801af545d5b4d8c3c77f2

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

Bundler.require(:test)
require 'rspec'
require 'logger'
require File.expand_path("../../lib/activerecord_pg_stuff", __FILE__)

ActiveRecord::Base.logger = Logger.new(STDOUT)

RSpec.configure do |c|
  c.before(:suite) do
    ActiveRecord::Base.establish_connection
  end

  c.before(:all) do
    conn.execute 'CREATE EXTENSION IF NOT EXISTS tablefunc'
    conn.execute "CREATE TABLE sellers (id integer, name varchar)"
    conn.execute "INSERT INTO sellers VALUES(1, 'foo'), (2, 'bar'), (3, 'baz')"

    conn.execute "CREATE TABLE payments (id integer, amount integer, seller_id integer, created_at timestamp)"
    conn.execute "INSERT INTO payments VALUES(1, 1,  1, '2012-10-12 10:00 UTC')"
    conn.execute "INSERT INTO payments VALUES(2, 3,  1, '2012-11-12 10:00 UTC')"
    conn.execute "INSERT INTO payments VALUES(3, 5,  2, '2012-09-12 10:00 UTC')"
    conn.execute "INSERT INTO payments VALUES(4, 7,  2, '2012-10-12 10:00 UTC')"
    conn.execute "INSERT INTO payments VALUES(5, 11, 2, '2012-11-12 10:00 UTC')"
    conn.execute "INSERT INTO payments VALUES(6, 13, 2, '2012-11-12 10:00 UTC')"
  end

  c.after(:all) do
    conn.execute("DROP TABLE sellers")
    conn.execute("DROP TABLE payments")
  end
end

def conn
  ActiveRecord::Base.connection
end

class Seller < ActiveRecord::Base
end

class Payment < ActiveRecord::Base
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
envoy-activerecord_pg_stuff-0.0.3 spec/spec_helper.rb
envoy_activerecord_pg_stuff-0.0.2 spec/spec_helper.rb