Sha256: 88fdeee534123f177eeae3e07cb2f833bec5ab0749f771758fe275f1efae0177

Contents?: true

Size: 1.55 KB

Versions: 14

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'
require 'flydata/helper/action_ownership'

module Flydata
  module Helper
    describe ActionOwnership do
      describe '#initialize' do
        let(:action_name) { 'stop_agent' }
        let(:action_class) { Action::StopAgent }

        subject { described_class.new(action_name, true, action_class) }

        it { expect(subject.action_name).to eq(action_name) }
        it { expect(subject.resource_change).to eq(true) }
        it { expect(subject.action_class).to eq(action_class) }
        it { expect(subject.owner).to eq(nil) }
        it { expect(subject.last_processed_time).to eq(-1) }
      end

      describe '#processing?' do
        let(:action_name) { 'stop_agent' }
        let(:action_class) { Action::StopAgent }
        let(:ownership) { described_class.new(action_name, true, action_class) }

        subject { ownership.processing? }

        context 'when owner is not set' do
          it { expect(subject).to be(false) }
        end
        context 'when owner is set' do
          before { ownership.owner = 'test-owner' }
          it { expect(subject).to be(true) }
        end
      end

      describe '.action_ownership_map' do
        subject { described_class.action_ownership_map }
        it do
          expect(subject.size).to eq(4)
          expect(subject.include?(:check_remote_actions)).to be(true)
          expect(subject.include?(:send_logs)).to be(true)
          expect(subject.include?(:stop_agent)).to be(true)
          expect(subject.include?(:restart_agent)).to be(true)
        end
      end
    end
  end
end    

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
flydata-0.5.9 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.8 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.7 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.6 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.5 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.4 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.3 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.2 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.1 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.0 spec/flydata/helper/action_ownership_spec.rb
flydata-0.4.3 spec/flydata/helper/action_ownership_spec.rb
flydata-0.4.2 spec/flydata/helper/action_ownership_spec.rb
flydata-0.4.1 spec/flydata/helper/action_ownership_spec.rb
flydata-0.4.0 spec/flydata/helper/action_ownership_spec.rb