Sha256: f5d60f28b16311aa7963d5029c1f7a47c5f812c1771af4f3cb0642461a0f8019

Contents?: true

Size: 836 Bytes

Versions: 3

Compression:

Stored size: 836 Bytes

Contents

require "increment_with_sql"

begin
  require "minitest"

  class IncrementWithSql::TestCase < MiniTest::Test; end 
rescue LoadError
  require "minitest/unit"

  class IncrementWithSql::TestCase < MiniTest::Unit::TestCase; end 
end

require "minitest/autorun"
require "active_record"
require "yaml"

DATABASE = ENV["DATABASE"] || "sqlite"

ActiveRecord::Base.establish_connection YAML.load_file(File.expand_path("../database.yml", __FILE__))[DATABASE]

ActiveRecord::Base.connection.execute "DROP TABLE IF EXISTS items"

ActiveRecord::Base.connection.create_table :items do |t|
  t.integer :automatic_version
  t.integer :manual_version
  t.string :content
end

class Item < ActiveRecord::Base
  after_save { increment_with_sql! :automatic_version }
end

class IncrementWithSql::TestCase
  def teardown
    Item.delete_all
  end 
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
increment_with_sql-0.0.3 test/test_helper.rb
increment_with_sql-0.0.2 test/test_helper.rb
increment_with_sql-0.0.1 test/test_helper.rb