Sha256: 7d7eef3513cdd5d4b9612373e419b90e904361587a6a030c260095d3ac056e97

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

RSpec.shared_context 'database' do
  let(:setup) { ROM.setup(:sql, 'postgres://localhost/rom') }
  let(:conn) { setup.gateways[:default].connection }
  let(:rom) { setup.finalize }

  before do
    [:tags, :tasks, :users].each { |table| conn.drop_table?(table) }

    conn.create_table :users do
      primary_key :id
      column :name, String
    end

    conn.create_table :tasks do
      primary_key :id
      foreign_key :user_id, :users, null: false, on_delete: :cascade
      column :title, String
    end

    conn.create_table :tags do
      primary_key :id
      foreign_key :task_id, :tasks, null: false, on_delete: :cascade
      column :name, String
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-repository-0.0.2 spec/shared/database.rb
rom-repository-0.0.1 spec/shared/database.rb