ree_lib 1.0.87 → 1.0.89
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +22 -22
- data/lib/ree_lib/packages/ree_actions/package/ree_actions/dsl.rb +0 -12
- data/lib/ree_lib/packages/ree_actions/spec/ree_actions/dsl_spec.rb +0 -90
- data/lib/ree_lib/packages/ree_dao/Package.schema.json +0 -28
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/dataset_extensions.rb +29 -21
- data/lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/build_pg_connection_spec.rb +10 -3
- data/lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/build_sqlite_connection_spec.rb +0 -37
- data/lib/ree_lib/packages/ree_http/package/ree_http/functions/execute_request.rb +27 -20
- data/lib/ree_lib/packages/ree_http/schemas/ree_http/functions/execute_request.schema.json +8 -0
- data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_delete_spec.rb +10 -8
- data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_get_spec.rb +79 -18
- data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_options_spec.rb +6 -5
- data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_patch_spec.rb +8 -4
- data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_post_spec.rb +5 -10
- data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_put_spec.rb +5 -3
- data/lib/ree_lib/packages/ree_i18n/spec/ree_i18n/functions/t_spec.rb +4 -4
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/mapper.rb +22 -6
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/benchmarks/mapper_benchmark_spec.rb +31 -0
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/bool_spec.rb +8 -8
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/date_spec.rb +10 -10
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/date_time_spec.rb +16 -16
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/float_spec.rb +13 -13
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/hash_spec.rb +2 -2
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/integer_spec.rb +14 -14
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/rational_spec.rb +12 -12
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/string_spec.rb +12 -12
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/time_spec.rb +16 -16
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/type_options_spec.rb +4 -4
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/wrappers/array_spec.rb +6 -6
- data/lib/ree_lib/version.rb +1 -1
- metadata +17 -24
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/beans/dao_cache.rb +0 -81
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/functions/drop_cache.rb +0 -15
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/functions/extract_changes.rb +0 -26
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/functions/init_cache.rb +0 -15
- data/lib/ree_lib/packages/ree_dao/schemas/ree_dao/beans/dao_cache.schema.json +0 -22
- data/lib/ree_lib/packages/ree_dao/schemas/ree_dao/functions/drop_cache.schema.json +0 -31
- data/lib/ree_lib/packages/ree_dao/schemas/ree_dao/functions/extract_changes.schema.json +0 -45
- data/lib/ree_lib/packages/ree_dao/schemas/ree_dao/functions/init_cache.schema.json +0 -31
@@ -27,24 +27,24 @@ RSpec.describe 'ReeMapper::DateTime' do
|
|
27
27
|
}
|
28
28
|
|
29
29
|
it {
|
30
|
-
expect { mapper.serialize({ date_time: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
30
|
+
expect { mapper.serialize({ date_time: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{Regexp.quote(Time.new(2020).inspect)}`/)
|
31
31
|
}
|
32
32
|
|
33
33
|
it {
|
34
|
-
expect { mapper.serialize({ date_time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
34
|
+
expect { mapper.serialize({ date_time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{Regexp.quote(Date.new(2020).inspect)}`/)
|
35
35
|
}
|
36
36
|
|
37
37
|
it {
|
38
|
-
expect { mapper.serialize({ date_time: DateTime.new(2020).to_s }) }.to raise_error(ReeMapper::TypeError,
|
38
|
+
expect { mapper.serialize({ date_time: DateTime.new(2020).to_s }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `\"#{Regexp.quote(DateTime.new(2020).to_s)}\"`/)
|
39
39
|
}
|
40
40
|
|
41
41
|
it {
|
42
|
-
expect { mapper.serialize({ date_time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError,
|
42
|
+
expect { mapper.serialize({ date_time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `\"2020-01-01\"`/)
|
43
43
|
}
|
44
44
|
|
45
45
|
it {
|
46
46
|
object = Object.new
|
47
|
-
expect { mapper.serialize({ date_time: object }) }.to raise_error(ReeMapper::TypeError,
|
47
|
+
expect { mapper.serialize({ date_time: object }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{object.inspect}`/)
|
48
48
|
}
|
49
49
|
end
|
50
50
|
|
@@ -66,16 +66,16 @@ RSpec.describe 'ReeMapper::DateTime' do
|
|
66
66
|
}
|
67
67
|
|
68
68
|
it {
|
69
|
-
expect { mapper.cast({ 'date_time' => Date.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
69
|
+
expect { mapper.cast({ 'date_time' => Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{Regexp.quote(Date.new(2020).inspect)}`/)
|
70
70
|
}
|
71
71
|
|
72
72
|
it {
|
73
73
|
object = Object.new
|
74
|
-
expect { mapper.cast({ 'date_time' => object }) }.to raise_error(ReeMapper::TypeError,
|
74
|
+
expect { mapper.cast({ 'date_time' => object }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{object.inspect}`/)
|
75
75
|
}
|
76
76
|
|
77
77
|
it {
|
78
|
-
expect { mapper.cast({ 'date_time' => 'no date time' }) }.to raise_error(ReeMapper::CoercionError,
|
78
|
+
expect { mapper.cast({ 'date_time' => 'no date time' }) }.to raise_error(ReeMapper::CoercionError, /`date_time` is invalid datetime, got `\"no date time\"`/)
|
79
79
|
}
|
80
80
|
end
|
81
81
|
|
@@ -85,24 +85,24 @@ RSpec.describe 'ReeMapper::DateTime' do
|
|
85
85
|
}
|
86
86
|
|
87
87
|
it {
|
88
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
88
|
+
expect { mapper.db_dump OpenStruct.new({ date_time: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{Regexp.quote(Time.new(2020).inspect)}`/)
|
89
89
|
}
|
90
90
|
|
91
91
|
it {
|
92
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
92
|
+
expect { mapper.db_dump OpenStruct.new({ date_time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{Regexp.quote(Date.new(2020).inspect)}`/)
|
93
93
|
}
|
94
94
|
|
95
95
|
it {
|
96
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: DateTime.new(2020).to_s }) }.to raise_error(ReeMapper::TypeError,
|
96
|
+
expect { mapper.db_dump OpenStruct.new({ date_time: DateTime.new(2020).to_s }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `\"#{Regexp.quote(DateTime.new(2020).to_s)}\"`/)
|
97
97
|
}
|
98
98
|
|
99
99
|
it {
|
100
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError,
|
100
|
+
expect { mapper.db_dump OpenStruct.new({ date_time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `\"2020-01-01\"`/)
|
101
101
|
}
|
102
102
|
|
103
103
|
it {
|
104
104
|
object = Object.new
|
105
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: object }) }.to raise_error(ReeMapper::TypeError,
|
105
|
+
expect { mapper.db_dump OpenStruct.new({ date_time: object }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{object.inspect}`/)
|
106
106
|
}
|
107
107
|
end
|
108
108
|
|
@@ -124,16 +124,16 @@ RSpec.describe 'ReeMapper::DateTime' do
|
|
124
124
|
}
|
125
125
|
|
126
126
|
it {
|
127
|
-
expect { mapper.db_load({ 'date_time' => Date.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
127
|
+
expect { mapper.db_load({ 'date_time' => Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{Regexp.quote(Date.new(2020).inspect)}`/)
|
128
128
|
}
|
129
129
|
|
130
130
|
it {
|
131
131
|
object = Object.new
|
132
|
-
expect { mapper.db_load({ 'date_time' => object }) }.to raise_error(ReeMapper::TypeError,
|
132
|
+
expect { mapper.db_load({ 'date_time' => object }) }.to raise_error(ReeMapper::TypeError, /`date_time` should be a datetime, got `#{object.inspect}`/)
|
133
133
|
}
|
134
134
|
|
135
135
|
it {
|
136
|
-
expect { mapper.db_load({ 'date_time' => 'no date time' }) }.to raise_error(ReeMapper::CoercionError,
|
136
|
+
expect { mapper.db_load({ 'date_time' => 'no date time' }) }.to raise_error(ReeMapper::CoercionError, /`date_time` is invalid datetime, got `\"no date time\"`/)
|
137
137
|
}
|
138
138
|
end
|
139
139
|
end
|
@@ -40,16 +40,16 @@ RSpec.describe 'ReeMapper::Float' do
|
|
40
40
|
}
|
41
41
|
|
42
42
|
it {
|
43
|
-
expect { mapper.cast({ float: 'a1.1' }) }.to raise_error(ReeMapper::CoercionError,
|
43
|
+
expect { mapper.cast({ float: 'a1.1' }) }.to raise_error(ReeMapper::CoercionError, /`float` is invalid float, got `"a1.1"`/)
|
44
44
|
}
|
45
45
|
|
46
46
|
it {
|
47
|
-
expect { mapper.cast({ float: '1.1a' }) }.to raise_error(ReeMapper::CoercionError,
|
47
|
+
expect { mapper.cast({ float: '1.1a' }) }.to raise_error(ReeMapper::CoercionError, /`float` is invalid float, got `"1.1a"`/)
|
48
48
|
}
|
49
49
|
|
50
50
|
it {
|
51
51
|
object = Object.new
|
52
|
-
expect { mapper.cast({ float: object }) }.to raise_error(ReeMapper::TypeError,
|
52
|
+
expect { mapper.cast({ float: object }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `#{object.inspect}`/)
|
53
53
|
}
|
54
54
|
end
|
55
55
|
|
@@ -59,16 +59,16 @@ RSpec.describe 'ReeMapper::Float' do
|
|
59
59
|
}
|
60
60
|
|
61
61
|
it {
|
62
|
-
expect { mapper.serialize({ float: '1.1' }) }.to raise_error(ReeMapper::TypeError,
|
62
|
+
expect { mapper.serialize({ float: '1.1' }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `\"1.1\"`/)
|
63
63
|
}
|
64
64
|
|
65
65
|
it {
|
66
|
-
expect { mapper.serialize({ float: nil }) }.to raise_error(ReeMapper::TypeError,
|
66
|
+
expect { mapper.serialize({ float: nil }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `nil`/)
|
67
67
|
}
|
68
68
|
|
69
69
|
it {
|
70
70
|
object = Object.new
|
71
|
-
expect { mapper.serialize({ float: object }) }.to raise_error(ReeMapper::TypeError,
|
71
|
+
expect { mapper.serialize({ float: object }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `#{object.inspect}`/)
|
72
72
|
}
|
73
73
|
end
|
74
74
|
|
@@ -78,16 +78,16 @@ RSpec.describe 'ReeMapper::Float' do
|
|
78
78
|
}
|
79
79
|
|
80
80
|
it {
|
81
|
-
expect { mapper.db_dump({ float: '1.1' }) }.to raise_error(ReeMapper::TypeError,
|
81
|
+
expect { mapper.db_dump({ float: '1.1' }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `\"1.1\"`/)
|
82
82
|
}
|
83
83
|
|
84
84
|
it {
|
85
|
-
expect { mapper.db_dump({ float: nil }) }.to raise_error(ReeMapper::TypeError,
|
85
|
+
expect { mapper.db_dump({ float: nil }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `nil`/)
|
86
86
|
}
|
87
87
|
|
88
88
|
it {
|
89
89
|
object = Object.new
|
90
|
-
expect { mapper.db_dump({ float: object }) }.to raise_error(ReeMapper::TypeError,
|
90
|
+
expect { mapper.db_dump({ float: object }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `#{object.inspect}`/)
|
91
91
|
}
|
92
92
|
end
|
93
93
|
|
@@ -109,20 +109,20 @@ RSpec.describe 'ReeMapper::Float' do
|
|
109
109
|
}
|
110
110
|
|
111
111
|
it {
|
112
|
-
expect { mapper.db_load({ float: 'a1.1' }) }.to raise_error(ReeMapper::CoercionError,
|
112
|
+
expect { mapper.db_load({ float: 'a1.1' }) }.to raise_error(ReeMapper::CoercionError, /`float` is invalid float, got `"a1.1"`/)
|
113
113
|
}
|
114
114
|
|
115
115
|
it {
|
116
|
-
expect { mapper.db_load({ float: '1.1a' }) }.to raise_error(ReeMapper::CoercionError,
|
116
|
+
expect { mapper.db_load({ float: '1.1a' }) }.to raise_error(ReeMapper::CoercionError, /`float` is invalid float, got `"1.1a"`/)
|
117
117
|
}
|
118
118
|
|
119
119
|
it {
|
120
|
-
expect { mapper.db_load({ float: nil }) }.to raise_error(ReeMapper::TypeError,
|
120
|
+
expect { mapper.db_load({ float: nil }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `nil`/)
|
121
121
|
}
|
122
122
|
|
123
123
|
it {
|
124
124
|
object = Object.new
|
125
|
-
expect { mapper.db_load({ float: object }) }.to raise_error(ReeMapper::TypeError,
|
125
|
+
expect { mapper.db_load({ float: object }) }.to raise_error(ReeMapper::TypeError, /`float` should be a float, got `#{object.inspect}`/)
|
126
126
|
}
|
127
127
|
end
|
128
128
|
end
|
@@ -27,11 +27,11 @@ RSpec.describe 'Mapper Hash' do
|
|
27
27
|
}
|
28
28
|
|
29
29
|
it {
|
30
|
-
expect { mapper.cast({ point: 1 }) }.to raise_error(ReeMapper::TypeError,
|
30
|
+
expect { mapper.cast({ point: 1 }) }.to raise_error(ReeMapper::TypeError, /Missing required field `x` for `point`/)
|
31
31
|
}
|
32
32
|
|
33
33
|
it {
|
34
|
-
expect { mapper.cast({ point: { x: 1, y: 'not integer' } }) }.to raise_error(ReeMapper::CoercionError,
|
34
|
+
expect { mapper.cast({ point: { x: 1, y: 'not integer' } }) }.to raise_error(ReeMapper::CoercionError, /`point\[y\]` is invalid integer, got `"not integer"`/)
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
@@ -31,15 +31,15 @@ RSpec.describe 'ReeMapper::Integer' do
|
|
31
31
|
}
|
32
32
|
|
33
33
|
it {
|
34
|
-
expect { mapper.cast({ number: 'b1' }) }.to raise_error(ReeMapper::CoercionError,
|
34
|
+
expect { mapper.cast({ number: 'b1' }) }.to raise_error(ReeMapper::CoercionError, /`number` is invalid integer, got `"b1"`/)
|
35
35
|
}
|
36
36
|
|
37
37
|
it {
|
38
|
-
expect { mapper.cast({ number: '1b' }) }.to raise_error(ReeMapper::CoercionError,
|
38
|
+
expect { mapper.cast({ number: '1b' }) }.to raise_error(ReeMapper::CoercionError, /`number` is invalid integer, got `"1b"`/)
|
39
39
|
}
|
40
40
|
|
41
41
|
it {
|
42
|
-
expect { mapper.cast({ number: 1.1 }) }.to raise_error(ReeMapper::TypeError,
|
42
|
+
expect { mapper.cast({ number: 1.1 }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `1.1`/)
|
43
43
|
}
|
44
44
|
end
|
45
45
|
|
@@ -49,19 +49,19 @@ RSpec.describe 'ReeMapper::Integer' do
|
|
49
49
|
}
|
50
50
|
|
51
51
|
it {
|
52
|
-
expect { mapper.serialize({ number: '1' }) }.to raise_error(ReeMapper::TypeError,
|
52
|
+
expect { mapper.serialize({ number: '1' }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `"1"`/)
|
53
53
|
}
|
54
54
|
|
55
55
|
it {
|
56
|
-
expect { mapper.serialize({ number: 'b1' }) }.to raise_error(ReeMapper::TypeError,
|
56
|
+
expect { mapper.serialize({ number: 'b1' }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `"b1"`/)
|
57
57
|
}
|
58
58
|
|
59
59
|
it {
|
60
|
-
expect { mapper.serialize({ number: '1b' }) }.to raise_error(ReeMapper::TypeError,
|
60
|
+
expect { mapper.serialize({ number: '1b' }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `"1b"`/)
|
61
61
|
}
|
62
62
|
|
63
63
|
it {
|
64
|
-
expect { mapper.serialize({ number: 1.1 }) }.to raise_error(ReeMapper::TypeError,
|
64
|
+
expect { mapper.serialize({ number: 1.1 }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `1.1`/)
|
65
65
|
}
|
66
66
|
end
|
67
67
|
|
@@ -71,19 +71,19 @@ RSpec.describe 'ReeMapper::Integer' do
|
|
71
71
|
}
|
72
72
|
|
73
73
|
it {
|
74
|
-
expect { mapper.db_dump({ number: '1' }) }.to raise_error(ReeMapper::TypeError,
|
74
|
+
expect { mapper.db_dump({ number: '1' }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `"1"`/)
|
75
75
|
}
|
76
76
|
|
77
77
|
it {
|
78
|
-
expect { mapper.db_dump({ number: 'b1' }) }.to raise_error(ReeMapper::TypeError,
|
78
|
+
expect { mapper.db_dump({ number: 'b1' }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `"b1"`/)
|
79
79
|
}
|
80
80
|
|
81
81
|
it {
|
82
|
-
expect { mapper.db_dump({ number: '1b' }) }.to raise_error(ReeMapper::TypeError,
|
82
|
+
expect { mapper.db_dump({ number: '1b' }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `"1b"`/)
|
83
83
|
}
|
84
84
|
|
85
85
|
it {
|
86
|
-
expect { mapper.db_dump({ number: 1.1 }) }.to raise_error(ReeMapper::TypeError,
|
86
|
+
expect { mapper.db_dump({ number: 1.1 }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `1.1`/)
|
87
87
|
}
|
88
88
|
end
|
89
89
|
|
@@ -97,15 +97,15 @@ RSpec.describe 'ReeMapper::Integer' do
|
|
97
97
|
}
|
98
98
|
|
99
99
|
it {
|
100
|
-
expect { mapper.db_load({ number: 'b1' }) }.to raise_error(ReeMapper::CoercionError,
|
100
|
+
expect { mapper.db_load({ number: 'b1' }) }.to raise_error(ReeMapper::CoercionError, /`number` is invalid integer, got `"b1"`/)
|
101
101
|
}
|
102
102
|
|
103
103
|
it {
|
104
|
-
expect { mapper.db_load({ number: '1b' }) }.to raise_error(ReeMapper::CoercionError,
|
104
|
+
expect { mapper.db_load({ number: '1b' }) }.to raise_error(ReeMapper::CoercionError, /`number` is invalid integer, got `"1b"`/)
|
105
105
|
}
|
106
106
|
|
107
107
|
it {
|
108
|
-
expect { mapper.db_load({ number: 1.1 }) }.to raise_error(ReeMapper::TypeError,
|
108
|
+
expect { mapper.db_load({ number: 1.1 }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `1.1`/)
|
109
109
|
}
|
110
110
|
end
|
111
111
|
end
|
@@ -40,16 +40,16 @@ RSpec.describe 'ReeMapper::Rational' do
|
|
40
40
|
}
|
41
41
|
|
42
42
|
it {
|
43
|
-
expect { mapper.cast({ rational: 'a333' }) }.to raise_error(ReeMapper::CoercionError,
|
43
|
+
expect { mapper.cast({ rational: 'a333' }) }.to raise_error(ReeMapper::CoercionError, /`rational` is invalid rational, got `"a333"`/)
|
44
44
|
}
|
45
45
|
|
46
46
|
it {
|
47
|
-
expect { mapper.cast({ rational: '333a' }) }.to raise_error(ReeMapper::CoercionError,
|
47
|
+
expect { mapper.cast({ rational: '333a' }) }.to raise_error(ReeMapper::CoercionError, /`rational` is invalid rational, got `"333a"`/)
|
48
48
|
}
|
49
49
|
|
50
50
|
it {
|
51
51
|
object = Object.new
|
52
|
-
expect { mapper.cast({ rational: object }) }.to raise_error(ReeMapper::TypeError,
|
52
|
+
expect { mapper.cast({ rational: object }) }.to raise_error(ReeMapper::TypeError, /`rational` should be a rational, got `#{object.inspect}`/)
|
53
53
|
}
|
54
54
|
end
|
55
55
|
|
@@ -59,16 +59,16 @@ RSpec.describe 'ReeMapper::Rational' do
|
|
59
59
|
}
|
60
60
|
|
61
61
|
it {
|
62
|
-
expect { mapper.serialize({ rational: '1/3' }) }.to raise_error(ReeMapper::TypeError,
|
62
|
+
expect { mapper.serialize({ rational: '1/3' }) }.to raise_error(ReeMapper::TypeError, /`rational` should be a rational, got `\"1\/3\"`/)
|
63
63
|
}
|
64
64
|
|
65
65
|
it {
|
66
|
-
expect { mapper.serialize({ rational: nil }) }.to raise_error(ReeMapper::TypeError,
|
66
|
+
expect { mapper.serialize({ rational: nil }) }.to raise_error(ReeMapper::TypeError, /`rational` should be a rational, got `nil`/)
|
67
67
|
}
|
68
68
|
|
69
69
|
it {
|
70
70
|
object = Object.new
|
71
|
-
expect { mapper.serialize({ rational: object }) }.to raise_error(ReeMapper::TypeError,
|
71
|
+
expect { mapper.serialize({ rational: object }) }.to raise_error(ReeMapper::TypeError, /`rational` should be a rational, got `#{object.inspect}`/)
|
72
72
|
}
|
73
73
|
end
|
74
74
|
|
@@ -78,16 +78,16 @@ RSpec.describe 'ReeMapper::Rational' do
|
|
78
78
|
}
|
79
79
|
|
80
80
|
it {
|
81
|
-
expect { mapper.db_dump({ rational: '1/3' }) }.to raise_error(ReeMapper::TypeError,
|
81
|
+
expect { mapper.db_dump({ rational: '1/3' }) }.to raise_error(ReeMapper::TypeError, /`rational` should be a rational, got `\"1\/3\"`/)
|
82
82
|
}
|
83
83
|
|
84
84
|
it {
|
85
|
-
expect { mapper.db_dump({ rational: nil }) }.to raise_error(ReeMapper::TypeError,
|
85
|
+
expect { mapper.db_dump({ rational: nil }) }.to raise_error(ReeMapper::TypeError, /`rational` should be a rational, got `nil`/)
|
86
86
|
}
|
87
87
|
|
88
88
|
it {
|
89
89
|
object = Object.new
|
90
|
-
expect { mapper.db_dump({ rational: object }) }.to raise_error(ReeMapper::TypeError,
|
90
|
+
expect { mapper.db_dump({ rational: object }) }.to raise_error(ReeMapper::TypeError, /`rational` should be a rational, got `#{object.inspect}`/)
|
91
91
|
}
|
92
92
|
end
|
93
93
|
|
@@ -109,16 +109,16 @@ RSpec.describe 'ReeMapper::Rational' do
|
|
109
109
|
}
|
110
110
|
|
111
111
|
it {
|
112
|
-
expect { mapper.db_load({ rational: 'a333' }) }.to raise_error(ReeMapper::CoercionError,
|
112
|
+
expect { mapper.db_load({ rational: 'a333' }) }.to raise_error(ReeMapper::CoercionError, /`rational` is invalid rational, got `"a333"`/)
|
113
113
|
}
|
114
114
|
|
115
115
|
it {
|
116
|
-
expect { mapper.db_load({ rational: '333a' }) }.to raise_error(ReeMapper::CoercionError,
|
116
|
+
expect { mapper.db_load({ rational: '333a' }) }.to raise_error(ReeMapper::CoercionError, /`rational` is invalid rational, got `"333a"`/)
|
117
117
|
}
|
118
118
|
|
119
119
|
it {
|
120
120
|
object = Object.new
|
121
|
-
expect { mapper.db_load({ rational: object }) }.to raise_error(ReeMapper::TypeError,
|
121
|
+
expect { mapper.db_load({ rational: object }) }.to raise_error(ReeMapper::TypeError, /`rational` should be a rational, got `#{object.inspect}`/)
|
122
122
|
}
|
123
123
|
end
|
124
124
|
end
|
@@ -24,52 +24,52 @@ RSpec.describe 'ReeMapper::String' do
|
|
24
24
|
describe '#serialize' do
|
25
25
|
it { expect(mapper.serialize({ str: 'str' })).to eq({ str: 'str' }) }
|
26
26
|
|
27
|
-
it { expect { mapper.serialize({ str: nil }) }.to raise_error(ReeMapper::TypeError,
|
27
|
+
it { expect { mapper.serialize({ str: nil }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `nil`/) }
|
28
28
|
|
29
|
-
it { expect { mapper.serialize({ str: :sym }) }.to raise_error(ReeMapper::TypeError,
|
29
|
+
it { expect { mapper.serialize({ str: :sym }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `:sym`/) }
|
30
30
|
|
31
31
|
it {
|
32
32
|
object = Object.new
|
33
|
-
expect { mapper.serialize({ str: object }) }.to raise_error(ReeMapper::TypeError,
|
33
|
+
expect { mapper.serialize({ str: object }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `#{object.inspect}`/)
|
34
34
|
}
|
35
35
|
end
|
36
36
|
|
37
37
|
describe '#cast' do
|
38
38
|
it { expect(mapper.cast({ str: 'str' })).to eq({ str: 'str' }) }
|
39
39
|
|
40
|
-
it { expect { mapper.cast({ str: nil }) }.to raise_error(ReeMapper::TypeError,
|
40
|
+
it { expect { mapper.cast({ str: nil }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `nil`/) }
|
41
41
|
|
42
|
-
it { expect { mapper.cast({ str: :sym }) }.to raise_error(ReeMapper::TypeError,
|
42
|
+
it { expect { mapper.cast({ str: :sym }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `:sym`/) }
|
43
43
|
|
44
44
|
it {
|
45
45
|
object = Object.new
|
46
|
-
expect { mapper.cast({ str: object }) }.to raise_error(ReeMapper::TypeError,
|
46
|
+
expect { mapper.cast({ str: object }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `#{object.inspect}`/)
|
47
47
|
}
|
48
48
|
end
|
49
49
|
|
50
50
|
describe '#db_dump' do
|
51
51
|
it { expect(mapper.db_dump({ str: 'str' })).to eq({ str: 'str' }) }
|
52
52
|
|
53
|
-
it { expect { mapper.db_dump({ str: nil }) }.to raise_error(ReeMapper::TypeError,
|
53
|
+
it { expect { mapper.db_dump({ str: nil }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `nil`/) }
|
54
54
|
|
55
|
-
it { expect { mapper.db_dump({ str: :sym }) }.to raise_error(ReeMapper::TypeError,
|
55
|
+
it { expect { mapper.db_dump({ str: :sym }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `:sym`/) }
|
56
56
|
|
57
57
|
it {
|
58
58
|
object = Object.new
|
59
|
-
expect { mapper.db_dump({ str: object }) }.to raise_error(ReeMapper::TypeError,
|
59
|
+
expect { mapper.db_dump({ str: object }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `#{object.inspect}`/)
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
63
63
|
describe '#db_load' do
|
64
64
|
it { expect(mapper.db_load({ str: 'str' })).to eq({ str: 'str' }) }
|
65
65
|
|
66
|
-
it { expect { mapper.db_load({ str: nil }) }.to raise_error(ReeMapper::TypeError,
|
66
|
+
it { expect { mapper.db_load({ str: nil }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `nil`/) }
|
67
67
|
|
68
|
-
it { expect { mapper.db_load({ str: :sym }) }.to raise_error(ReeMapper::TypeError,
|
68
|
+
it { expect { mapper.db_load({ str: :sym }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `:sym`/) }
|
69
69
|
|
70
70
|
it {
|
71
71
|
object = Object.new
|
72
|
-
expect { mapper.db_load({ str: object }) }.to raise_error(ReeMapper::TypeError,
|
72
|
+
expect { mapper.db_load({ str: object }) }.to raise_error(ReeMapper::TypeError, /`str` should be a string, got `#{object.inspect}`/)
|
73
73
|
}
|
74
74
|
end
|
75
75
|
end
|
@@ -27,24 +27,24 @@ RSpec.describe 'ReeMapper::Time' do
|
|
27
27
|
}
|
28
28
|
|
29
29
|
it {
|
30
|
-
expect { mapper.serialize({ time: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
30
|
+
expect { mapper.serialize({ time: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{Regexp.quote(DateTime.new(2020).inspect)}`/)
|
31
31
|
}
|
32
32
|
|
33
33
|
it {
|
34
|
-
expect { mapper.serialize({ time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
34
|
+
expect { mapper.serialize({ time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{Regexp.quote(Date.new(2020).inspect)}`/)
|
35
35
|
}
|
36
36
|
|
37
37
|
it {
|
38
|
-
expect { mapper.serialize({ time: DateTime.new(2020).to_s }) }.to raise_error(ReeMapper::TypeError,
|
38
|
+
expect { mapper.serialize({ time: DateTime.new(2020).to_s }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `"2020-01-01T00:00:00\+00:00"`/)
|
39
39
|
}
|
40
40
|
|
41
41
|
it {
|
42
|
-
expect { mapper.serialize({ time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError,
|
42
|
+
expect { mapper.serialize({ time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `\"2020-01-01\"`/)
|
43
43
|
}
|
44
44
|
|
45
45
|
it {
|
46
46
|
object = Object.new
|
47
|
-
expect { mapper.serialize({ time: object }) }.to raise_error(ReeMapper::TypeError,
|
47
|
+
expect { mapper.serialize({ time: object }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{object.inspect}`/)
|
48
48
|
}
|
49
49
|
end
|
50
50
|
|
@@ -66,16 +66,16 @@ RSpec.describe 'ReeMapper::Time' do
|
|
66
66
|
}
|
67
67
|
|
68
68
|
it {
|
69
|
-
expect { mapper.cast({ time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
69
|
+
expect { mapper.cast({ time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{Regexp.quote(Date.new(2020).inspect)}`/)
|
70
70
|
}
|
71
71
|
|
72
72
|
it {
|
73
73
|
object = Object.new
|
74
|
-
expect { mapper.cast({ time: object }) }.to raise_error(ReeMapper::TypeError,
|
74
|
+
expect { mapper.cast({ time: object }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{object.inspect}`/)
|
75
75
|
}
|
76
76
|
|
77
77
|
it {
|
78
|
-
expect { mapper.cast({ time: 'no date time' }) }.to raise_error(ReeMapper::CoercionError,
|
78
|
+
expect { mapper.cast({ time: 'no date time' }) }.to raise_error(ReeMapper::CoercionError, /`time` is invalid time, got `\"no date time\"`/)
|
79
79
|
}
|
80
80
|
end
|
81
81
|
|
@@ -85,25 +85,25 @@ RSpec.describe 'ReeMapper::Time' do
|
|
85
85
|
}
|
86
86
|
|
87
87
|
it {
|
88
|
-
expect { mapper.serialize({ time: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
88
|
+
expect { mapper.serialize({ time: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{Regexp.quote(DateTime.new(2020).inspect)}`/)
|
89
89
|
}
|
90
90
|
|
91
91
|
it {
|
92
|
-
expect { mapper.db_dump({ time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
92
|
+
expect { mapper.db_dump({ time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{Regexp.quote(Date.new(2020).inspect)}`/)
|
93
93
|
}
|
94
94
|
|
95
95
|
it {
|
96
96
|
time = Time.new(2020).to_s
|
97
|
-
expect { mapper.db_dump({ time: time }) }.to raise_error(ReeMapper::TypeError,
|
97
|
+
expect { mapper.db_dump({ time: time }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{Regexp.quote(time.inspect)}`/)
|
98
98
|
}
|
99
99
|
|
100
100
|
it {
|
101
|
-
expect { mapper.db_dump({ time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError,
|
101
|
+
expect { mapper.db_dump({ time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `\"2020-01-01\"`/)
|
102
102
|
}
|
103
103
|
|
104
104
|
it {
|
105
105
|
object = Object.new
|
106
|
-
expect { mapper.db_dump({ time: object }) }.to raise_error(ReeMapper::TypeError,
|
106
|
+
expect { mapper.db_dump({ time: object }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{object.inspect}`/)
|
107
107
|
}
|
108
108
|
end
|
109
109
|
|
@@ -125,16 +125,16 @@ RSpec.describe 'ReeMapper::Time' do
|
|
125
125
|
}
|
126
126
|
|
127
127
|
it {
|
128
|
-
expect { mapper.db_load({ time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError,
|
128
|
+
expect { mapper.db_load({ time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{Regexp.quote(Date.new(2020).inspect)}`/)
|
129
129
|
}
|
130
130
|
|
131
131
|
it {
|
132
132
|
object = Object.new
|
133
|
-
expect { mapper.db_load({ time: object }) }.to raise_error(ReeMapper::TypeError,
|
133
|
+
expect { mapper.db_load({ time: object }) }.to raise_error(ReeMapper::TypeError, /`time` should be a time, got `#{object.inspect}`/)
|
134
134
|
}
|
135
135
|
|
136
136
|
it {
|
137
|
-
expect { mapper.db_load({ time: 'no date time' }) }.to raise_error(ReeMapper::CoercionError,
|
137
|
+
expect { mapper.db_load({ time: 'no date time' }) }.to raise_error(ReeMapper::CoercionError, /`time` is invalid time, got `\"no date time\"`/)
|
138
138
|
}
|
139
139
|
end
|
140
140
|
end
|
@@ -193,7 +193,7 @@ RSpec.describe 'ReeMapper::MapperFactory type options' do
|
|
193
193
|
}
|
194
194
|
|
195
195
|
it {
|
196
|
-
expect { mapper.cast({}) }.to raise_error(ReeMapper::TypeError,
|
196
|
+
expect { mapper.cast({}) }.to raise_error(ReeMapper::TypeError, /Missing required field `number` for `root`/)
|
197
197
|
}
|
198
198
|
|
199
199
|
it {
|
@@ -226,7 +226,7 @@ RSpec.describe 'ReeMapper::MapperFactory type options' do
|
|
226
226
|
}
|
227
227
|
|
228
228
|
it {
|
229
|
-
expect { mapper.cast({ number: nil, number_or_nil: 1 }) }.to raise_error(ReeMapper::TypeError,
|
229
|
+
expect { mapper.cast({ number: nil, number_or_nil: 1 }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `nil`/)
|
230
230
|
}
|
231
231
|
end
|
232
232
|
|
@@ -306,7 +306,7 @@ RSpec.describe 'ReeMapper::MapperFactory type options' do
|
|
306
306
|
}
|
307
307
|
|
308
308
|
it {
|
309
|
-
expect { mapper.cast({ number: nil }) }.to raise_error(ReeMapper::TypeError,
|
309
|
+
expect { mapper.cast({ number: nil }) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `nil`/)
|
310
310
|
}
|
311
311
|
|
312
312
|
it {
|
@@ -319,7 +319,7 @@ RSpec.describe 'ReeMapper::MapperFactory type options' do
|
|
319
319
|
let(:mapper) { mapper_factory.call.use(:cast) { integer? :number, default: :not_number } }
|
320
320
|
|
321
321
|
it {
|
322
|
-
expect { mapper.cast({}) }.to raise_error(ReeMapper::TypeError,
|
322
|
+
expect { mapper.cast({}) }.to raise_error(ReeMapper::TypeError, /`number` should be an integer, got `:not_number`/)
|
323
323
|
}
|
324
324
|
end
|
325
325
|
end
|
@@ -28,15 +28,15 @@ RSpec.describe 'ReeMapper::Array' do
|
|
28
28
|
}
|
29
29
|
|
30
30
|
it {
|
31
|
-
expect { mapper.serialize({ tags: 1 }) }.to raise_error(ReeMapper::TypeError,
|
31
|
+
expect { mapper.serialize({ tags: 1 }) }.to raise_error(ReeMapper::TypeError, /`tags` should be an array, got `1`/)
|
32
32
|
}
|
33
33
|
|
34
34
|
it {
|
35
|
-
expect { mapper.serialize({tags: [1], ary_of_ary: ["1"] }) }.to raise_error(ReeMapper::TypeError,
|
35
|
+
expect { mapper.serialize({tags: [1], ary_of_ary: ["1"] }) }.to raise_error(ReeMapper::TypeError, /`ary_of_ary\[0\]` should be an array, got `\"1\"`/)
|
36
36
|
}
|
37
37
|
|
38
38
|
it {
|
39
|
-
expect { mapper.serialize({tags: [1], ary_of_ary: [[1, "1"]] }) }.to raise_error(ReeMapper::TypeError,
|
39
|
+
expect { mapper.serialize({tags: [1], ary_of_ary: [[1, "1"]] }) }.to raise_error(ReeMapper::TypeError, /`ary_of_ary\[0\]\[1\]` should be an integer, got `\"1\"`/)
|
40
40
|
}
|
41
41
|
end
|
42
42
|
|
@@ -46,7 +46,7 @@ RSpec.describe 'ReeMapper::Array' do
|
|
46
46
|
}
|
47
47
|
|
48
48
|
it {
|
49
|
-
expect { mapper.cast({ 'tags' => 1 }) }.to raise_error(ReeMapper::TypeError,
|
49
|
+
expect { mapper.cast({ 'tags' => 1 }) }.to raise_error(ReeMapper::TypeError, /`tags` should be an array, got `1`/)
|
50
50
|
}
|
51
51
|
end
|
52
52
|
|
@@ -56,7 +56,7 @@ RSpec.describe 'ReeMapper::Array' do
|
|
56
56
|
}
|
57
57
|
|
58
58
|
it {
|
59
|
-
expect { mapper.db_dump(OpenStruct.new({ tags: 1 })) }.to raise_error(ReeMapper::TypeError,
|
59
|
+
expect { mapper.db_dump(OpenStruct.new({ tags: 1 })) }.to raise_error(ReeMapper::TypeError, /`tags` should be an array, got `1`/)
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
@@ -66,7 +66,7 @@ RSpec.describe 'ReeMapper::Array' do
|
|
66
66
|
}
|
67
67
|
|
68
68
|
it {
|
69
|
-
expect { mapper.db_load({ 'tags' => 1 }) }.to raise_error(ReeMapper::TypeError,
|
69
|
+
expect { mapper.db_load({ 'tags' => 1 }) }.to raise_error(ReeMapper::TypeError, /`tags` should be an array, got `1`/)
|
70
70
|
}
|
71
71
|
end
|
72
72
|
|
data/lib/ree_lib/version.rb
CHANGED