Sha256: febea63106346a876a172e24d7e42fb18df9c59c66ad8dbd3757c97776652ca7

Contents?: true

Size: 1.69 KB

Versions: 31

Compression:

Stored size: 1.69 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(6)
          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)
          expect(subject.include?(:update_helper_config)).to be(true)
        end
      end
    end
  end
end    

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
flydata-0.7.15 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.14 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.13 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.12 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.11 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.10 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.9 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.8 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.7 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.6 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.5 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.4 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.2.1 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.2 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.1 spec/flydata/helper/action_ownership_spec.rb
flydata-0.7.0 spec/flydata/helper/action_ownership_spec.rb
flydata-0.6.14 spec/flydata/helper/action_ownership_spec.rb
flydata-0.6.13 spec/flydata/helper/action_ownership_spec.rb
flydata-0.6.12 spec/flydata/helper/action_ownership_spec.rb
flydata-0.6.11 spec/flydata/helper/action_ownership_spec.rb