2011-11-28 16:47:05 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2012-01-11 13:44:28 +00:00
|
|
|
describe Jasmine::Headless do
|
|
|
|
describe '.warn' do
|
|
|
|
let(:output) { StringIO.new }
|
|
|
|
|
|
|
|
before do
|
|
|
|
described_class.stubs(:output).returns(output)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'warnings enabled' do
|
|
|
|
before do
|
|
|
|
described_class.stubs(:show_warnings?).returns(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should work' do
|
|
|
|
described_class.warn("warning")
|
|
|
|
|
|
|
|
output.rewind
|
|
|
|
output.read.should == "warning\n"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'warnings disabled' do
|
|
|
|
before do
|
|
|
|
described_class.stubs(:show_warnings?).returns(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should work' do
|
|
|
|
described_class.warn("warning")
|
|
|
|
|
|
|
|
output.rewind
|
|
|
|
output.read.should == ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|