Sha256: 5edd092b11b9013e30028f6af6f792cfcd5285bf744665b54a0f445fbb3cded6

Contents?: true

Size: 1.63 KB

Versions: 10

Compression:

Stored size: 1.63 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(5)
          expect(subject.include?(:check_remote_actions)).to be(true)
          expect(subject.include?(:check_abnormal_shutdown)).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

10 entries across 10 versions & 1 rubygems

Version Path
flydata-0.5.21 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.20 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.17 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.16 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.15 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.14 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.13 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.12 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.11 spec/flydata/helper/action_ownership_spec.rb
flydata-0.5.10 spec/flydata/helper/action_ownership_spec.rb