Sha256: 44100278c6bc361544162db7f8a27befa68eb220c8271703d53159cd351910f5

Contents?: true

Size: 405 Bytes

Versions: 26

Compression:

Stored size: 405 Bytes

Contents

require 'tasks/database'

module MigrationHelpers
  def create table_name, params, id_column_name = :id
    database[table_name].insert(params);
    database[table_name].order(id_column_name).last if id_column_name
  end

  def clean table_name
    database[table_name].delete rescue puts "Error cleaning #{table_name} #{$!}"
  end

  def database
    @database ||= DB.connection_for_env 'test'
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
pact_broker-2.27.6 spec/support/migration_helpers.rb
pact_broker-2.27.5 spec/support/migration_helpers.rb
pact_broker-2.27.4 spec/support/migration_helpers.rb
pact_broker-2.27.3 spec/support/migration_helpers.rb
pact_broker-2.27.2 spec/support/migration_helpers.rb
pact_broker-2.27.0 spec/support/migration_helpers.rb
pact_broker-2.26.1 spec/support/migration_helpers.rb
pact_broker-2.26.0 spec/support/migration_helpers.rb
pact_broker-2.25.0 spec/support/migration_helpers.rb
pact_broker-2.24.0 spec/support/migration_helpers.rb
pact_broker-2.23.4 spec/support/migration_helpers.rb
pact_broker-2.23.3 spec/support/migration_helpers.rb
pact_broker-2.23.2 spec/support/migration_helpers.rb
pact_broker-2.23.1 spec/support/migration_helpers.rb
pact_broker-2.23.0 spec/support/migration_helpers.rb
pact_broker-2.22.0 spec/support/migration_helpers.rb
pact_broker-2.21.0 spec/support/migration_helpers.rb
pact_broker-2.20.0 spec/support/migration_helpers.rb
pact_broker-2.19.2 spec/support/migration_helpers.rb
pact_broker-2.19.1 spec/support/migration_helpers.rb