require 'spec_helper' require 'flydata/command/routine' module Flydata module Command describe Routine do subject { described_class.new } let(:flydata) { double('flydata') } let(:credentials) { double('credentials') } let(:path) { '/tmp' } before do expect(subject).to receive(:flydata).and_return(flydata) expect(flydata).to receive(:credentials).and_return(credentials) expect(credentials).to receive(:authenticated?).and_return(true) expect(subject).to receive(:retrieve_log_paths).and_return([path]) end let(:log_monitor) { double('log_monitor') } let(:setup) { double('setup') } it "loads without an error" do expect(Flydata::LogMonitor).to receive(:new).with(path).and_return(log_monitor) expect(log_monitor).to receive(:setup).and_return(setup) expect(setup).to receive(:rotate) subject.run end end end end