Sha256: 6f2c34af9e3a608264d47778bec8b22af2803041e24536e7bee84d32c2487e8f

Contents?: true

Size: 969 Bytes

Versions: 2

Compression:

Stored size: 969 Bytes

Contents

require "integration/test_helper"

describe "Deleting Entities" do
  after do
    TableNameHelper.clean
  end

  before do
    @table_name = TableNameHelper.name
    @table = Azure::Tables::Table.create(TableNameHelper.name)
    @entity = Azure::Tables::Entity.new(
      "PartitionKey" => "part1",
      "RowKey"       => "row1",
      "Address"      => "Mountain View",
      "FirstName"    => "John",
      "Email"        => "john@example.com"
    )
    @table.insert(@entity)
  end

  it "should return false if the entity doesn't exists" do
    entity = Azure::Tables::Entity.new do |e|
      e.reset(@entity)
      e["PartitionKey"] = "Foo"
      e.url = URI(e.url.to_s.gsub("part1", "Foo"))
    end

    result = entity.delete
    result.must_equal false
  end

  it "should be able to delete the entity" do
    result = @entity.delete
    result.must_equal true

    entity = Azure::Tables.query_entity(@table, "part1", "row1")
    entity.must_be_nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azure-0.1.1 test/integration/tables/delete_entity_test.rb
azure-0.1.0 test/integration/tables/delete_entity_test.rb