Sha256: 52b961dd85f02997b2038b48b91827286c18d6c72d7b06952d91619f60608023

Contents?: true

Size: 1.92 KB

Versions: 73

Compression:

Stored size: 1.92 KB

Contents

module Flydata
  module Helper
    shared_context 'helper context' do
      let(:action_object) { double("action_object") }

      let(:action_class) do
        c = double("action_class")
        allow(c).to receive(:new).and_return(action_object)
        c
      end

      let(:action_ownership) do
        o = double("action_ownership")
        allow(o).to receive(:action_name).and_return(:check_remote_actions)
        allow(o).to receive(:action_class).and_return(action_class)
        o
      end

      let(:action) do
        a = double("action")
        allow(a).to receive(:[]).with(:action_ownership).and_return(action_ownership)
        allow(a).to receive(:[]).with(:action_info).and_return(nil)
        a
      end

      let(:action_ownership_channel) { double("action_ownership_channel") }

      let(:logger) do
        l = double("logger")
        [:fatal, :error, :warn, :info, :debug]. each do |level|
          allow(l).to receive(level)
        end
        l
      end

      let(:server) do
        s = double("server")
        allow(s).to receive(:logger).and_return(logger)
        allow(s).to receive(:action_ownership_channel).
          and_return(action_ownership_channel)
        allow(s).to receive(:config).
          and_return(config)
        s
      end

      let(:scheduled_actions) do
        {
          check_remote_actions: {
            check_interval: 1
          }
        }
      end

      let(:helper_conf) do
        c = double("helper_conf")
        allow(c).to receive(:helper_retry_limit).and_return(10)
        allow(c).to receive(:helper_retry_interval).and_return(0.1)
        allow(c).to receive(:helper_action_position_path).and_return("some_path")
        c
      end

      let(:config) do
        h = double("config")
        allow(h).to receive(:scheduled_actions).and_return(scheduled_actions)
        allow(h).to receive(:[]).with(:helper).and_return(helper_conf)
        h
      end
    end
  end
end  

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
flydata-0.8.10.2 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.10.1 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.9.11 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.10 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.9 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.8 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.7 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.6 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.5 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.4 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.3 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.2 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.1 spec/flydata/helper/helper_shared_context.rb
flydata-0.8.0 spec/flydata/helper/helper_shared_context.rb
flydata-0.7.19 spec/flydata/helper/helper_shared_context.rb
flydata-0.7.18 spec/flydata/helper/helper_shared_context.rb
flydata-0.7.17 spec/flydata/helper/helper_shared_context.rb
flydata-0.7.16 spec/flydata/helper/helper_shared_context.rb
flydata-0.7.15 spec/flydata/helper/helper_shared_context.rb
flydata-0.7.14 spec/flydata/helper/helper_shared_context.rb