twitter-status-bot/.gems/gems/naught-1.0.0/spec/functions/actual_spec.rb

23 lines
542 B
Ruby
Raw Normal View History

2014-09-03 08:49:59 +00:00
require 'spec_helper'
describe 'Actual()' do
include ConvertableNull::Conversions
specify 'given a null object, returns nil' do
null = ConvertableNull.get
expect(Actual(null)).to be_nil
end
specify 'given anything else, returns the input unchanged' do
expect(Actual(false)).to be(false)
str = 'hello'
expect(Actual(str)).to be(str)
expect(Actual(nil)).to be_nil
end
it 'also works with blocks' do
expect(Actual { ConvertableNull.new }).to be_nil
expect(Actual { 'foo' }).to eq('foo')
end
end