Sha256: 1942b4378ccc1f7e51e6a42a1e24ac46e415a1993e7c7a2b06087e5ee01295da

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Arpa::Services::Actions::Remove::ActionRemover, type: :service, fast: true do
  let(:action_001) { double name: 'index' }
  let(:action_002) { double name: 'old_index' }
  let(:actions)    { [action_001, action_002] }
  let(:resource)   { double actions: actions }

  let(:actions_names) { %w[index show] }

  let(:params) { { resource: resource, actions_names: actions_names } }

  describe 'removing nonexistent actions' do
    let(:remover_repo_class) { Arpa::Repositories::Actions::Remover }
    let(:remover_repo)       { instance_double remover_repo_class }

    before do
      allow(remover_repo_class).to receive(:new).and_return(remover_repo)
      allow(remover_repo).to receive(:destroy)

      subject.remove_nonexistent_actions(params)
    end

    it 'remover repository should call :new once' do
      expect(remover_repo_class).to have_received(:new).once
    end

    it 'remover repository should call :destroy once' do
      expect(remover_repo).to have_received(:destroy).once
      expect(remover_repo).to have_received(:destroy).with(action_002).once
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arpa-0.3.0 spec/lib/arpa/services/actions/remove/action_remover_spec.rb