|
22 | 22 | end
|
23 | 23 |
|
24 | 24 | context 'when value is a default mapped string' do
|
25 |
| - let(:type) { 'double' } |
| 25 | + let(:type) { 'float' } |
26 | 26 |
|
27 | 27 | it 'uses the default mapped type' do
|
28 | 28 | is_expected.to eq Float
|
29 | 29 | end
|
30 | 30 | end
|
31 | 31 |
|
32 | 32 | context 'when value is a custom mapped symbol' do
|
33 |
| - before { described_class.define('number', Integer) } |
| 33 | + before { described_class.define_type('number', Integer) } |
34 | 34 | let(:type) { :number }
|
35 | 35 |
|
36 | 36 | it 'uses the custom mapped type' do
|
|
39 | 39 | end
|
40 | 40 |
|
41 | 41 | context 'when value is a custom mapped string' do
|
42 |
| - before { described_class.define(:number, Float) } |
| 42 | + before { described_class.define_type(:number, Float) } |
43 | 43 | let(:type) { 'number' }
|
44 | 44 |
|
45 | 45 | it 'uses the custom mapped type' do
|
|
94 | 94 | describe '.define' do
|
95 | 95 |
|
96 | 96 | it 'can define a new type' do
|
97 |
| - described_class.define(:my_string, String) |
| 97 | + described_class.define_type(:my_string, String) |
98 | 98 | expect(described_class.get(:my_string)).to eq String
|
99 | 99 | end
|
100 | 100 |
|
101 | 101 | it 'can override a default type' do
|
102 |
| - described_class.define(:integer, String) |
| 102 | + described_class.define_type(:integer, String) |
103 | 103 | expect(described_class.get(:integer)).to eq String
|
104 | 104 | end
|
105 | 105 |
|
106 | 106 | it 'does not alter the DEFAULT_MAPPING constant' do
|
107 |
| - described_class.define(:integer, String) |
| 107 | + described_class.define_type(:integer, String) |
108 | 108 | expect(described_class::DEFAULT_MAPPING[:integer]).to eq Integer
|
109 | 109 | end
|
110 | 110 | end
|
111 | 111 |
|
112 | 112 | describe '.delete' do
|
113 | 113 |
|
114 | 114 | it 'can delete a custom type' do
|
115 |
| - described_class.define(:my_string, String) |
| 115 | + described_class.define_type(:my_string, String) |
116 | 116 | expect(described_class.get(:my_string)).to eq String
|
117 | 117 | described_class.delete('my_string')
|
118 | 118 | expect(described_class.get(:my_string)).to eq nil
|
|
136 | 136 | end
|
137 | 137 |
|
138 | 138 | it 'can add a type' do
|
139 |
| - described_class.define(:my_string, String) |
| 139 | + described_class.define_type(:my_string, String) |
140 | 140 | expect(described_class.mapping[:my_string]).to eq(String)
|
141 | 141 | end
|
142 | 142 |
|
|
0 commit comments