Sha256: 24ef20daaed69a682dc3aa2d8d2988f6724b26a2c96bcee7f316c8fd97e9c46b

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

shared_context 'database setup' do
  subject(:rom) { setup.finalize }

  let(:setup) { ROM.setup(postgres: 'postgres://localhost/rom') }
  let(:conn) { setup.postgres.connection }

  before do
    setup.postgres.use_logger(LOGGER)

    [:users, :tasks, :tags, :task_tags].each { |name| conn.drop_table?(name) }

    conn.create_table :users do
      primary_key :id
      String :name
      index :name, unique: true
    end

    conn.create_table :tasks do
      primary_key :id
      Integer :user_id
      String :title
    end

    conn.create_table :tags do
      primary_key :id
      String :name
    end

    conn.create_table :task_tags do
      primary_key :tag_id, :task_id
      Integer :tag_id
      Integer :task_id
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-sql-0.3.0 spec/shared/database_setup.rb
rom-sql-0.2.0 spec/shared/database_setup.rb