-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformats_helper_tests.rb
51 lines (35 loc) · 1.17 KB
/
formats_helper_tests.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Shindo.tests('test_helper', 'meta') do
tests('#formats_kernel') do
tests('returns true') do
test('when format of value matches') do
formats_kernel({:a => :b}, {:a => Symbol})
end
test('when format of nested array elements matches') do
formats_kernel({:a => [:b, :c]}, {:a => [Symbol]})
end
test('when format of nested hash matches') do
formats_kernel({:a => {:b => :c}}, {:a => {:b => Symbol}})
end
test('when format of an array') do
formats_kernel([{:a => :b}], [{:a => Symbol}])
end
test('non strict extra data') do
formats_kernel({:a => :b, :b => :c}, {:a => Symbol}, true, false)
end
end
tests('returns false') do
test('when format of value does not match') do
!formats_kernel({:a => :b}, {:a => String})
end
test('when not all keys are checked') do
!formats_kernel({:a => :b}, {})
end
test('when some keys do not appear') do
!formats_kernel({}, {:a => String})
end
test('non strict extra data') do
!formats_kernel({:a => :b, :b => :c}, {:z => Symbol}, true, false)
end
end
end
end