Skip to content

Commit

Permalink
Don't try to stop a server when no server is running. (Fixes #31)
Browse files Browse the repository at this point in the history
  • Loading branch information
netzpirat committed Feb 1, 2012
1 parent 6106daf commit 82d916a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/guard/jasmine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def start
# @raise [:task_has_failed] when stop has failed
#
def stop
Server.stop
Server.stop unless options[:server] == :none
end

# Gets called when the Guard should reload itself.
Expand Down
19 changes: 16 additions & 3 deletions spec/guard/jasmine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,22 @@
end

describe '.stop' do
it 'stops the server' do
server.should_receive(:stop)
guard.stop
context 'with a configured server' do
let(:guard) { Guard::Jasmine.new(nil, { :server => :thin }) }

it 'stops the server' do
server.should_receive(:stop)
guard.stop
end
end

context 'without a configured server' do
let(:guard) { Guard::Jasmine.new(nil, { :server => :none }) }

it 'does not stop the server' do
server.should_not_receive(:stop)
guard.stop
end
end
end

Expand Down

0 comments on commit 82d916a

Please sign in to comment.