Sha256: 7e3c55435f68c4f843580d9d10b53f061a10d67b7377a4b6e16c8f0539b2c97c

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe Table do

  before { @table = Table.new(schema_file) }

  it 'find the right count of tables in the schema' do
    expect(@table.names.size).to eq 4
  end

  it 'find the right count of tables in a fake schema' do
    schema = "create_table \"foos\"\nt.integer \"foo\"\nend"
    expect(Table.new(schema).names.size).to eq 1
  end

  it "find the right table's names in the schema" do
    names = ['assignments', 'products', 'users', 'users_3']
    @table.names.each do |name|
      expect(names.include?(name)).to be true
    end
  end

  it "find the right table's names in a fake schema" do
    schema = "create_table \"foos\"\nt.integer \"foo\"\nend"
    expect(Table.new(schema).names.first).to eq 'foos'
  end

  it 'find the content of a table in a fake schema' do
    schema = "create_table \"foos\"\nt.integer \"foo\"\nend"
    content = Table.new(schema).content_for('foos')
    expect(content).to eq "t.integer \"foo\"\n"
  end

  it 'find the content of a table in the schema' do
    content = @table.content_for('assignments')
    expected = "    t.integer \"foo\"\n    t.string  \"bar\"\n"
    expect(content).to eq expected
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
columns-0.1.1 spec/table_spec.rb
columns-0.1.0 spec/table_spec.rb
columns-0.0.1 spec/table_spec.rb