Skip to content

Commit

Permalink
les specs
Browse files Browse the repository at this point in the history
  • Loading branch information
carhartl committed Apr 1, 2011
1 parent 247e84c commit 90c97a7
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions spec/guard/phantomjs_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 90c97a7

Please sign in to comment.