Sha256: 788286b26c31464923fd7289ab6ea4a93e155c6e6a4ed5df8534797c850cbe5c

Contents?: true

Size: 1.14 KB

Versions: 10

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe Arpa::Services::Profiles::Remove::ProfileRemover, type: :service, fast: true do

  let(:profile) { double }

  describe 'removing profile' do
    let(:remover_repo_class) { Arpa::Repositories::Profiles::Remover }
    let(:remover_repo)       { instance_double remover_repo_class }

    before do
      allow(remover_repo_class).to receive(:new).and_return(remover_repo)
      setup
      subject.remove(profile, disable)
    end

    context 'when pass nil as disable param' do
      let(:disable) { nil }

      let(:setup) { allow(remover_repo).to receive(:destroy) }

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

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

    end

    context 'when pass true as disable param' do
      let(:disable) { true }

      let(:setup) { allow(remover_repo).to receive(:disable) }

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

    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

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