ruby-measurement 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +15 -12
- data/lib/ruby-measurement/core_ext/string.rb +1 -1
- data/lib/ruby-measurement/measurement.rb +95 -61
- data/lib/ruby-measurement/unit.rb +31 -31
- data/lib/ruby-measurement/version.rb +1 -1
- data/spec/ruby-measurement/core_ext/string_spec.rb +5 -5
- data/spec/ruby-measurement/definitions/metric/area_spec.rb +15 -15
- data/spec/ruby-measurement/definitions/metric/capacity_spec.rb +8 -8
- data/spec/ruby-measurement/definitions/metric/length_spec.rb +63 -63
- data/spec/ruby-measurement/definitions/metric/volume_spec.rb +63 -63
- data/spec/ruby-measurement/definitions/metric/weight_spec.rb +79 -79
- data/spec/ruby-measurement/definitions/us_customary/area_spec.rb +35 -35
- data/spec/ruby-measurement/definitions/us_customary/capacity_spec.rb +15 -15
- data/spec/ruby-measurement/definitions/us_customary/length_spec.rb +63 -63
- data/spec/ruby-measurement/definitions/us_customary/volume_spec.rb +48 -48
- data/spec/ruby-measurement/definitions/us_customary/weight_spec.rb +35 -35
- data/spec/ruby-measurement/measurement_spec.rb +104 -70
- data/spec/ruby-measurement/unit_builder_spec.rb +15 -15
- data/spec/ruby-measurement/unit_spec.rb +27 -27
- metadata +3 -3
@@ -5,63 +5,63 @@ require 'spec_helper'
|
|
5
5
|
RSpec.describe Measurement do
|
6
6
|
describe 'square kilometers' do
|
7
7
|
subject { described_class.parse('10 km²') }
|
8
|
-
|
8
|
+
|
9
9
|
it 'converts to hectares' do
|
10
10
|
expect(subject.convert_to(:ha).quantity).to eq 1_000
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it 'converts to ares' do
|
14
14
|
expect(subject.convert_to(:a).quantity).to eq 100_000
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it 'converts to square centimeters' do
|
18
18
|
expect(subject.convert_to(:cm2).quantity).to eq 100_000_000_000
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
describe 'hectares' do
|
23
23
|
subject { described_class.parse('10 ha') }
|
24
|
-
|
24
|
+
|
25
25
|
it 'converts to square kilometers' do
|
26
26
|
expect(subject.convert_to(:km2).quantity).to eq 0.1
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it 'converts to ares' do
|
30
30
|
expect(subject.convert_to(:a).quantity).to eq 1_000
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it 'converts to square centimeters' do
|
34
34
|
expect(subject.convert_to(:cm2).quantity).to eq 1_000_000_000
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
describe 'ares' do
|
39
39
|
subject { described_class.parse('1000 a') }
|
40
|
-
|
40
|
+
|
41
41
|
it 'converts to square kilometers' do
|
42
42
|
expect(subject.convert_to(:km2).quantity).to eq 0.1
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it 'converts to hectares' do
|
46
46
|
expect(subject.convert_to(:ha).quantity).to eq 10
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
it 'converts to square centimeters' do
|
50
50
|
expect(subject.convert_to(:cm2).quantity).to eq 1_000_000_000
|
51
51
|
end
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
describe 'square centimeters' do
|
55
55
|
subject { described_class.parse('10000000000 cm²') }
|
56
|
-
|
56
|
+
|
57
57
|
it 'converts to square kilometers' do
|
58
58
|
expect(subject.convert_to(:km2).quantity).to eq 1
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it 'converts to hectares' do
|
62
62
|
expect(subject.convert_to(:ha).quantity).to eq 100
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
it 'converts to ares' do
|
66
66
|
expect(subject.convert_to(:a).quantity).to eq 10_000
|
67
67
|
end
|
@@ -5,35 +5,35 @@ require 'spec_helper'
|
|
5
5
|
RSpec.describe Measurement do
|
6
6
|
describe 'cubic meters' do
|
7
7
|
subject { described_class.parse('1 m³') }
|
8
|
-
|
8
|
+
|
9
9
|
it 'converts to cubic decimeters' do
|
10
10
|
expect(subject.convert_to(:dm3).quantity).to eq 1_000
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it 'converts to cubic centimeters' do
|
14
14
|
expect(subject.convert_to(:cm3).quantity).to eq 1_000_000
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
describe 'cubic decimeters' do
|
19
19
|
subject { described_class.parse('1000 dm³') }
|
20
|
-
|
20
|
+
|
21
21
|
it 'converts to cubic meters' do
|
22
22
|
expect(subject.convert_to(:m3).quantity).to eq 1
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it 'converts to cubic centimeters' do
|
26
26
|
expect(subject.convert_to(:cm3).quantity).to eq 1_000_000
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
describe 'cubic centimeters' do
|
31
31
|
subject { described_class.parse('1000000 cm³') }
|
32
|
-
|
32
|
+
|
33
33
|
it 'converts to cubic meters' do
|
34
34
|
expect(subject.convert_to(:m3).quantity).to eq 1
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
it 'converts to cubic decimeters' do
|
38
38
|
expect(subject.convert_to(:dm3).quantity).to eq 1_000
|
39
39
|
end
|
@@ -5,255 +5,255 @@ require 'spec_helper'
|
|
5
5
|
RSpec.describe Measurement do
|
6
6
|
describe 'kilometers' do
|
7
7
|
subject { described_class.parse('1 km') }
|
8
|
-
|
8
|
+
|
9
9
|
it 'converts to hectometers' do
|
10
10
|
expect(subject.convert_to(:hm).quantity).to eq 10
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it 'converts to dekameters' do
|
14
14
|
expect(subject.convert_to(:dam).quantity).to eq 100
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it 'converts to meters' do
|
18
18
|
expect(subject.convert_to(:m).quantity).to eq 1_000
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it 'converts to decimeters' do
|
22
22
|
expect(subject.convert_to(:dm).quantity).to eq 10_000
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it 'converts to centimeters' do
|
26
26
|
expect(subject.convert_to(:cm).quantity).to eq 100_000
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it 'converts to millimeters' do
|
30
30
|
expect(subject.convert_to(:mm).quantity).to eq 1_000_000
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it 'converts to micrometers' do
|
34
34
|
expect(subject.convert_to(:µm).quantity).to eq 10_000_000
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
describe 'hectometers' do
|
39
39
|
subject { described_class.parse('10 hm') }
|
40
|
-
|
40
|
+
|
41
41
|
it 'converts to kilometers' do
|
42
42
|
expect(subject.convert_to(:km).quantity).to eq 1
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it 'converts to dekameters' do
|
46
46
|
expect(subject.convert_to(:dam).quantity).to eq 100
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
it 'converts to meters' do
|
50
50
|
expect(subject.convert_to(:m).quantity).to eq 1_000
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it 'converts to decimeters' do
|
54
54
|
expect(subject.convert_to(:dm).quantity).to eq 10_000
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
it 'converts to centimeters' do
|
58
58
|
expect(subject.convert_to(:cm).quantity).to eq 100_000
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it 'converts to millimeters' do
|
62
62
|
expect(subject.convert_to(:mm).quantity).to eq 1_000_000
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
it 'converts to micrometers' do
|
66
66
|
expect(subject.convert_to(:µm).quantity).to eq 10_000_000
|
67
67
|
end
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
describe 'dekameters' do
|
71
71
|
subject { described_class.parse('100 dam') }
|
72
|
-
|
72
|
+
|
73
73
|
it 'converts to kilometers' do
|
74
74
|
expect(subject.convert_to(:km).quantity).to eq 1
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
it 'converts to hectometers' do
|
78
78
|
expect(subject.convert_to(:hm).quantity).to eq 10
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
it 'converts to meters' do
|
82
82
|
expect(subject.convert_to(:m).quantity).to eq 1_000
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
it 'converts to decimeters' do
|
86
86
|
expect(subject.convert_to(:dm).quantity).to eq 10_000
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
it 'converts to centimeters' do
|
90
90
|
expect(subject.convert_to(:cm).quantity).to eq 100_000
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
it 'converts to millimeters' do
|
94
94
|
expect(subject.convert_to(:mm).quantity).to eq 1_000_000
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
it 'converts to micrometers' do
|
98
98
|
expect(subject.convert_to(:µm).quantity).to eq 10_000_000
|
99
99
|
end
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
describe 'meters' do
|
103
103
|
subject { described_class.parse('1000 m') }
|
104
|
-
|
104
|
+
|
105
105
|
it 'converts to kilometers' do
|
106
106
|
expect(subject.convert_to(:km).quantity).to eq 1
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
it 'converts to hectometers' do
|
110
110
|
expect(subject.convert_to(:hm).quantity).to eq 10
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
it 'converts to dekameters' do
|
114
114
|
expect(subject.convert_to(:dam).quantity).to eq 100
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
it 'converts to decimeters' do
|
118
118
|
expect(subject.convert_to(:dm).quantity).to eq 10_000
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
it 'converts to centimeters' do
|
122
122
|
expect(subject.convert_to(:cm).quantity).to eq 100_000
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
it 'converts to millimeters' do
|
126
126
|
expect(subject.convert_to(:mm).quantity).to eq 1_000_000
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
129
|
it 'converts to micrometers' do
|
130
130
|
expect(subject.convert_to(:µm).quantity).to eq 10_000_000
|
131
131
|
end
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
describe 'decimeters' do
|
135
135
|
subject { described_class.parse('10000 dm') }
|
136
|
-
|
136
|
+
|
137
137
|
it 'converts to kilometers' do
|
138
138
|
expect(subject.convert_to(:km).quantity).to eq 1
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
it 'converts to hectometers' do
|
142
142
|
expect(subject.convert_to(:hm).quantity).to eq 10
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
it 'converts to dekameters' do
|
146
146
|
expect(subject.convert_to(:dam).quantity).to eq 100
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
it 'converts to meters' do
|
150
150
|
expect(subject.convert_to(:m).quantity).to eq 1_000
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
it 'converts to centimeters' do
|
154
154
|
expect(subject.convert_to(:cm).quantity).to eq 100_000
|
155
155
|
end
|
156
|
-
|
156
|
+
|
157
157
|
it 'converts to millimeters' do
|
158
158
|
expect(subject.convert_to(:mm).quantity).to eq 1_000_000
|
159
159
|
end
|
160
|
-
|
160
|
+
|
161
161
|
it 'converts to micrometers' do
|
162
162
|
expect(subject.convert_to(:µm).quantity).to eq 10_000_000
|
163
163
|
end
|
164
164
|
end
|
165
|
-
|
165
|
+
|
166
166
|
describe 'centimeters' do
|
167
167
|
subject { described_class.parse('100000 cm') }
|
168
|
-
|
168
|
+
|
169
169
|
it 'converts to kilometers' do
|
170
170
|
expect(subject.convert_to(:km).quantity).to eq 1
|
171
171
|
end
|
172
|
-
|
172
|
+
|
173
173
|
it 'converts to hectoliters' do
|
174
174
|
expect(subject.convert_to(:hm).quantity).to eq 10
|
175
175
|
end
|
176
|
-
|
176
|
+
|
177
177
|
it 'converts to dekameters' do
|
178
178
|
expect(subject.convert_to(:dam).quantity).to eq 100
|
179
179
|
end
|
180
|
-
|
180
|
+
|
181
181
|
it 'converts to meters' do
|
182
182
|
expect(subject.convert_to(:m).quantity).to eq 1_000
|
183
183
|
end
|
184
|
-
|
184
|
+
|
185
185
|
it 'converts to decimeters' do
|
186
186
|
expect(subject.convert_to(:dm).quantity).to eq 10_000
|
187
187
|
end
|
188
|
-
|
188
|
+
|
189
189
|
it 'converts to millimeters' do
|
190
190
|
expect(subject.convert_to(:mm).quantity).to eq 1_000_000
|
191
191
|
end
|
192
|
-
|
192
|
+
|
193
193
|
it 'converts to micrometers' do
|
194
194
|
expect(subject.convert_to(:µm).quantity).to eq 10_000_000
|
195
195
|
end
|
196
196
|
end
|
197
|
-
|
197
|
+
|
198
198
|
describe 'millimeters' do
|
199
199
|
subject { described_class.parse('1000000 mm') }
|
200
|
-
|
200
|
+
|
201
201
|
it 'converts to kilometers' do
|
202
202
|
expect(subject.convert_to(:km).quantity).to eq 1
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
it 'converts to hectometers' do
|
206
206
|
expect(subject.convert_to(:hm).quantity).to eq 10
|
207
207
|
end
|
208
|
-
|
208
|
+
|
209
209
|
it 'converts to dekameters' do
|
210
210
|
expect(subject.convert_to(:dam).quantity).to eq 100
|
211
211
|
end
|
212
|
-
|
212
|
+
|
213
213
|
it 'converts to meters' do
|
214
214
|
expect(subject.convert_to(:m).quantity).to eq 1_000
|
215
215
|
end
|
216
|
-
|
216
|
+
|
217
217
|
it 'converts to decimeters' do
|
218
218
|
expect(subject.convert_to(:dm).quantity).to eq 10_000
|
219
219
|
end
|
220
|
-
|
220
|
+
|
221
221
|
it 'converts to centimeters' do
|
222
222
|
expect(subject.convert_to(:cm).quantity).to eq 100_000
|
223
223
|
end
|
224
|
-
|
224
|
+
|
225
225
|
it 'converts to micrometers' do
|
226
226
|
expect(subject.convert_to(:µm).quantity).to eq 10_000_000
|
227
227
|
end
|
228
228
|
end
|
229
|
-
|
229
|
+
|
230
230
|
describe 'micrometers' do
|
231
231
|
subject { described_class.parse('10000000 µm') }
|
232
|
-
|
232
|
+
|
233
233
|
it 'converts to kilometers' do
|
234
234
|
expect(subject.convert_to(:km).quantity).to eq 1
|
235
235
|
end
|
236
|
-
|
236
|
+
|
237
237
|
it 'converts to hectometers' do
|
238
238
|
expect(subject.convert_to(:hm).quantity).to eq 10
|
239
239
|
end
|
240
|
-
|
240
|
+
|
241
241
|
it 'converts to dekameters' do
|
242
242
|
expect(subject.convert_to(:dam).quantity).to eq 100
|
243
243
|
end
|
244
|
-
|
244
|
+
|
245
245
|
it 'converts to meters' do
|
246
246
|
expect(subject.convert_to(:m).quantity).to eq 1_000
|
247
247
|
end
|
248
|
-
|
248
|
+
|
249
249
|
it 'converts to decimeters' do
|
250
250
|
expect(subject.convert_to(:dm).quantity).to eq 10_000
|
251
251
|
end
|
252
|
-
|
252
|
+
|
253
253
|
it 'converts to centimeters' do
|
254
254
|
expect(subject.convert_to(:cm).quantity).to eq 100_000
|
255
255
|
end
|
256
|
-
|
256
|
+
|
257
257
|
it 'converts to millimeters' do
|
258
258
|
expect(subject.convert_to(:mm).quantity).to eq 1_000_000
|
259
259
|
end
|
@@ -5,255 +5,255 @@ require 'spec_helper'
|
|
5
5
|
RSpec.describe Measurement do
|
6
6
|
describe 'kiloliters' do
|
7
7
|
subject { described_class.parse('1 kl') }
|
8
|
-
|
8
|
+
|
9
9
|
it 'converts to hectoliters' do
|
10
10
|
expect(subject.convert_to(:hl).quantity).to eq 10
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it 'converts to dekaliters' do
|
14
14
|
expect(subject.convert_to(:dal).quantity).to eq 100
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it 'converts to liters' do
|
18
18
|
expect(subject.convert_to(:l).quantity).to eq 1_000
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it 'converts to deciliters' do
|
22
22
|
expect(subject.convert_to(:dl).quantity).to eq 10_000
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it 'converts to centiliters' do
|
26
26
|
expect(subject.convert_to(:cl).quantity).to eq 100_000
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it 'converts to milliliters' do
|
30
30
|
expect(subject.convert_to(:ml).quantity).to eq 1_000_000
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it 'converts to microliters' do
|
34
34
|
expect(subject.convert_to(:µl).quantity).to eq 10_000_000
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
describe 'hectoliters' do
|
39
39
|
subject { described_class.parse('10 hl') }
|
40
|
-
|
40
|
+
|
41
41
|
it 'converts to kiloliters' do
|
42
42
|
expect(subject.convert_to(:kl).quantity).to eq 1
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it 'converts to dekaliters' do
|
46
46
|
expect(subject.convert_to(:dal).quantity).to eq 100
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
it 'converts to liters' do
|
50
50
|
expect(subject.convert_to(:l).quantity).to eq 1_000
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it 'converts to deciliters' do
|
54
54
|
expect(subject.convert_to(:dl).quantity).to eq 10_000
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
it 'converts to centiliters' do
|
58
58
|
expect(subject.convert_to(:cl).quantity).to eq 100_000
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it 'converts to milliliters' do
|
62
62
|
expect(subject.convert_to(:ml).quantity).to eq 1_000_000
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
it 'converts to microliters' do
|
66
66
|
expect(subject.convert_to(:µl).quantity).to eq 10_000_000
|
67
67
|
end
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
describe 'dekaliters' do
|
71
71
|
subject { described_class.parse('100 dal') }
|
72
|
-
|
72
|
+
|
73
73
|
it 'converts to kiloliters' do
|
74
74
|
expect(subject.convert_to(:kl).quantity).to eq 1
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
it 'converts to hectoliters' do
|
78
78
|
expect(subject.convert_to(:hl).quantity).to eq 10
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
it 'converts to liters' do
|
82
82
|
expect(subject.convert_to(:l).quantity).to eq 1_000
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
it 'converts to deciliters' do
|
86
86
|
expect(subject.convert_to(:dl).quantity).to eq 10_000
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
it 'converts to centiliters' do
|
90
90
|
expect(subject.convert_to(:cl).quantity).to eq 100_000
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
it 'converts to milliliters' do
|
94
94
|
expect(subject.convert_to(:ml).quantity).to eq 1_000_000
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
it 'converts to microliters' do
|
98
98
|
expect(subject.convert_to(:µl).quantity).to eq 10_000_000
|
99
99
|
end
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
describe 'liters' do
|
103
103
|
subject { described_class.parse('1000 l') }
|
104
|
-
|
104
|
+
|
105
105
|
it 'converts to kiloliters' do
|
106
106
|
expect(subject.convert_to(:kl).quantity).to eq 1
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
it 'converts to hectoliters' do
|
110
110
|
expect(subject.convert_to(:hl).quantity).to eq 10
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
it 'converts to dekaliters' do
|
114
114
|
expect(subject.convert_to(:dal).quantity).to eq 100
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
it 'converts to deciliters' do
|
118
118
|
expect(subject.convert_to(:dl).quantity).to eq 10_000
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
it 'converts to centiliters' do
|
122
122
|
expect(subject.convert_to(:cl).quantity).to eq 100_000
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
it 'converts to milliliters' do
|
126
126
|
expect(subject.convert_to(:ml).quantity).to eq 1_000_000
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
129
|
it 'converts to microliters' do
|
130
130
|
expect(subject.convert_to(:µl).quantity).to eq 10_000_000
|
131
131
|
end
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
describe 'deciliters' do
|
135
135
|
subject { described_class.parse('10000 dl') }
|
136
|
-
|
136
|
+
|
137
137
|
it 'converts to kiloliters' do
|
138
138
|
expect(subject.convert_to(:kl).quantity).to eq 1
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
it 'converts to hectoliters' do
|
142
142
|
expect(subject.convert_to(:hl).quantity).to eq 10
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
it 'converts to dekaliters' do
|
146
146
|
expect(subject.convert_to(:dal).quantity).to eq 100
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
it 'converts to liters' do
|
150
150
|
expect(subject.convert_to(:l).quantity).to eq 1_000
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
it 'converts to centiliters' do
|
154
154
|
expect(subject.convert_to(:cl).quantity).to eq 100_000
|
155
155
|
end
|
156
|
-
|
156
|
+
|
157
157
|
it 'converts to milliliters' do
|
158
158
|
expect(subject.convert_to(:ml).quantity).to eq 1_000_000
|
159
159
|
end
|
160
|
-
|
160
|
+
|
161
161
|
it 'converts to microliters' do
|
162
162
|
expect(subject.convert_to(:µl).quantity).to eq 10_000_000
|
163
163
|
end
|
164
164
|
end
|
165
|
-
|
165
|
+
|
166
166
|
describe 'centiliters' do
|
167
167
|
subject { described_class.parse('100000 cl') }
|
168
|
-
|
168
|
+
|
169
169
|
it 'converts to kiloliters' do
|
170
170
|
expect(subject.convert_to(:kl).quantity).to eq 1
|
171
171
|
end
|
172
|
-
|
172
|
+
|
173
173
|
it 'converts to hectoliters' do
|
174
174
|
expect(subject.convert_to(:hl).quantity).to eq 10
|
175
175
|
end
|
176
|
-
|
176
|
+
|
177
177
|
it 'converts to dekaliters' do
|
178
178
|
expect(subject.convert_to(:dal).quantity).to eq 100
|
179
179
|
end
|
180
|
-
|
180
|
+
|
181
181
|
it 'converts to liters' do
|
182
182
|
expect(subject.convert_to(:l).quantity).to eq 1_000
|
183
183
|
end
|
184
|
-
|
184
|
+
|
185
185
|
it 'converts to deciliters' do
|
186
186
|
expect(subject.convert_to(:dl).quantity).to eq 10_000
|
187
187
|
end
|
188
|
-
|
188
|
+
|
189
189
|
it 'converts to milliliters' do
|
190
190
|
expect(subject.convert_to(:ml).quantity).to eq 1_000_000
|
191
191
|
end
|
192
|
-
|
192
|
+
|
193
193
|
it 'converts to microliters' do
|
194
194
|
expect(subject.convert_to(:µl).quantity).to eq 10_000_000
|
195
195
|
end
|
196
196
|
end
|
197
|
-
|
197
|
+
|
198
198
|
describe 'milliliters' do
|
199
199
|
subject { described_class.parse('1000000 ml') }
|
200
|
-
|
200
|
+
|
201
201
|
it 'converts to kiloliters' do
|
202
202
|
expect(subject.convert_to(:kl).quantity).to eq 1
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
it 'converts to hectoliters' do
|
206
206
|
expect(subject.convert_to(:hl).quantity).to eq 10
|
207
207
|
end
|
208
|
-
|
208
|
+
|
209
209
|
it 'converts to dekaliters' do
|
210
210
|
expect(subject.convert_to(:dal).quantity).to eq 100
|
211
211
|
end
|
212
|
-
|
212
|
+
|
213
213
|
it 'converts to liters' do
|
214
214
|
expect(subject.convert_to(:l).quantity).to eq 1_000
|
215
215
|
end
|
216
|
-
|
216
|
+
|
217
217
|
it 'converts to deciliters' do
|
218
218
|
expect(subject.convert_to(:dl).quantity).to eq 10_000
|
219
219
|
end
|
220
|
-
|
220
|
+
|
221
221
|
it 'converts to centiliters' do
|
222
222
|
expect(subject.convert_to(:cl).quantity).to eq 100_000
|
223
223
|
end
|
224
|
-
|
224
|
+
|
225
225
|
it 'converts to microliters' do
|
226
226
|
expect(subject.convert_to(:µl).quantity).to eq 10_000_000
|
227
227
|
end
|
228
228
|
end
|
229
|
-
|
229
|
+
|
230
230
|
describe 'microliters' do
|
231
231
|
subject { described_class.parse('10000000 µl') }
|
232
|
-
|
232
|
+
|
233
233
|
it 'converts to kiloliters' do
|
234
234
|
expect(subject.convert_to(:kl).quantity).to eq 1
|
235
235
|
end
|
236
|
-
|
236
|
+
|
237
237
|
it 'converts to hectoliters' do
|
238
238
|
expect(subject.convert_to(:hl).quantity).to eq 10
|
239
239
|
end
|
240
|
-
|
240
|
+
|
241
241
|
it 'converts to dekaliters' do
|
242
242
|
expect(subject.convert_to(:dal).quantity).to eq 100
|
243
243
|
end
|
244
|
-
|
244
|
+
|
245
245
|
it 'converts to liters' do
|
246
246
|
expect(subject.convert_to(:l).quantity).to eq 1_000
|
247
247
|
end
|
248
|
-
|
248
|
+
|
249
249
|
it 'converts to deciliters' do
|
250
250
|
expect(subject.convert_to(:dl).quantity).to eq 10_000
|
251
251
|
end
|
252
|
-
|
252
|
+
|
253
253
|
it 'converts to centiliters' do
|
254
254
|
expect(subject.convert_to(:cl).quantity).to eq 100_000
|
255
255
|
end
|
256
|
-
|
256
|
+
|
257
257
|
it 'converts to milliliters' do
|
258
258
|
expect(subject.convert_to(:ml).quantity).to eq 1_000_000
|
259
259
|
end
|