Sha256: b8ecef5bbbb38e94640352c4125e1425f04845320e346d05680bc6aaf21c88c1

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# -*- encoding : utf-8 -*-
require 'acceptance/spec_helper'

describe 'Indices' do
  let(:database) { DATABASE }
  subject { database['documenttest'] }
  let(:index) { subject.add_index(:skiplist, on: [:identifier]) }

  it 'should be possible to set indices' do
    index.delete

    expect {
      subject.add_index :skiplist, on: [:identifier]
    }.to change { subject.indices.length }.by(1)
  end

  it 'should be possible to get an index by ID' do
    # This is temporary until Index has a key
    index_key = index.id.split('/')[1]

    expect(subject.index(index_key).id).to eq(index.id)
    expect(subject.indices[0].class).to eq(Ashikawa::Core::Index)
  end

  it 'should be possible to create an unique index' do
    index = subject.add_index :skiplist, on: [:identifier], unique: true

    expect(index.unique).to be_truthy
  end

  it 'should be possible to remove indices' do
    skip 'See Bug #34'

    expect {
      index.delete
      sleep(1) # from time to time it may fail because of threading
    }.to change { subject.indices.length }.by(-1)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ashikawa-core-0.11.0 spec/acceptance/index_spec.rb