ree_lib 1.0.84 → 1.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -7
- data/lib/ree_lib/packages/ree_actions/package/ree_actions/dsl.rb +11 -3
- data/lib/ree_lib/packages/ree_actions/package/ree_actions/errors.rb +3 -0
- data/lib/ree_lib/packages/ree_actions/package/ree_actions.rb +1 -0
- data/lib/ree_lib/packages/ree_actions/spec/ree_actions/dsl_spec.rb +5 -1
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/association.rb +5 -29
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/functions/agg.rb +4 -28
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/wrappers/pg_array.rb +2 -2
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/wrappers/pg_jsonb.rb +2 -2
- data/lib/ree_lib/packages/ree_dao/package/ree_dao.rb +0 -1
- data/lib/ree_lib/packages/ree_dao/spec/ree_dao/wrappers/pg_array_spec.rb +2 -2
- data/lib/ree_lib/packages/ree_dao/spec/ree_dao/wrappers/pg_jsonb_spec.rb +8 -6
- data/lib/ree_lib/packages/ree_enum/package/ree_enum/base_enum_mapper.rb +1 -6
- data/lib/ree_lib/packages/ree_enum/package/ree_enum/integer_value_enum_mapper.rb +1 -1
- data/lib/ree_lib/packages/ree_enum/package/ree_enum/string_value_enum_mapper.rb +1 -1
- data/lib/ree_lib/packages/ree_enum/spec/ree_enum/dsl_spec.rb +9 -1
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/abstract_type.rb +6 -0
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/bool.rb +2 -2
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/date.rb +3 -3
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/date_time.rb +3 -3
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/float.rb +3 -3
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/integer.rb +6 -6
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/rational.rb +3 -3
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/string.rb +1 -1
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/types/time.rb +3 -3
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/wrappers/abstract_wrapper.rb +7 -0
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/wrappers/array.rb +4 -4
- data/lib/ree_lib/packages/ree_mapper/package/ree_mapper.rb +1 -0
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/mapper_factory_spec.rb +2 -2
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/bool_spec.rb +10 -8
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/date_spec.rb +12 -10
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/date_time_spec.rb +20 -16
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/float_spec.rb +17 -13
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/hash_spec.rb +1 -1
- 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 +16 -12
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/string_spec.rb +24 -12
- data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/time_spec.rb +20 -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/packages/ree_roda/package/ree_roda/app.rb +3 -2
- data/lib/ree_lib/packages/ree_roda/spec/ree_roda/app_spec.rb +28 -0
- data/lib/ree_lib/version.rb +1 -1
- metadata +3 -16
@@ -31,11 +31,11 @@ RSpec.describe 'ReeMapper::Bool' do
|
|
31
31
|
}
|
32
32
|
|
33
33
|
it {
|
34
|
-
expect { mapper.serialize({ bool: 'true' }) }.to raise_error(ReeMapper::TypeError, "`bool` should be a boolean")
|
34
|
+
expect { mapper.serialize({ bool: 'true' }) }.to raise_error(ReeMapper::TypeError, "`bool` should be a boolean, got `\"true\"`")
|
35
35
|
}
|
36
36
|
|
37
37
|
it {
|
38
|
-
expect { mapper.serialize({ bool: 1 }) }.to raise_error(ReeMapper::TypeError, "`bool` should be a boolean")
|
38
|
+
expect { mapper.serialize({ bool: 1 }) }.to raise_error(ReeMapper::TypeError, "`bool` should be a boolean, got `1`")
|
39
39
|
}
|
40
40
|
end
|
41
41
|
|
@@ -81,11 +81,12 @@ RSpec.describe 'ReeMapper::Bool' do
|
|
81
81
|
}
|
82
82
|
|
83
83
|
it {
|
84
|
-
expect { mapper.cast({ 'bool' => 'right' }) }.to raise_error(ReeMapper::CoercionError, "`bool` is invalid boolean")
|
84
|
+
expect { mapper.cast({ 'bool' => 'right' }) }.to raise_error(ReeMapper::CoercionError, "`bool` is invalid boolean, got `\"right\"`")
|
85
85
|
}
|
86
86
|
|
87
87
|
it {
|
88
|
-
|
88
|
+
object = Object.new
|
89
|
+
expect { mapper.cast({ 'bool' => object }) }.to raise_error(ReeMapper::CoercionError, "`bool` is invalid boolean, got `#{object.inspect}`")
|
89
90
|
}
|
90
91
|
end
|
91
92
|
|
@@ -99,11 +100,11 @@ RSpec.describe 'ReeMapper::Bool' do
|
|
99
100
|
}
|
100
101
|
|
101
102
|
it {
|
102
|
-
expect { mapper.db_dump(OpenStruct.new({ bool: 'true' })) }.to raise_error(ReeMapper::TypeError, "`bool` should be a boolean")
|
103
|
+
expect { mapper.db_dump(OpenStruct.new({ bool: 'true' })) }.to raise_error(ReeMapper::TypeError, "`bool` should be a boolean, got `\"true\"`")
|
103
104
|
}
|
104
105
|
|
105
106
|
it {
|
106
|
-
expect { mapper.db_dump(OpenStruct.new({ bool: 1 })) }.to raise_error(ReeMapper::TypeError, "`bool` should be a boolean")
|
107
|
+
expect { mapper.db_dump(OpenStruct.new({ bool: 1 })) }.to raise_error(ReeMapper::TypeError, "`bool` should be a boolean, got `1`")
|
107
108
|
}
|
108
109
|
end
|
109
110
|
|
@@ -149,11 +150,12 @@ RSpec.describe 'ReeMapper::Bool' do
|
|
149
150
|
}
|
150
151
|
|
151
152
|
it {
|
152
|
-
expect { mapper.db_load({ 'bool' => 'right' }) }.to raise_error(ReeMapper::CoercionError, "`bool` is invalid boolean")
|
153
|
+
expect { mapper.db_load({ 'bool' => 'right' }) }.to raise_error(ReeMapper::CoercionError, "`bool` is invalid boolean, got `\"right\"`")
|
153
154
|
}
|
154
155
|
|
155
156
|
it {
|
156
|
-
|
157
|
+
object = Object.new
|
158
|
+
expect { mapper.db_load({ 'bool' => object }) }.to raise_error(ReeMapper::CoercionError, "`bool` is invalid boolean, got `#{object.inspect}`")
|
157
159
|
}
|
158
160
|
end
|
159
161
|
end
|
@@ -27,19 +27,20 @@ RSpec.describe 'ReeMapper::Date' do
|
|
27
27
|
}
|
28
28
|
|
29
29
|
it {
|
30
|
-
expect { mapper.serialize({ date: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date")
|
30
|
+
expect { mapper.serialize({ date: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date, got `#{DateTime.new(2020).inspect}`")
|
31
31
|
}
|
32
32
|
|
33
33
|
it {
|
34
|
-
expect { mapper.serialize({ date: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date")
|
34
|
+
expect { mapper.serialize({ date: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date, got `#{Time.new(2020).inspect}`")
|
35
35
|
}
|
36
36
|
|
37
37
|
it {
|
38
|
-
expect { mapper.serialize({ date: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date")
|
38
|
+
expect { mapper.serialize({ date: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date, got `\"2020-01-01\"`")
|
39
39
|
}
|
40
40
|
|
41
41
|
it {
|
42
|
-
|
42
|
+
object = Object.new
|
43
|
+
expect { mapper.serialize({ date: object }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date, got `#{object.inspect}`")
|
43
44
|
}
|
44
45
|
end
|
45
46
|
|
@@ -61,7 +62,7 @@ RSpec.describe 'ReeMapper::Date' do
|
|
61
62
|
}
|
62
63
|
|
63
64
|
it {
|
64
|
-
expect { mapper.cast({ 'date' => 'no date' }) }.to raise_error(ReeMapper::CoercionError, "`date` is invalid date")
|
65
|
+
expect { mapper.cast({ 'date' => 'no date' }) }.to raise_error(ReeMapper::CoercionError, "`date` is invalid date, got `\"no date\"`")
|
65
66
|
}
|
66
67
|
end
|
67
68
|
|
@@ -83,7 +84,7 @@ RSpec.describe 'ReeMapper::Date' do
|
|
83
84
|
}
|
84
85
|
|
85
86
|
it {
|
86
|
-
expect { mapper.db_load({ 'date' => 'no date' }) }.to raise_error(ReeMapper::CoercionError, "`date` is invalid date")
|
87
|
+
expect { mapper.db_load({ 'date' => 'no date' }) }.to raise_error(ReeMapper::CoercionError, "`date` is invalid date, got `\"no date\"`")
|
87
88
|
}
|
88
89
|
end
|
89
90
|
|
@@ -93,19 +94,20 @@ RSpec.describe 'ReeMapper::Date' do
|
|
93
94
|
}
|
94
95
|
|
95
96
|
it {
|
96
|
-
expect { mapper.db_dump OpenStruct.new({ date: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date")
|
97
|
+
expect { mapper.db_dump OpenStruct.new({ date: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date, got `#{DateTime.new(2020).inspect}`")
|
97
98
|
}
|
98
99
|
|
99
100
|
it {
|
100
|
-
expect { mapper.db_dump OpenStruct.new({ date: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date")
|
101
|
+
expect { mapper.db_dump OpenStruct.new({ date: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date, got `#{Time.new(2020).inspect}`")
|
101
102
|
}
|
102
103
|
|
103
104
|
it {
|
104
|
-
expect { mapper.db_dump OpenStruct.new({ date: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date")
|
105
|
+
expect { mapper.db_dump OpenStruct.new({ date: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date, got `\"2020-01-01\"`")
|
105
106
|
}
|
106
107
|
|
107
108
|
it {
|
108
|
-
|
109
|
+
object = Object.new
|
110
|
+
expect { mapper.db_dump OpenStruct.new({ date: object }) }.to raise_error(ReeMapper::TypeError, "`date` should be a date, got `#{object.inspect}`")
|
109
111
|
}
|
110
112
|
end
|
111
113
|
end
|
@@ -27,23 +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, "`date_time` should be a datetime")
|
30
|
+
expect { mapper.serialize({ date_time: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{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, "`date_time` should be a datetime")
|
34
|
+
expect { mapper.serialize({ date_time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{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, "`date_time` should be a datetime")
|
38
|
+
expect { mapper.serialize({ date_time: DateTime.new(2020).to_s }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `\"#{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, "`date_time` should be a datetime")
|
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, "`date_time` should be a datetime, got `#{object.inspect}`")
|
47
48
|
}
|
48
49
|
end
|
49
50
|
|
@@ -65,15 +66,16 @@ RSpec.describe 'ReeMapper::DateTime' do
|
|
65
66
|
}
|
66
67
|
|
67
68
|
it {
|
68
|
-
expect { mapper.cast({ 'date_time' => Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime")
|
69
|
+
expect { mapper.cast({ 'date_time' => Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{Date.new(2020).inspect}`")
|
69
70
|
}
|
70
71
|
|
71
72
|
it {
|
72
|
-
|
73
|
+
object = Object.new
|
74
|
+
expect { mapper.cast({ 'date_time' => object }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{object.inspect}`")
|
73
75
|
}
|
74
76
|
|
75
77
|
it {
|
76
|
-
expect { mapper.cast({ 'date_time' => 'no date time' }) }.to raise_error(ReeMapper::CoercionError, "`date_time` is invalid datetime")
|
78
|
+
expect { mapper.cast({ 'date_time' => 'no date time' }) }.to raise_error(ReeMapper::CoercionError, "`date_time` is invalid datetime, got `\"no date time\"`")
|
77
79
|
}
|
78
80
|
end
|
79
81
|
|
@@ -83,23 +85,24 @@ RSpec.describe 'ReeMapper::DateTime' do
|
|
83
85
|
}
|
84
86
|
|
85
87
|
it {
|
86
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime")
|
88
|
+
expect { mapper.db_dump OpenStruct.new({ date_time: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{Time.new(2020).inspect}`")
|
87
89
|
}
|
88
90
|
|
89
91
|
it {
|
90
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime")
|
92
|
+
expect { mapper.db_dump OpenStruct.new({ date_time: Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{Date.new(2020).inspect}`")
|
91
93
|
}
|
92
94
|
|
93
95
|
it {
|
94
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: DateTime.new(2020).to_s }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime")
|
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 `\"#{DateTime.new(2020).to_s}\"`")
|
95
97
|
}
|
96
98
|
|
97
99
|
it {
|
98
|
-
expect { mapper.db_dump OpenStruct.new({ date_time: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime")
|
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\"`")
|
99
101
|
}
|
100
102
|
|
101
103
|
it {
|
102
|
-
|
104
|
+
object = Object.new
|
105
|
+
expect { mapper.db_dump OpenStruct.new({ date_time: object }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{object.inspect}`")
|
103
106
|
}
|
104
107
|
end
|
105
108
|
|
@@ -121,15 +124,16 @@ RSpec.describe 'ReeMapper::DateTime' do
|
|
121
124
|
}
|
122
125
|
|
123
126
|
it {
|
124
|
-
expect { mapper.db_load({ 'date_time' => Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime")
|
127
|
+
expect { mapper.db_load({ 'date_time' => Date.new(2020) }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{Date.new(2020).inspect}`")
|
125
128
|
}
|
126
129
|
|
127
130
|
it {
|
128
|
-
|
131
|
+
object = Object.new
|
132
|
+
expect { mapper.db_load({ 'date_time' => object }) }.to raise_error(ReeMapper::TypeError, "`date_time` should be a datetime, got `#{object.inspect}`")
|
129
133
|
}
|
130
134
|
|
131
135
|
it {
|
132
|
-
expect { mapper.db_load({ 'date_time' => 'no date time' }) }.to raise_error(ReeMapper::CoercionError, "`date_time` is invalid datetime")
|
136
|
+
expect { mapper.db_load({ 'date_time' => 'no date time' }) }.to raise_error(ReeMapper::CoercionError, "`date_time` is invalid datetime, got `\"no date time\"`")
|
133
137
|
}
|
134
138
|
end
|
135
139
|
end
|
@@ -40,15 +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, '`float` is invalid float')
|
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, '`float` is invalid float')
|
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, "`float` should be a float, got `#{object.inspect}`")
|
52
53
|
}
|
53
54
|
end
|
54
55
|
|
@@ -58,15 +59,16 @@ RSpec.describe 'ReeMapper::Float' do
|
|
58
59
|
}
|
59
60
|
|
60
61
|
it {
|
61
|
-
expect { mapper.serialize({ float: '1.1' }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float")
|
62
|
+
expect { mapper.serialize({ float: '1.1' }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float, got `\"1.1\"`")
|
62
63
|
}
|
63
64
|
|
64
65
|
it {
|
65
|
-
expect { mapper.serialize({ float: nil }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float")
|
66
|
+
expect { mapper.serialize({ float: nil }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float, got `nil`")
|
66
67
|
}
|
67
68
|
|
68
69
|
it {
|
69
|
-
|
70
|
+
object = Object.new
|
71
|
+
expect { mapper.serialize({ float: object }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float, got `#{object.inspect}`")
|
70
72
|
}
|
71
73
|
end
|
72
74
|
|
@@ -76,15 +78,16 @@ RSpec.describe 'ReeMapper::Float' do
|
|
76
78
|
}
|
77
79
|
|
78
80
|
it {
|
79
|
-
expect { mapper.db_dump({ float: '1.1' }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float")
|
81
|
+
expect { mapper.db_dump({ float: '1.1' }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float, got `\"1.1\"`")
|
80
82
|
}
|
81
83
|
|
82
84
|
it {
|
83
|
-
expect { mapper.db_dump({ float: nil }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float")
|
85
|
+
expect { mapper.db_dump({ float: nil }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float, got `nil`")
|
84
86
|
}
|
85
87
|
|
86
88
|
it {
|
87
|
-
|
89
|
+
object = Object.new
|
90
|
+
expect { mapper.db_dump({ float: object }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float, got `#{object.inspect}`")
|
88
91
|
}
|
89
92
|
end
|
90
93
|
|
@@ -106,19 +109,20 @@ RSpec.describe 'ReeMapper::Float' do
|
|
106
109
|
}
|
107
110
|
|
108
111
|
it {
|
109
|
-
expect { mapper.db_load({ float: 'a1.1' }) }.to raise_error(ReeMapper::CoercionError, '`float` is invalid float')
|
112
|
+
expect { mapper.db_load({ float: 'a1.1' }) }.to raise_error(ReeMapper::CoercionError, '`float` is invalid float, got `"a1.1"`')
|
110
113
|
}
|
111
114
|
|
112
115
|
it {
|
113
|
-
expect { mapper.db_load({ float: '1.1a' }) }.to raise_error(ReeMapper::CoercionError, '`float` is invalid float')
|
116
|
+
expect { mapper.db_load({ float: '1.1a' }) }.to raise_error(ReeMapper::CoercionError, '`float` is invalid float, got `"1.1a"`')
|
114
117
|
}
|
115
118
|
|
116
119
|
it {
|
117
|
-
expect { mapper.db_load({ float: nil }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float")
|
120
|
+
expect { mapper.db_load({ float: nil }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float, got `nil`")
|
118
121
|
}
|
119
122
|
|
120
123
|
it {
|
121
|
-
|
124
|
+
object = Object.new
|
125
|
+
expect { mapper.db_load({ float: object }) }.to raise_error(ReeMapper::TypeError, "`float` should be a float, got `#{object.inspect}`")
|
122
126
|
}
|
123
127
|
end
|
124
128
|
end
|
@@ -31,7 +31,7 @@ RSpec.describe 'Mapper Hash' do
|
|
31
31
|
}
|
32
32
|
|
33
33
|
it {
|
34
|
-
expect { mapper.cast({ point: { x: 1, y: 'not integer' } }) }.to raise_error(ReeMapper::CoercionError, '`point[y]` is invalid integer')
|
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, '`number` is invalid integer')
|
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, '`number` is invalid integer')
|
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, '`number` should be an integer')
|
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, '`number` should be an integer')
|
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, '`number` should be an integer')
|
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, '`number` should be an integer')
|
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, '`number` should be an integer')
|
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, '`number` should be an integer')
|
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, '`number` should be an integer')
|
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, '`number` should be an integer')
|
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, '`number` should be an integer')
|
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, '`number` is invalid integer')
|
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, '`number` is invalid integer')
|
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, '`number` should be an integer')
|
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,15 +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, '`rational` is invalid rational')
|
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, '`rational` is invalid rational')
|
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, "`rational` should be a rational, got `#{object.inspect}`")
|
52
53
|
}
|
53
54
|
end
|
54
55
|
|
@@ -58,15 +59,16 @@ RSpec.describe 'ReeMapper::Rational' do
|
|
58
59
|
}
|
59
60
|
|
60
61
|
it {
|
61
|
-
expect { mapper.serialize({ rational: '1/3' }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational")
|
62
|
+
expect { mapper.serialize({ rational: '1/3' }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational, got `\"1/3\"`")
|
62
63
|
}
|
63
64
|
|
64
65
|
it {
|
65
|
-
expect { mapper.serialize({ rational: nil }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational")
|
66
|
+
expect { mapper.serialize({ rational: nil }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational, got `nil`")
|
66
67
|
}
|
67
68
|
|
68
69
|
it {
|
69
|
-
|
70
|
+
object = Object.new
|
71
|
+
expect { mapper.serialize({ rational: object }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational, got `#{object.inspect}`")
|
70
72
|
}
|
71
73
|
end
|
72
74
|
|
@@ -76,15 +78,16 @@ RSpec.describe 'ReeMapper::Rational' do
|
|
76
78
|
}
|
77
79
|
|
78
80
|
it {
|
79
|
-
expect { mapper.db_dump({ rational: '1/3' }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational")
|
81
|
+
expect { mapper.db_dump({ rational: '1/3' }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational, got `\"1/3\"`")
|
80
82
|
}
|
81
83
|
|
82
84
|
it {
|
83
|
-
expect { mapper.db_dump({ rational: nil }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational")
|
85
|
+
expect { mapper.db_dump({ rational: nil }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational, got `nil`")
|
84
86
|
}
|
85
87
|
|
86
88
|
it {
|
87
|
-
|
89
|
+
object = Object.new
|
90
|
+
expect { mapper.db_dump({ rational: object }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational, got `#{object.inspect}`")
|
88
91
|
}
|
89
92
|
end
|
90
93
|
|
@@ -106,15 +109,16 @@ RSpec.describe 'ReeMapper::Rational' do
|
|
106
109
|
}
|
107
110
|
|
108
111
|
it {
|
109
|
-
expect { mapper.db_load({ rational: 'a333' }) }.to raise_error(ReeMapper::CoercionError, '`rational` is invalid rational')
|
112
|
+
expect { mapper.db_load({ rational: 'a333' }) }.to raise_error(ReeMapper::CoercionError, '`rational` is invalid rational, got `"a333"`')
|
110
113
|
}
|
111
114
|
|
112
115
|
it {
|
113
|
-
expect { mapper.db_load({ rational: '333a' }) }.to raise_error(ReeMapper::CoercionError, '`rational` is invalid rational')
|
116
|
+
expect { mapper.db_load({ rational: '333a' }) }.to raise_error(ReeMapper::CoercionError, '`rational` is invalid rational, got `"333a"`')
|
114
117
|
}
|
115
118
|
|
116
119
|
it {
|
117
|
-
|
120
|
+
object = Object.new
|
121
|
+
expect { mapper.db_load({ rational: object }) }.to raise_error(ReeMapper::TypeError, "`rational` should be a rational, got `#{object.inspect}`")
|
118
122
|
}
|
119
123
|
end
|
120
124
|
end
|
@@ -24,40 +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, "`str` should be a string") }
|
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, "`str` should be a string") }
|
29
|
+
it { expect { mapper.serialize({ str: :sym }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `:sym`") }
|
30
30
|
|
31
|
-
it {
|
31
|
+
it {
|
32
|
+
object = Object.new
|
33
|
+
expect { mapper.serialize({ str: object }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `#{object.inspect}`")
|
34
|
+
}
|
32
35
|
end
|
33
36
|
|
34
37
|
describe '#cast' do
|
35
38
|
it { expect(mapper.cast({ str: 'str' })).to eq({ str: 'str' }) }
|
36
39
|
|
37
|
-
it { expect { mapper.cast({ str: nil }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string") }
|
40
|
+
it { expect { mapper.cast({ str: nil }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `nil`") }
|
38
41
|
|
39
|
-
it { expect { mapper.cast({ str: :sym }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string") }
|
42
|
+
it { expect { mapper.cast({ str: :sym }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `:sym`") }
|
40
43
|
|
41
|
-
it {
|
44
|
+
it {
|
45
|
+
object = Object.new
|
46
|
+
expect { mapper.cast({ str: object }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `#{object.inspect}`")
|
47
|
+
}
|
42
48
|
end
|
43
49
|
|
44
50
|
describe '#db_dump' do
|
45
51
|
it { expect(mapper.db_dump({ str: 'str' })).to eq({ str: 'str' }) }
|
46
52
|
|
47
|
-
it { expect { mapper.db_dump({ str: nil }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string") }
|
53
|
+
it { expect { mapper.db_dump({ str: nil }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `nil`") }
|
48
54
|
|
49
|
-
it { expect { mapper.db_dump({ str: :sym }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string") }
|
55
|
+
it { expect { mapper.db_dump({ str: :sym }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `:sym`") }
|
50
56
|
|
51
|
-
it {
|
57
|
+
it {
|
58
|
+
object = Object.new
|
59
|
+
expect { mapper.db_dump({ str: object }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `#{object.inspect}`")
|
60
|
+
}
|
52
61
|
end
|
53
62
|
|
54
63
|
describe '#db_load' do
|
55
64
|
it { expect(mapper.db_load({ str: 'str' })).to eq({ str: 'str' }) }
|
56
65
|
|
57
|
-
it { expect { mapper.db_load({ str: nil }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string") }
|
66
|
+
it { expect { mapper.db_load({ str: nil }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `nil`") }
|
58
67
|
|
59
|
-
it { expect { mapper.db_load({ str: :sym }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string") }
|
68
|
+
it { expect { mapper.db_load({ str: :sym }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `:sym`") }
|
60
69
|
|
61
|
-
it {
|
70
|
+
it {
|
71
|
+
object = Object.new
|
72
|
+
expect { mapper.db_load({ str: object }) }.to raise_error(ReeMapper::TypeError, "`str` should be a string, got `#{object.inspect}`")
|
73
|
+
}
|
62
74
|
end
|
63
75
|
end
|