Sha256: ca60ac7f632e9cd37680750334777c5520bb27d915c85acbe63b93b521ab012b
Contents?: true
Size: 819 Bytes
Versions: 3
Compression:
Stored size: 819 Bytes
Contents
require 'spec_helper' describe 'Inferring schema from database' do let(:setup) { ROM.setup(postgres: "postgres://localhost/rom") } context "when database schema exists" do after { rom.postgres.connection.drop_table?(:people) } let(:rom) { setup.finalize } it "infers the schema from the database relations" do setup.postgres.connection.create_table :people do primary_key :id String :name end schema = rom.schema expect(schema.people.to_a).to eql(rom.postgres.people.to_a) expect(schema.people.header).to eql([:id, :name]) end end context "for empty database schemas" do it "returns an empty schema" do rom = setup.finalize schema = rom.schema expect { schema.postgres }.to raise_error(NoMethodError) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rom-sql-0.3.2 | spec/unit/schema_spec.rb |
rom-sql-0.3.1 | spec/unit/schema_spec.rb |
rom-sql-0.3.0 | spec/unit/schema_spec.rb |