Sha256: f942b2043b54e7e199ebc7f443d66c5b8ecfe8a2109165ac4cff1159a779a1b1

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

require 'unit/spec_helper'
require 'ashikawa-core/index'

describe Ashikawa::Core::Index do
  let(:collection) { double() }
  let(:raw_data) {
    {
      "code" => 201,
      "fields" => [
        "something"
      ],
      "id" => "167137465/168054969",
      "type" => "hash",
      "isNewlyCreated" => true,
      "unique" => true,
      "error" => false
    }
  }
  subject { Ashikawa::Core::Index }

  it "should initialize an Index" do
    index = subject.new collection, raw_data
    index.type.should == :hash
    index.on.should == [:something]
    index.unique.should == true
  end

  describe "initialized index" do
    subject { Ashikawa::Core::Index.new collection, raw_data }

    it "should be deletable" do
      collection.should_receive(:send_request).with("index/167137465/168054969",
        delete: {})
      collection.should_receive(:id).and_return(167137465)

      subject.delete
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ashikawa-core-0.5.1 spec/unit/index_spec.rb
ashikawa-core-0.4.1 spec/unit/index_spec.rb
ashikawa-core-0.3.0 spec/unit/index_spec.rb