Don't kill listener thread on spec

This commit is contained in:
Thibaud Guillaume-Gentil 2011-09-03 21:44:09 +02:00
parent b0295c1437
commit ee5468eeeb
2 changed files with 7 additions and 8 deletions

View File

@ -158,29 +158,29 @@ describe Guard::Listener do
end
end
end
describe "#ignore_paths" do
it "defaults to the default ignore paths" do
subject.new.ignore_paths.should == Guard::Listener::DefaultIgnorePaths
end
it "can be added to via :ignore_paths option" do
listener = subject.new 'path', :ignore_paths => ['foo', 'bar']
listener.ignore_paths.should include('foo', 'bar')
end
end
describe "#exclude_ignored_paths [<dirs>]" do
let(:ignore_paths) { nil }
subject { described_class.new(@fixture_path, {:ignore_paths => ignore_paths}) }
it "returns children of <dirs>" do
subject.exclude_ignored_paths(["spec/fixtures"]).should =~ ["spec/fixtures/.dotfile", "spec/fixtures/folder1", "spec/fixtures/Guardfile"]
end
describe "when ignore_paths set to some of <dirs> children" do
let(:ignore_paths) { ['Guardfile', '.dotfile'] }
it "excludes the ignored paths" do
subject.exclude_ignored_paths(["spec/fixtures"]).should =~ ["spec/fixtures/folder1"]
end

View File

@ -3,7 +3,7 @@ private
def start(rest_delay = @rest_delay)
sleep(rest_delay || 1)
@listener.update_last_event
@thread = Thread.new { @listener.start }
Thread.new { @listener.start }
sleep(rest_delay || 1)
end
@ -19,7 +19,6 @@ private
def stop(rest_delay = @rest_delay)
sleep(rest_delay || 1)
@listener.stop
Thread.kill(@thread)
sleep(rest_delay || 1)
end