ree_lib 1.0.87 → 1.0.88

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/ree_lib/packages/ree_http/package/ree_http/functions/execute_request.rb +27 -20
  4. data/lib/ree_lib/packages/ree_http/schemas/ree_http/functions/execute_request.schema.json +8 -0
  5. data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_delete_spec.rb +10 -8
  6. data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_get_spec.rb +79 -18
  7. data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_options_spec.rb +6 -5
  8. data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_patch_spec.rb +8 -4
  9. data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_post_spec.rb +5 -10
  10. data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_put_spec.rb +5 -3
  11. data/lib/ree_lib/packages/ree_mapper/package/ree_mapper/mapper.rb +22 -6
  12. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/benchmarks/mapper_benchmark_spec.rb +31 -0
  13. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/bool_spec.rb +8 -8
  14. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/date_spec.rb +10 -10
  15. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/date_time_spec.rb +16 -16
  16. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/float_spec.rb +13 -13
  17. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/hash_spec.rb +2 -2
  18. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/integer_spec.rb +14 -14
  19. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/rational_spec.rb +12 -12
  20. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/string_spec.rb +12 -12
  21. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/time_spec.rb +16 -16
  22. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/type_options_spec.rb +4 -4
  23. data/lib/ree_lib/packages/ree_mapper/spec/ree_mapper/wrappers/array_spec.rb +6 -6
  24. data/lib/ree_lib/version.rb +1 -1
  25. metadata +3 -2
