Sha256: cd01a324fce7850898a5411e70e99e591f66ed4467a0e030b430fe3fc2cbc41a

Contents?: true

Size: 2 KB

Versions: 5

Compression:

Stored size: 2 KB

Contents

describe 'Ridgepole::Client#dump' do
  context 'when there is a tables (dump some tables)' do
    before { restore_tables }
    subject { client(tables: ['employees', 'salaries']) }

    it {
      expect(subject.dump).to eq (<<-RUBY).undent.strip
        create_table "employees", primary_key: "emp_no", force: true do |t|
          t.date   "birth_date",            null: false
          t.string "first_name", limit: 14, null: false
          t.string "last_name",  limit: 16, null: false
          t.string "gender",     limit: 1,  null: false
          t.date   "hire_date",             null: false
        end

        create_table "salaries", id: false, force: true do |t|
          t.integer "emp_no",    null: false
          t.integer "salary",    null: false
          t.date    "from_date", null: false
          t.date    "to_date",   null: false
        end

        add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
      RUBY
    }
  end

  context 'when there is a tables (use ignore table)' do
    before { restore_tables }
    subject {
      client(ignore_tables: [
        /^clubs$/,
        /^departments$/,
        /^dept_emp$/,
        /^dept_manager$/,
        /^employee_clubs$/,
        /^titles$/,
      ])
    }

    it {
      expect(subject.dump).to eq (<<-RUBY).undent.strip
        create_table "employees", primary_key: "emp_no", force: true do |t|
          t.date   "birth_date",            null: false
          t.string "first_name", limit: 14, null: false
          t.string "last_name",  limit: 16, null: false
          t.string "gender",     limit: 1,  null: false
          t.date   "hire_date",             null: false
        end

        create_table "salaries", id: false, force: true do |t|
          t.integer "emp_no",    null: false
          t.integer "salary",    null: false
          t.date    "from_date", null: false
          t.date    "to_date",   null: false
        end

        add_index "salaries", ["emp_no"], name: "emp_no", using: :btree
      RUBY
    }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ridgepole-0.2.3 spec/dump/dump_some_tables_spec.rb
ridgepole-0.2.2 spec/dump/dump_some_tables_spec.rb
ridgepole-0.2.1 spec/dump/dump_some_tables_spec.rb
ridgepole-0.2.0 spec/dump/dump_some_tables_spec.rb
ridgepole-0.1.9 spec/dump/dump_some_tables_spec.rb