measured-rails 2.4.0 → 2.7.1
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 +5 -5
- data/.github/workflows/ci.yml +41 -0
- data/CHANGELOG.md +28 -0
- data/README.md +3 -0
- data/dev.yml +1 -1
- data/gemfiles/{rails-5.0.gemfile → rails-5.2.gemfile} +1 -1
- data/gemfiles/{rails-master.gemfile → rails-6.0.gemfile} +1 -1
- data/gemfiles/{rails-4.2.gemfile → rails-6.1.gemfile} +1 -2
- data/gemfiles/rails-edge.gemfile +5 -0
- data/lib/measured-rails.rb +2 -0
- data/lib/measured/rails/active_record.rb +3 -6
- data/lib/measured/rails/base.rb +3 -1
- data/lib/measured/rails/railtie.rb +1 -0
- data/lib/measured/rails/units/length.rb +1 -0
- data/lib/measured/rails/units/volume.rb +14 -0
- data/lib/measured/rails/units/weight.rb +1 -0
- data/lib/measured/rails/validations.rb +1 -0
- data/lib/measured/rails/version.rb +2 -1
- data/measured-rails.gemspec +15 -6
- data/test/active_record_test.rb +413 -0
- data/test/support/models/thing.rb +14 -0
- data/test/support/models/thing_with_custom_unit_accessor.rb +18 -0
- data/test/support/models/validated_thing.rb +45 -0
- data/test/support/schema.rb +83 -0
- data/test/test_helper.rb +30 -0
- data/test/validation_test.rb +238 -0
- metadata +52 -23
- data/.travis.yml +0 -25
- data/bin/console +0 -14
- data/bin/setup +0 -7
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class Thing < ActiveRecord::Base
|
3
|
+
|
4
|
+
measured_length :length, :width
|
5
|
+
|
6
|
+
measured Measured::Length, :height
|
7
|
+
measured Measured::Volume, :volume
|
8
|
+
|
9
|
+
measured_weight :total_weight
|
10
|
+
|
11
|
+
measured "Measured::Weight", :extra_weight
|
12
|
+
|
13
|
+
measured_length :length_with_max_on_assignment, {max_on_assignment: 500}
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class ThingWithCustomUnitAccessor < ActiveRecord::Base
|
3
|
+
measured_length :length, :width, unit_field_name: :size_unit
|
4
|
+
validates :length, measured: true
|
5
|
+
validates :width, measured: true
|
6
|
+
|
7
|
+
measured_volume :volume
|
8
|
+
validates :volume, measured: true
|
9
|
+
|
10
|
+
measured Measured::Length, :height, unit_field_name: :size_unit
|
11
|
+
validates :height, measured: true
|
12
|
+
|
13
|
+
measured_weight :total_weight, unit_field_name: :weight_unit
|
14
|
+
validates :total_weight, measured: true
|
15
|
+
|
16
|
+
measured "Measured::Weight", :extra_weight, unit_field_name: :weight_unit
|
17
|
+
validates :extra_weight, measured: true
|
18
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class ValidatedThing < ActiveRecord::Base
|
3
|
+
measured_length :length
|
4
|
+
validates :length, measured: true
|
5
|
+
|
6
|
+
measured_length :length_true
|
7
|
+
validates :length_true, measured: true
|
8
|
+
|
9
|
+
measured_length :length_message
|
10
|
+
validates :length_message, measured: {message: "has a custom failure message"}
|
11
|
+
|
12
|
+
measured_length :length_message_from_block
|
13
|
+
validates :length_message_from_block, measured: { message: Proc.new { |record| "#{record.length_message_from_block_unit} is not a valid unit" } }
|
14
|
+
|
15
|
+
measured_length :length_units
|
16
|
+
validates :length_units, measured: {units: [:meter, "cm"]}
|
17
|
+
|
18
|
+
measured_length :length_units_singular
|
19
|
+
validates :length_units_singular, measured: {units: :ft, message: "custom message too"}
|
20
|
+
|
21
|
+
measured_length :length_presence
|
22
|
+
validates :length_presence, measured: true, presence: true
|
23
|
+
|
24
|
+
measured_length :length_numericality_inclusive
|
25
|
+
validates :length_numericality_inclusive, measured: {greater_than_or_equal_to: :low_bound, less_than_or_equal_to: :high_bound }
|
26
|
+
|
27
|
+
measured_length :length_numericality_exclusive
|
28
|
+
validates :length_numericality_exclusive, measured: {greater_than: Measured::Length.new(3, :m), less_than: Measured::Length.new(500, :cm), message: "is super not ok"}
|
29
|
+
|
30
|
+
measured_length :length_numericality_equality
|
31
|
+
validates :length_numericality_equality, measured: {equal_to: Proc.new { Measured::Length.new(100, :cm) }, message: "must be exactly 100cm"}
|
32
|
+
|
33
|
+
measured_length :length_invalid_comparison
|
34
|
+
validates :length_invalid_comparison, measured: {equal_to: "not_a_measured_subclass"}
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def low_bound
|
39
|
+
Measured::Length.new(10, :in)
|
40
|
+
end
|
41
|
+
|
42
|
+
def high_bound
|
43
|
+
Measured::Length.new(20, :in)
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(version: 20161118203701) do
|
14
|
+
|
15
|
+
create_table "thing_with_custom_unit_accessors", force: :cascade do |t|
|
16
|
+
t.decimal "length_value", precision: 10, scale: 2
|
17
|
+
t.decimal "width_value", precision: 10, scale: 2
|
18
|
+
t.decimal "height_value", precision: 10, scale: 2
|
19
|
+
t.decimal "volume_value", precision: 10, scale: 2
|
20
|
+
t.string "volume_unit", limit: 12
|
21
|
+
t.string "size_unit", limit: 12
|
22
|
+
t.decimal "total_weight_value", precision: 10, scale: 2, default: "10.0"
|
23
|
+
t.decimal "extra_weight_value", precision: 10, scale: 2
|
24
|
+
t.string "weight_unit", limit: 12
|
25
|
+
t.datetime "created_at", null: false
|
26
|
+
t.datetime "updated_at", null: false
|
27
|
+
end
|
28
|
+
|
29
|
+
create_table "things", force: :cascade do |t|
|
30
|
+
t.decimal "length_value", precision: 10, scale: 2
|
31
|
+
t.string "length_unit", limit: 12
|
32
|
+
t.decimal "width_value", precision: 10, scale: 2
|
33
|
+
t.string "width_unit", limit: 12
|
34
|
+
t.decimal "height_value", precision: 10, scale: 2
|
35
|
+
t.string "height_unit", limit: 12
|
36
|
+
t.decimal "volume_value", precision: 10, scale: 2
|
37
|
+
t.string "volume_unit", limit: 12
|
38
|
+
t.decimal "total_weight_value", precision: 10, scale: 2, default: "10.0"
|
39
|
+
t.string "total_weight_unit", limit: 12, default: "g"
|
40
|
+
t.decimal "extra_weight_value", precision: 10, scale: 2
|
41
|
+
t.string "extra_weight_unit", limit: 12
|
42
|
+
t.decimal "length_with_max_on_assignment_value", precision: 10, scale: 2
|
43
|
+
t.string "length_with_max_on_assignment_unit", limit: 12
|
44
|
+
t.datetime "created_at", null: false
|
45
|
+
t.datetime "updated_at", null: false
|
46
|
+
end
|
47
|
+
|
48
|
+
create_table "validated_things", force: :cascade do |t|
|
49
|
+
t.decimal "length_value", precision: 10, scale: 2
|
50
|
+
t.string "length_unit", limit: 12
|
51
|
+
t.decimal "length_true_value", precision: 10, scale: 2
|
52
|
+
t.string "length_true_unit", limit: 12
|
53
|
+
t.decimal "length_message_value", precision: 10, scale: 2
|
54
|
+
t.string "length_message_unit", limit: 12
|
55
|
+
t.decimal "length_message_from_block_value", precision: 10, scale: 2
|
56
|
+
t.string "length_message_from_block_unit", limit: 12
|
57
|
+
t.decimal "length_units_value", precision: 10, scale: 2
|
58
|
+
t.string "length_units_unit", limit: 12
|
59
|
+
t.decimal "length_units_singular_value", precision: 10, scale: 2
|
60
|
+
t.string "length_units_singular_unit", limit: 12
|
61
|
+
t.decimal "length_presence_value", precision: 10, scale: 2
|
62
|
+
t.string "length_presence_unit", limit: 12
|
63
|
+
t.decimal "length_invalid_value", precision: 10, scale: 2
|
64
|
+
t.string "length_invalid_unit", limit: 12
|
65
|
+
t.datetime "created_at", null: false
|
66
|
+
t.datetime "updated_at", null: false
|
67
|
+
t.decimal "length_numericality_inclusive_value", precision: 10, scale: 2
|
68
|
+
t.string "length_numericality_inclusive_unit", limit: 12
|
69
|
+
t.decimal "length_numericality_exclusive_value", precision: 10, scale: 2
|
70
|
+
t.string "length_numericality_exclusive_unit", limit: 12
|
71
|
+
t.decimal "length_numericality_equality_value", precision: 10, scale: 2
|
72
|
+
t.string "length_numericality_equality_unit", limit: 12
|
73
|
+
t.decimal "length_invalid_comparison_value", precision: 10, scale: 2
|
74
|
+
t.string "length_invalid_comparison_unit", limit: 12
|
75
|
+
t.decimal "length_non_zero_scalar_value", precision: 10, scale: 2
|
76
|
+
t.string "length_non_zero_scalar_unit", limit: 12
|
77
|
+
t.decimal "length_zero_scalar_value", precision: 10, scale: 2
|
78
|
+
t.string "length_zero_scalar_unit", limit: 12
|
79
|
+
t.decimal "length_numericality_less_than_than_scalar_value", precision: 10, scale: 2
|
80
|
+
t.string "length_numericality_less_than_than_scalar_unit", limit: 12
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "pry" unless ENV["CI"]
|
3
|
+
require "measured"
|
4
|
+
require "measured-rails"
|
5
|
+
require "minitest/autorun"
|
6
|
+
require "minitest/reporters"
|
7
|
+
require "mocha/minitest"
|
8
|
+
|
9
|
+
ActiveSupport.test_order = :random
|
10
|
+
|
11
|
+
# Prevent two reporters from printing
|
12
|
+
# https://github.com/kern/minitest-reporters/issues/230
|
13
|
+
# https://github.com/rails/rails/issues/30491
|
14
|
+
Minitest.load_plugins
|
15
|
+
Minitest.extensions.delete('rails')
|
16
|
+
Minitest.extensions.unshift('rails')
|
17
|
+
|
18
|
+
Minitest::Reporters.use! [Minitest::Reporters::ProgressReporter.new(color: true)]
|
19
|
+
|
20
|
+
class ActiveSupport::TestCase
|
21
|
+
def reset_db
|
22
|
+
ActiveRecord::Base.subclasses.each do |model|
|
23
|
+
model.delete_all
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Dir.glob(File.expand_path("../support/models/*.rb", __FILE__)).each { |r| require r }
|
29
|
+
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
30
|
+
require_relative "support/schema.rb"
|
@@ -0,0 +1,238 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "test_helper"
|
3
|
+
|
4
|
+
class Measured::Rails::ValidationTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
reset_db
|
7
|
+
end
|
8
|
+
|
9
|
+
test "validation mock is valid" do
|
10
|
+
assert thing.valid?
|
11
|
+
end
|
12
|
+
|
13
|
+
test "validation measurable: validation leaves a model valid and deals with blank unit" do
|
14
|
+
assert ValidatedThing.new(length_presence: Measured::Length.new(4, :in)).valid?
|
15
|
+
end
|
16
|
+
|
17
|
+
test "validation fails when unit is nil" do
|
18
|
+
thing.length_unit = ''
|
19
|
+
refute thing.valid?
|
20
|
+
assert_equal({ length: ["is not a valid unit"] }, thing.errors.to_hash)
|
21
|
+
end
|
22
|
+
|
23
|
+
test "validation fails on model with custom unit with nil value" do
|
24
|
+
custom_unit_thing.size_unit = ''
|
25
|
+
refute custom_unit_thing.valid?
|
26
|
+
assert_equal(
|
27
|
+
{
|
28
|
+
length: ["is not a valid unit"],
|
29
|
+
width: ["is not a valid unit"],
|
30
|
+
height: ["is not a valid unit"],
|
31
|
+
},
|
32
|
+
custom_unit_thing.errors.to_hash
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
test "validation true works by default" do
|
37
|
+
thing.length_unit = "junk"
|
38
|
+
refute thing.valid?
|
39
|
+
assert_equal ["Length is not a valid unit"], thing.errors.full_messages
|
40
|
+
end
|
41
|
+
|
42
|
+
test "validation can override the message with a static string" do
|
43
|
+
thing.length_message_unit = "junk"
|
44
|
+
refute thing.valid?
|
45
|
+
assert_equal ["Length message has a custom failure message"], thing.errors.full_messages
|
46
|
+
end
|
47
|
+
|
48
|
+
test "validation can override the message with a block" do
|
49
|
+
thing.length_message_from_block_unit = "junk"
|
50
|
+
refute thing.valid?
|
51
|
+
assert_equal ["Length message from block junk is not a valid unit"], thing.errors.full_messages
|
52
|
+
end
|
53
|
+
|
54
|
+
test "validation may be any valid unit" do
|
55
|
+
length_units.each do |unit|
|
56
|
+
thing.length_unit = unit
|
57
|
+
assert thing.valid?
|
58
|
+
thing.length_unit = unit.to_s
|
59
|
+
assert thing.valid?
|
60
|
+
thing.length = Measured::Length.new(123, unit)
|
61
|
+
assert thing.valid?
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
test "validation accepts a list of units in any format as an option and only allows them to be valid" do
|
66
|
+
thing.length_units_unit = :m
|
67
|
+
assert thing.valid?
|
68
|
+
thing.length_units_unit = :cm
|
69
|
+
assert thing.valid?
|
70
|
+
thing.length_units_unit = "cm"
|
71
|
+
assert thing.valid?
|
72
|
+
thing.length_units_unit = "meter"
|
73
|
+
assert thing.valid?
|
74
|
+
thing.length_units = Measured::Length.new(3, :cm)
|
75
|
+
assert thing.valid?
|
76
|
+
thing.length_units_unit = :mm
|
77
|
+
refute thing.valid?
|
78
|
+
thing.length_units = Measured::Length.new(3, :ft)
|
79
|
+
refute thing.valid?
|
80
|
+
end
|
81
|
+
|
82
|
+
test "validation lets the unit be singular" do
|
83
|
+
thing.length_units_singular_unit = :ft
|
84
|
+
assert thing.valid?
|
85
|
+
thing.length_units_singular_unit = "feet"
|
86
|
+
assert thing.valid?
|
87
|
+
thing.length_units_singular_unit = :mm
|
88
|
+
refute thing.valid?
|
89
|
+
thing.length_units_singular_unit = "meter"
|
90
|
+
refute thing.valid?
|
91
|
+
end
|
92
|
+
|
93
|
+
test "validation for unit reasons uses the default message" do
|
94
|
+
thing.length_units_unit = :mm
|
95
|
+
refute thing.valid?
|
96
|
+
assert_equal ["Length units is not a valid unit"], thing.errors.full_messages
|
97
|
+
end
|
98
|
+
|
99
|
+
test "validation for unit reasons also uses the custom message" do
|
100
|
+
thing.length_units_singular_unit = :mm
|
101
|
+
refute thing.valid?
|
102
|
+
assert_equal ["Length units singular custom message too"], thing.errors.full_messages
|
103
|
+
end
|
104
|
+
|
105
|
+
test "validation for unit reasons adds one message if unit is not supported by default and is not custom supported" do
|
106
|
+
thing.length_units_singular_unit = :t
|
107
|
+
refute thing.valid?
|
108
|
+
|
109
|
+
assert_equal ["Length units singular custom message too"], thing.errors.full_messages
|
110
|
+
end
|
111
|
+
|
112
|
+
test "validation presence works on measured columns" do
|
113
|
+
thing.length_presence = nil
|
114
|
+
refute thing.valid?
|
115
|
+
assert_equal ["Length presence can't be blank"], thing.errors.full_messages
|
116
|
+
thing.length_presence_unit = "m"
|
117
|
+
refute thing.valid?
|
118
|
+
thing.length_presence_value = "3"
|
119
|
+
assert thing.valid?
|
120
|
+
end
|
121
|
+
|
122
|
+
test "validation fails if only only the value is set" do
|
123
|
+
thing.length_unit = nil
|
124
|
+
refute thing.valid?
|
125
|
+
end
|
126
|
+
|
127
|
+
test "validation checks that numericality comparisons are against a Measurable subclass" do
|
128
|
+
thing.length_invalid_comparison = Measured::Length.new(30, :in)
|
129
|
+
assert_raises ArgumentError, ":not_a_measured_subclass must be a Measurable object" do
|
130
|
+
thing.valid?
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
test "validation for numericality uses a default invalid message" do
|
135
|
+
thing.length_numericality_inclusive = Measured::Length.new(30, :in)
|
136
|
+
refute thing.valid?
|
137
|
+
assert_equal ["Length numericality inclusive 30 in must be <= 20 in"], thing.errors.full_messages
|
138
|
+
|
139
|
+
thing.length_numericality_inclusive = Measured::Length.new(1, :mm)
|
140
|
+
refute thing.valid?
|
141
|
+
assert_equal ["Length numericality inclusive 1 mm must be >= 10 in"], thing.errors.full_messages
|
142
|
+
end
|
143
|
+
|
144
|
+
test "validation for numericality uses the override message" do
|
145
|
+
thing.length_numericality_exclusive = Measured::Length.new(2, :m)
|
146
|
+
refute thing.valid?
|
147
|
+
assert_equal ["Length numericality exclusive is super not ok"], thing.errors.full_messages
|
148
|
+
|
149
|
+
thing.length_numericality_exclusive = Measured::Length.new(6000, :mm)
|
150
|
+
refute thing.valid?
|
151
|
+
assert_equal ["Length numericality exclusive is super not ok"], thing.errors.full_messages
|
152
|
+
end
|
153
|
+
|
154
|
+
test "validation for numericality checks :greater_than and :less_than and can use symbols as method names to look up values" do
|
155
|
+
thing.length_numericality_exclusive = Measured::Length.new(4, :m)
|
156
|
+
assert thing.valid?
|
157
|
+
|
158
|
+
thing.length_numericality_exclusive = Measured::Length.new(1, :m)
|
159
|
+
refute thing.valid?
|
160
|
+
end
|
161
|
+
|
162
|
+
test "validation for numericality checks :greater_than_or_equal_to and :less_than_or_equal_to" do
|
163
|
+
thing.length_numericality_inclusive = Measured::Length.new(10, :in)
|
164
|
+
assert thing.valid?
|
165
|
+
|
166
|
+
thing.length_numericality_exclusive = Measured::Length.new(3, :m)
|
167
|
+
refute thing.valid?
|
168
|
+
end
|
169
|
+
|
170
|
+
test "validation for numericality checks :equal_to and can use procs to look up values" do
|
171
|
+
thing.length_numericality_equality = Measured::Length.new(100, :cm)
|
172
|
+
assert thing.valid?
|
173
|
+
|
174
|
+
thing.length_numericality_equality = Measured::Length.new(1, :m)
|
175
|
+
assert thing.valid?
|
176
|
+
|
177
|
+
thing.length_numericality_equality = Measured::Length.new("99.9", :cm)
|
178
|
+
refute thing.valid?
|
179
|
+
|
180
|
+
thing.length_numericality_equality = Measured::Length.new(101, :cm)
|
181
|
+
refute thing.valid?
|
182
|
+
end
|
183
|
+
|
184
|
+
test "validation for numericality handles a nil unit but a valid value" do
|
185
|
+
thing.length_numericality_exclusive_unit = nil
|
186
|
+
thing.length_numericality_exclusive_value = 1
|
187
|
+
refute thing.valid?
|
188
|
+
end
|
189
|
+
|
190
|
+
test "allow a nil value but a valid unit" do
|
191
|
+
thing.length_numericality_exclusive_unit = :cm
|
192
|
+
thing.length_numericality_exclusive_value = nil
|
193
|
+
assert thing.valid?
|
194
|
+
end
|
195
|
+
|
196
|
+
test "validations work as expected given a measured field with custom validators" do
|
197
|
+
assert custom_unit_thing.valid?
|
198
|
+
|
199
|
+
assert custom_unit_thing.size_unit = 'invalid'
|
200
|
+
|
201
|
+
refute custom_unit_thing.valid?
|
202
|
+
|
203
|
+
assert_equal(custom_unit_thing.errors[:length], ["is not a valid unit"])
|
204
|
+
assert_equal(custom_unit_thing.errors[:height], ["is not a valid unit"])
|
205
|
+
assert_equal(custom_unit_thing.errors[:width], ["is not a valid unit"])
|
206
|
+
end
|
207
|
+
|
208
|
+
private
|
209
|
+
|
210
|
+
def thing
|
211
|
+
@thing ||= ValidatedThing.new(
|
212
|
+
length: Measured::Length.new(1, :m),
|
213
|
+
length_true: Measured::Length.new(2, :cm),
|
214
|
+
length_message: Measured::Length.new(3, :mm),
|
215
|
+
length_message_from_block: Measured::Length.new(7, :mm),
|
216
|
+
length_units: Measured::Length.new(4, :m),
|
217
|
+
length_units_singular: Measured::Length.new(5, :ft),
|
218
|
+
length_presence: Measured::Length.new(6, :m),
|
219
|
+
length_numericality_inclusive: Measured::Length.new(15, :in),
|
220
|
+
length_numericality_exclusive: Measured::Length.new(4, :m),
|
221
|
+
length_numericality_equality: Measured::Length.new(100, :cm),
|
222
|
+
)
|
223
|
+
end
|
224
|
+
|
225
|
+
def custom_unit_thing
|
226
|
+
@custom_unit_thing ||= ThingWithCustomUnitAccessor.new(
|
227
|
+
length: Measured::Length.new(1, :m),
|
228
|
+
width: Measured::Length.new(2, :m),
|
229
|
+
height: Measured::Length.new(3, :m),
|
230
|
+
total_weight: Measured::Weight.new(10, :g),
|
231
|
+
extra_weight: Measured::Weight.new(12, :g),
|
232
|
+
)
|
233
|
+
end
|
234
|
+
|
235
|
+
def length_units
|
236
|
+
@length_units ||= [:m, :meter, :cm, :mm, :millimeter, :in, :ft, :feet, :yd]
|
237
|
+
end
|
238
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: measured-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McPhillips
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: measured
|
@@ -16,42 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.7.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.7.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activemodel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activerecord
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.2'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +112,16 @@ dependencies:
|
|
98
112
|
name: mocha
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
117
|
+
version: 1.4.0
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - "
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
124
|
+
version: 1.4.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: pry
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,32 +158,41 @@ executables: []
|
|
144
158
|
extensions: []
|
145
159
|
extra_rdoc_files: []
|
146
160
|
files:
|
161
|
+
- ".github/workflows/ci.yml"
|
147
162
|
- ".gitignore"
|
148
|
-
-
|
163
|
+
- CHANGELOG.md
|
149
164
|
- Gemfile
|
150
165
|
- LICENSE
|
151
166
|
- README.md
|
152
167
|
- Rakefile
|
153
|
-
- bin/console
|
154
|
-
- bin/setup
|
155
168
|
- dev.yml
|
156
|
-
- gemfiles/rails-
|
157
|
-
- gemfiles/rails-
|
158
|
-
- gemfiles/rails-
|
169
|
+
- gemfiles/rails-5.2.gemfile
|
170
|
+
- gemfiles/rails-6.0.gemfile
|
171
|
+
- gemfiles/rails-6.1.gemfile
|
172
|
+
- gemfiles/rails-edge.gemfile
|
159
173
|
- lib/measured-rails.rb
|
160
174
|
- lib/measured/rails/active_record.rb
|
161
175
|
- lib/measured/rails/base.rb
|
162
176
|
- lib/measured/rails/railtie.rb
|
163
177
|
- lib/measured/rails/units/length.rb
|
178
|
+
- lib/measured/rails/units/volume.rb
|
164
179
|
- lib/measured/rails/units/weight.rb
|
165
180
|
- lib/measured/rails/validations.rb
|
166
181
|
- lib/measured/rails/version.rb
|
167
182
|
- measured-rails.gemspec
|
168
183
|
- shipit.rubygems.yml
|
184
|
+
- test/active_record_test.rb
|
185
|
+
- test/support/models/thing.rb
|
186
|
+
- test/support/models/thing_with_custom_unit_accessor.rb
|
187
|
+
- test/support/models/validated_thing.rb
|
188
|
+
- test/support/schema.rb
|
189
|
+
- test/test_helper.rb
|
190
|
+
- test/validation_test.rb
|
169
191
|
homepage: https://github.com/Shopify/measured-rails
|
170
192
|
licenses:
|
171
193
|
- MIT
|
172
|
-
metadata:
|
194
|
+
metadata:
|
195
|
+
allowed_push_host: https://rubygems.org
|
173
196
|
post_install_message:
|
174
197
|
rdoc_options: []
|
175
198
|
require_paths:
|
@@ -185,9 +208,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
208
|
- !ruby/object:Gem::Version
|
186
209
|
version: '0'
|
187
210
|
requirements: []
|
188
|
-
|
189
|
-
rubygems_version: 2.6.14
|
211
|
+
rubygems_version: 3.0.3
|
190
212
|
signing_key:
|
191
213
|
specification_version: 4
|
192
214
|
summary: Rails adaptor for measured
|
193
|
-
test_files:
|
215
|
+
test_files:
|
216
|
+
- test/active_record_test.rb
|
217
|
+
- test/support/models/thing.rb
|
218
|
+
- test/support/models/thing_with_custom_unit_accessor.rb
|
219
|
+
- test/support/models/validated_thing.rb
|
220
|
+
- test/support/schema.rb
|
221
|
+
- test/test_helper.rb
|
222
|
+
- test/validation_test.rb
|