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