Skip to content
Snippets Groups Projects
Commit e05b25b0 authored by Cezary Baginski's avatar Cezary Baginski
Browse files

fix broken command/UI tests

parent c6ab8a0b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -65,8 +65,7 @@ module Guard
interactor.background
UI.info "Bye bye...", reset: true
interactor.destroy
UI.logger.flush
UI.logger.close
UI.disconnect
end
 
# Reload Guardfile and all Guard plugins currently enabled.
Loading
Loading
Loading
Loading
@@ -21,6 +21,12 @@ module Guard
include Colors
 
class << self
# TODO: coverage
def disconnect
logger.flush
logger.close
end
# Get the Guard::UI logger instance
#
def logger
Loading
Loading
Loading
Loading
@@ -10,13 +10,30 @@ RSpec.describe Guard::Commander do
let(:state) { instance_double("Guard::Internals::State") }
let(:session) { instance_double("Guard::Internals::Session") }
 
let(:ui_config) { instance_double("Guard::UI::Config") }
before do
allow(state).to receive(:scope).and_return(scope)
allow(state).to receive(:session).and_return(session)
allow(Guard).to receive(:state).and_return(state)
 
allow(Guard::Interactor).to receive(:new) { interactor }
allow(Guard::Runner).to receive(:new).and_return(runner)
allow(Guard::UI::Config).to receive(:new).and_return(ui_config)
allow(ui_config).to receive(:device)
allow(ui_config).to receive(:logger_config)
allow(Guard::UI).to receive(:disconnect)
end
before do
Guard::UI.options = nil
end
after do
Guard::UI.reset_logger
Guard::UI.options = nil
end
 
describe ".start" do
Loading
Loading
@@ -40,6 +57,7 @@ RSpec.describe Guard::Commander do
allow(interactor).to receive(:foreground).and_return(:exit)
 
allow(interactor).to receive(:background)
allow(interactor).to receive(:destroy)
allow(Guard::Notifier).to receive(:disconnect)
end
 
Loading
Loading
@@ -70,6 +88,7 @@ RSpec.describe Guard::Commander do
context "when finished" do
it "stops everything" do
expect(interactor).to receive(:foreground).and_return(:exit)
expect(interactor).to receive(:destroy)
 
# From stop()
expect(interactor).to receive(:background)
Loading
Loading
@@ -92,6 +111,7 @@ RSpec.describe Guard::Commander do
allow(listener).to receive(:stop)
allow(Guard).to receive(:interactor).and_return(interactor)
allow(interactor).to receive(:background)
allow(interactor).to receive(:destroy)
 
Guard.stop
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment