require 'spec_helper' require 'flydata/command/restart' module Flydata module Command describe Restart do subject { described_class.new } let(:sender) { double("sender") } let(:opts) { double("opts") } it "should restart sender and helper when skip-helper option is not passed" do expect(Flydata::Command::Sender).to receive(:new).and_return(sender) expect(sender).to receive(:restart) expect_any_instance_of(Flydata::Command::Restart).to receive(:system).with('flydata helper:restart') subject.run end it "should only restart sender when skip-helper option is passed" do expect(Flydata::Command::Sender).to receive(:new).and_return(sender) expect(sender).to receive(:restart) expect(opts).to receive(:skip_helper?).and_return(true) expect_any_instance_of(Flydata::Command::Restart).to receive(:system).never described_class.new(opts).run end end end end