1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/helper_tests.rb

38 lines
856 B
Ruby
Raw Normal View History

2010-04-05 01:11:28 -04:00
Shindo.tests('test_helper', 'meta') do
tests('#validate_data_format') do
tests('returns true') do
test('when format of value matches') do
2010-04-05 01:11:28 -04:00
validate_format({:a => :b}, {:a => Symbol})
end
test('when format of nested array elements matches') do
2010-04-05 01:11:28 -04:00
validate_format({:a => [:b, :c]}, {:a => [Symbol]})
end
test('when format of nested hash matches') do
2010-04-05 01:11:28 -04:00
validate_format({:a => {:b => :c}}, {:a => {:b => Symbol}})
end
end
tests('returns false') do
test('when format of value does not match') do
2010-04-05 01:11:28 -04:00
!validate_format({:a => :b}, {:a => String})
end
test('when not all keys are checked') do
2010-04-05 01:11:28 -04:00
!validate_format({:a => :b}, {})
end
test('when some keys do not appear') do
2010-04-05 01:11:28 -04:00
!validate_format({}, {:a => String})
end
end
end
end