@@ -27,20 +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, got `#{DateTime.new(2020).inspect}`")
30
+ expect { mapper.serialize({ date: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date` should be a date, got `#{Regexp.quote(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, got `#{Time.new(2020).inspect}`")
34
+ expect { mapper.serialize({ date: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date` should be a date, got `#{Regexp.quote(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, got `\"2020-01-01\"`")
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
+ expect { mapper.serialize({ date: object }) }.to raise_error(ReeMapper::TypeError, /`date` should be a date, got `#{object.inspect}`/)
44
44
  }
45
45
  end
46
46
 
@@ -62,7 +62,7 @@ RSpec.describe 'ReeMapper::Date' do
62
62
  }
63
63
 
64
64
  it {
65
- expect { mapper.cast({ 'date' => 'no date' }) }.to raise_error(ReeMapper::CoercionError, "`date` is invalid date, got `\"no date\"`")
65
+ expect { mapper.cast({ 'date' => 'no date' }) }.to raise_error(ReeMapper::CoercionError, /`date` is invalid date, got `\"no date\"`/)
66
66
  }
67
67
  end
68
68
 
@@ -84,7 +84,7 @@ RSpec.describe 'ReeMapper::Date' do
84
84
  }
85
85
 
86
86
  it {
87
- expect { mapper.db_load({ 'date' => 'no date' }) }.to raise_error(ReeMapper::CoercionError, "`date` is invalid date, got `\"no date\"`")
87
+ expect { mapper.db_load({ 'date' => 'no date' }) }.to raise_error(ReeMapper::CoercionError, /`date` is invalid date, got `\"no date\"`/)
88
88
  }
89
89
  end
90
90
 
@@ -94,20 +94,20 @@ RSpec.describe 'ReeMapper::Date' do
94
94
  }
95
95
 
96
96
  it {
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
+ expect { mapper.db_dump OpenStruct.new({ date: DateTime.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date` should be a date, got `#{Regexp.quote(DateTime.new(2020).inspect)}`/)
98
98
  }
99
99
 
100
100
  it {
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
+ expect { mapper.db_dump OpenStruct.new({ date: Time.new(2020) }) }.to raise_error(ReeMapper::TypeError, /`date` should be a date, got `#{Regexp.quote(Time.new(2020).inspect)}`/)
102
102
  }
103
103
 
104
104
  it {
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
+ expect { mapper.db_dump OpenStruct.new({ date: '2020-01-01' }) }.to raise_error(ReeMapper::TypeError, /`date` should be a date, got `\"2020-01-01\"`/)
106
106
  }
107
107
 
108
108
  it {
109
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}`")
110
+ expect { mapper.db_dump OpenStruct.new({ date: object }) }.to raise_error(ReeMapper::TypeError, /`date` should be a date, got `#{object.inspect}`/)
111
111
  }
112
112
  end
113
113
  end
@@ -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, "`date_time` should be a datetime, got `#{Time.new(2020).inspect}`")
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, "`date_time` should be a datetime, got `#{Date.new(2020).inspect}`")
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, "`date_time` should be a datetime, got `\"#{DateTime.new(2020).to_s}\"`")
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, "`date_time` should be a datetime, got `\"2020-01-01\"`")
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
+ 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, "`date_time` should be a datetime, got `#{Date.new(2020).inspect}`")
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, "`date_time` should be a datetime, got `#{object.inspect}`")
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, "`date_time` is invalid datetime, got `\"no date time\"`")
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, "`date_time` should be a datetime, got `#{Time.new(2020).inspect}`")
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, "`date_time` should be a datetime, got `#{Date.new(2020).inspect}`")
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, "`date_time` should be a datetime, got `\"#{DateTime.new(2020).to_s}\"`")
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, "`date_time` should be a datetime, got `\"2020-01-01\"`")
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, "`date_time` should be a datetime, got `#{object.inspect}`")
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, "`date_time` should be a datetime, got `#{Date.new(2020).inspect}`")
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, "`date_time` should be a datetime, got `#{object.inspect}`")
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, "`date_time` is invalid datetime, got `\"no date time\"`")
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, '`float` is invalid float, got `"a1.1"`')
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, got `"1.1a"`')
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
+ 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, "`float` should be a float, got `\"1.1\"`")
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, "`float` should be a float, got `nil`")
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, "`float` should be a float, got `#{object.inspect}`")
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, "`float` should be a float, got `\"1.1\"`")
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, "`float` should be a float, got `nil`")
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, "`float` should be a float, got `#{object.inspect}`")
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, '`float` is invalid float, got `"a1.1"`')
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, '`float` is invalid float, got `"1.1a"`')
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, "`float` should be a float, got `nil`")
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, "`float` should be a float, got `#{object.inspect}`")
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, 'Missing required field `x` for `point`')
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, '`point[y]` is invalid integer, got `"not 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, got `"b1"`')
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, got `"1b"`')
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, got `1.1`')
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, got `"1"`')
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, got `"b1"`')
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, got `"1b"`')
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, got `1.1`')
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, got `"1"`')
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, got `"b1"`')
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, got `"1b"`')
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, got `1.1`')
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, got `"b1"`')
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, got `"1b"`')
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, got `1.1`')
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, '`rational` is invalid rational, got `"a333"`')
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, got `"333a"`')
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
+ 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, "`rational` should be a rational, got `\"1/3\"`")
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, "`rational` should be a rational, got `nil`")
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, "`rational` should be a rational, got `#{object.inspect}`")
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, "`rational` should be a rational, got `\"1/3\"`")
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, "`rational` should be a rational, got `nil`")
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, "`rational` should be a rational, got `#{object.inspect}`")
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, '`rational` is invalid rational, got `"a333"`')
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, '`rational` is invalid rational, got `"333a"`')
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, "`rational` should be a rational, got `#{object.inspect}`")
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, "`str` should be a string, got `nil`") }
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, got `:sym`") }
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, "`str` should be a string, got `#{object.inspect}`")
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, "`str` should be a string, got `nil`") }
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, "`str` should be a string, got `:sym`") }
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, "`str` should be a string, got `#{object.inspect}`")
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, "`str` should be a string, got `nil`") }
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, "`str` should be a string, got `:sym`") }
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, "`str` should be a string, got `#{object.inspect}`")
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, "`str` should be a string, got `nil`") }
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, "`str` should be a string, got `:sym`") }
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, "`str` should be a string, got `#{object.inspect}`")
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, "`time` should be a time, got `#{DateTime.new(2020).inspect}`")
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, "`time` should be a time, got `#{Date.new(2020).inspect}`")
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, "`time` should be a time, got `\"2020-01-01T00:00:00+00:00\"`")
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, "`time` should be a time, got `\"2020-01-01\"`")
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, "`time` should be a time, got `#{object.inspect}`")
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, "`time` should be a time, got `#{Date.new(2020).inspect}`")
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, "`time` should be a time, got `#{object.inspect}`")
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, "`time` is invalid time, got `\"no date time\"`")
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, "`time` should be a time, got `#{DateTime.new(2020).inspect}`")
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, "`time` should be a time, got `#{Date.new(2020).inspect}`")
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, "`time` should be a time, got `#{time.inspect}`")
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, "`time` should be a time, got `\"2020-01-01\"`")
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, "`time` should be a time, got `#{object.inspect}`")
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, "`time` should be a time, got `#{Date.new(2020).inspect}`")
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, "`time` should be a time, got `#{object.inspect}`")
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, "`time` is invalid time, got `\"no date time\"`")
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