Sha256: 0b22b5b074423f057d6d9555078a9b2cc962e7bd5d51cfaa4026a90c318a4f16

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
ashikawa-core-0.6.0 spec/unit/index_spec.rb