Sha256: ee180c9eb9d6c8c2049366b991385b47fdabe7d185f5839b406a9c92a26a6ddd

Contents?: true

Size: 923 Bytes

Versions: 2

Compression:

Stored size: 923 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

2 entries across 2 versions & 1 rubygems

Version Path
ashikawa-core-0.2.1 spec/unit/index_spec.rb
ashikawa-core-0.2 spec/unit/index_spec.rb