2011-06-01 21:14:23 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2011-10-11 19:30:39 +00:00
|
|
|
describe Guard::JasmineHeadlessWebkit::Runner do
|
2011-09-14 14:06:55 +00:00
|
|
|
describe '.run' do
|
|
|
|
it 'should pass along options' do
|
|
|
|
Jasmine::Headless::Runner.expects(:run).with(has_key(:full_run))
|
|
|
|
|
2011-10-11 19:30:39 +00:00
|
|
|
Guard::JasmineHeadlessWebkit::Runner.run([], :full_run => false)
|
2011-09-14 14:06:55 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-06-01 21:14:23 +00:00
|
|
|
describe '.notify' do
|
|
|
|
include FakeFS::SpecHelpers
|
|
|
|
|
|
|
|
let(:file) { 'temp.txt' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
File.open(file, 'w') { |fh| fh.print data }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'system run not interrupted' do
|
2011-09-03 11:50:05 +00:00
|
|
|
let(:data) { 'TOTAL||1||0||5||F' }
|
2011-06-01 21:14:23 +00:00
|
|
|
|
|
|
|
it 'should notify with the right information' do
|
2011-09-03 11:50:05 +00:00
|
|
|
Guard::Notifier.expects(:notify).with("1 test, 0 failures, 5.0 secs.", { :title => 'Jasmine results', :image => :success })
|
2011-06-01 21:14:23 +00:00
|
|
|
|
2011-10-11 19:30:39 +00:00
|
|
|
Guard::JasmineHeadlessWebkit::Runner.notify(file).should == []
|
2011-06-01 21:14:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-07-14 10:50:47 +00:00
|
|
|
context 'with failures' do
|
2011-09-06 20:00:27 +00:00
|
|
|
let(:data) { <<-REPORT }
|
|
|
|
FAIL||Test||Two||file.js:50
|
|
|
|
TOTAL||1||1||5||F
|
|
|
|
REPORT
|
2011-07-14 10:50:47 +00:00
|
|
|
|
|
|
|
it 'should notify with the right information' do
|
2011-09-03 11:50:05 +00:00
|
|
|
Guard::Notifier.expects(:notify).with("1 test, 1 failures, 5.0 secs.", { :title => 'Jasmine results', :image => :failed })
|
2011-07-14 10:50:47 +00:00
|
|
|
|
2011-10-11 19:30:39 +00:00
|
|
|
Guard::JasmineHeadlessWebkit::Runner.notify(file).should == [ 'file.js' ]
|
2011-07-14 10:50:47 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-06-01 21:14:23 +00:00
|
|
|
context 'system run interrupted' do
|
|
|
|
let(:data) { '' }
|
|
|
|
|
|
|
|
it 'should notify failure' do
|
|
|
|
Guard::Notifier.expects(:notify).with("Spec runner interrupted!", { :title => 'Jasmine results', :image => :failed })
|
|
|
|
|
2011-10-11 19:30:39 +00:00
|
|
|
Guard::JasmineHeadlessWebkit::Runner.notify(file).should be_false
|
2011-06-01 21:14:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|