Sha256: 25153b6cd8d0944c1eb38e478f67b3a40343673e660f414a88f073cf0a2f0453

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Gladwords::Commands::Delete do
  include_context 'labels'

  subject(:command) do
    relation.command(:delete)
  end

  let(:service) { label_service }
  let(:relation) { labels }

  before do
    allow(service).to receive(:get).and_return(entries: [{ id: '1' }])
    allow(service).to receive(:mutate).and_return(value: [{ id: '1' }])
  end

  it 'mutates the service with the correct operations' do
    expect(service).to receive(:mutate).with(
      [
        {
          operator: 'REMOVE',
          operand: { id: '1' }
        }
      ]
    )

    rel = relation.where(id: 1)
    delete_command = rel.command(:delete)
    delete_command.call
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gladwords-1.0.1 spec/unit/commands/delete_spec.rb