Sha256: b6db535219745ef01ed207f8f28dfa2f8b481bcf14cbe64881a3e3aa44c82831

Contents?: true

Size: 575 Bytes

Versions: 7

Compression:

Stored size: 575 Bytes

Contents

RSpec.shared_context 'users' do
  include_context 'database setup'

  before do
    inferrable_relations.concat %i(users)
  end

  let(:users) { container.relations[:users] }

  let(:jane_id) { 1 }
  let(:joe_id) { 2 }

  before do |example|
    ctx = self

    conn.create_table :users do
      primary_key :id
      String :name, null: false
      check { char_length(name) > 2 } if ctx.postgres?(example)
    end
  end

  before do |example|
    next if example.metadata[:seeds] == false

    conn[:users].insert name: 'Jane'
    conn[:users].insert name: 'Joe'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rom-sql-1.2.1 spec/shared/users.rb
rom-sql-1.2.0 spec/shared/users.rb
rom-sql-1.1.2 spec/shared/users.rb
rom-sql-1.1.1 spec/shared/users.rb
rom-sql-1.1.0 spec/shared/users.rb
rom-sql-1.0.3 spec/shared/users.rb
rom-sql-1.0.2 spec/shared/users.rb