-
Notifications
You must be signed in to change notification settings - Fork 27
/
hash_spec.rb
41 lines (35 loc) · 1.57 KB
/
hash_spec.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
describe Zapata::Revolutionist do
before(:all) do
@generated = exec_generation('app/models/test_hash.rb')
end
it '#test_in_arg' do
has_block('#test_in_arg', %{
expect(test_hash.test_in_arg({ 1 => :one, TestHash => 2.718 })).to eq({ 1 => :one, TestHash => 2.718 })
})
end
it '#test_nested_one_level' do
has_block('#test_nested_one_level', %{
expect(test_hash.test_nested_one_level({ first_level: { 1 => :one, TestHash => 2.718 } })).to eq({ first_level: { 1 => :one, TestHash => 2.718 } })
})
end
it '#test_nested_two_levels' do
has_block('#test_nested_two_levels', %{
expect(test_hash.test_nested_two_levels({ second_level: { first_level: { 1 => :one, TestHash => 2.718 } } })).to eq({ second_level: { first_level: { 1 => :one, TestHash => 2.718 } } })
})
end
it '#test_nested_three_levels' do
has_block('#test_nested_three_levels', %{
expect(test_hash.test_nested_three_levels({ third_level: { second_level: { first_level: { 1 => :one, TestHash => 2.718 } } } })).to eq({ third_level: { second_level: { first_level: { 1 => :one, TestHash => 2.718 } } } })
})
end
it '#test_key_as_another_hash' do
has_block('#test_key_as_another_hash', %{
expect(test_hash.test_key_as_another_hash({ { 1 => :one, TestHash => 2.718 } => :ratm })).to eq({ { 1 => :one, TestHash => 2.718 } => :ratm })
})
end
it '#test_keys_are_symbols' do
has_block('#test_keys_are_symbols', %{
expect(test_hash.test_keys_are_symbols({ this: 'should', be: 'pretty' })).to eq({ be: 'pretty', this: 'should' })
})
end
end