Permalink
Browse files

les specs

  • Loading branch information...
1 parent 247e84c commit 90c97a799a2a235c6a6e85a16523a13db7891b3d @carhartl committed Apr 1, 2011
Showing with 27 additions and 3 deletions.
  1. +27 −3 spec/guard/phantomjs_spec.rb
@@ -4,11 +4,35 @@ module Guard
describe PhantomJS do
describe "#run_on_change" do
- it "executes phantomjs" do
- pending
- subject.run_on_change(['foo'])
+ context "with modifications" do
+ it "executes phantomjs" do
+ Notifier.stub(:notify)
+ guard = PhantomJS.new([], :runner => 'driver.js')
+ guard.should_receive(:`).with('phantomjs driver.js http://127.0.0.1:8888/')
+ guard.run_on_change(['foo'])
+ end
+
+ it "notifies" do
+ subject.stub(:`).and_return('0 failures')
+ Notifier.should_receive(:notify).with('0 failures',
+ :title => 'Jasmine results', :image => :success)
+ subject.run_on_change(['foo'])
+
+ subject.stub(:`).and_return('1 failure')
+ Notifier.should_receive(:notify).with('1 failure',
+ :title => 'Jasmine results', :image => :failed)
+ subject.run_on_change(['foo'])
+ end
end
+
+ context "without modifications" do
+ it "skips executing phantomjs" do
+ subject.should_not_receive(:`)
+ subject.run_on_change([])
+ end
+ end
+
end
end

0 comments on commit 90c97a7

Please sign in to comment.