Sha256: 2a97fe5b3b5579c80fbb49e1188d608bbe2ebfd9ad990a4010e58e2dc5718a31

Contents?: true

Size: 1.1 KB

Versions: 10

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) { ['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

10 entries across 10 versions & 1 rubygems

Version Path
arpa-0.2.0 spec/lib/arpa/services/actions/remove/action_remover_spec.rb
arpa-0.1.0 spec/lib/arpa/services/actions/remove/action_remover_spec.rb
arpa-0.0.9 spec/lib/arpa/services/actions/remove/action_remover_spec.rb
arpa-0.0.8 spec/lib/ar/services/actions/remove/action_remover_spec.rb
arpa-0.0.7 spec/lib/ar/services/actions/remove/action_remover_spec.rb
arpa-0.0.6 spec/lib/ar/services/actions/remove/action_remover_spec.rb
arpa-0.0.5 spec/lib/ar/services/actions/remove/action_remover_spec.rb
arpa-0.0.4 spec/lib/ar/services/actions/remove/action_remover_spec.rb
arpa-0.0.3 spec/lib/ar/services/actions/remove/action_remover_spec.rb
arpa-0.0.2 spec/lib/ar/services/actions/remove/action_remover_spec.rb