measured 2.8.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +11 -5
  3. data/.github/workflows/cla.yml +23 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +8 -0
  6. data/Gemfile +2 -0
  7. data/README.md +114 -4
  8. data/dev.yml +1 -2
  9. data/gemfiles/{activesupport-6.0.gemfile → rails-6.0.gemfile} +1 -0
  10. data/gemfiles/{activesupport-6.1.gemfile → rails-6.1.gemfile} +1 -0
  11. data/gemfiles/rails-7.0.gemfile +6 -0
  12. data/gemfiles/rails-edge.gemfile +6 -0
  13. data/lib/measured/measurable.rb +3 -1
  14. data/lib/measured/rails/active_record.rb +130 -0
  15. data/lib/measured/rails/validations.rb +68 -0
  16. data/lib/measured/railtie.rb +12 -0
  17. data/lib/measured/units/weight.rb +1 -1
  18. data/lib/measured/version.rb +1 -1
  19. data/lib/measured.rb +2 -0
  20. data/lib/tapioca/dsl/compilers/measured_rails.rb +110 -0
  21. data/measured.gemspec +5 -0
  22. data/test/internal/app/models/thing.rb +14 -0
  23. data/test/internal/app/models/thing_with_custom_unit_accessor.rb +18 -0
  24. data/test/internal/app/models/thing_with_custom_value_accessor.rb +19 -0
  25. data/test/internal/app/models/validated_thing.rb +45 -0
  26. data/test/internal/config/database.yml +3 -0
  27. data/test/internal/config.ru +9 -0
  28. data/test/internal/db/.gitignore +1 -0
  29. data/test/internal/db/schema.rb +99 -0
  30. data/test/internal/log/.gitignore +1 -0
  31. data/test/measurable_test.rb +4 -0
  32. data/test/rails/active_record_test.rb +433 -0
  33. data/test/rails/validation_test.rb +252 -0
  34. data/test/tapioca/dsl/compilers/measured_rails_test.rb +220 -0
  35. data/test/test_helper.rb +15 -0
  36. data/test/units/weight_test.rb +3 -1
  37. metadata +80 -7
  38. data/gemfiles/activesupport-5.2.gemfile +0 -5
@@ -0,0 +1,252 @@
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
+ test "validations work as expected on measured field with custom value accessor" do
209
+ assert custom_value_thing.valid?
210
+ end
211
+
212
+ private
213
+
214
+ def thing
215
+ @thing ||= ValidatedThing.new(
216
+ length: Measured::Length.new(1, :m),
217
+ length_true: Measured::Length.new(2, :cm),
218
+ length_message: Measured::Length.new(3, :mm),
219
+ length_message_from_block: Measured::Length.new(7, :mm),
220
+ length_units: Measured::Length.new(4, :m),
221
+ length_units_singular: Measured::Length.new(5, :ft),
222
+ length_presence: Measured::Length.new(6, :m),
223
+ length_numericality_inclusive: Measured::Length.new(15, :in),
224
+ length_numericality_exclusive: Measured::Length.new(4, :m),
225
+ length_numericality_equality: Measured::Length.new(100, :cm),
226
+ )
227
+ end
228
+
229
+ def custom_unit_thing
230
+ @custom_unit_thing ||= ThingWithCustomUnitAccessor.new(
231
+ length: Measured::Length.new(1, :m),
232
+ width: Measured::Length.new(2, :m),
233
+ height: Measured::Length.new(3, :m),
234
+ total_weight: Measured::Weight.new(10, :g),
235
+ extra_weight: Measured::Weight.new(12, :g),
236
+ )
237
+ end
238
+
239
+ def custom_value_thing
240
+ @custom_value_thing = ThingWithCustomValueAccessor.new(
241
+ length: Measured::Length.new(1, :m),
242
+ width: Measured::Length.new(2, :m),
243
+ height: Measured::Length.new(3, :m),
244
+ total_weight: Measured::Weight.new(10, :g),
245
+ extra_weight: Measured::Weight.new(12, :g),
246
+ )
247
+ end
248
+
249
+ def length_units
250
+ @length_units ||= [:m, :meter, :cm, :mm, :millimeter, :in, :ft, :feet, :yd]
251
+ end
252
+ end
@@ -0,0 +1,220 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ require "test_helper"
5
+ require "tapioca/internal"
6
+ require "tapioca/helpers/test/dsl_compiler"
7
+ require "tapioca/dsl/compilers/measured_rails"
8
+
9
+ module Tapioca
10
+ module Dsl
11
+ module Compilers
12
+ class MeasuredRailsTest < ActiveSupport::TestCase
13
+ include Tapioca::Helpers::Test::DslCompiler
14
+
15
+ setup do
16
+ use_dsl_compiler(Tapioca::Dsl::Compilers::MeasuredRails)
17
+ end
18
+
19
+ test "#initialize gathers only ActiveRecord subclasses" do
20
+ add_ruby_file("content.rb", <<~RUBY)
21
+ class Post < ActiveRecord::Base
22
+ end
23
+ class Current
24
+ end
25
+ RUBY
26
+
27
+ assert_includes(gathered_constants, "Post")
28
+ refute_includes(gathered_constants, "Current")
29
+ end
30
+
31
+ test "generates empty RBI file if there are no measured fields" do
32
+ add_ruby_file("package.rb", <<~RUBY)
33
+ class Package < ActiveRecord::Base
34
+ end
35
+ RUBY
36
+
37
+ expected = <<~RBI
38
+ # typed: strong
39
+ RBI
40
+
41
+ assert_equal(expected, rbi_for(:Package))
42
+ end
43
+
44
+ test "generates RBI file for measured method" do
45
+ add_ruby_file("schema.rb", <<~RUBY)
46
+ ActiveRecord::Migration.suppress_messages do
47
+ ActiveRecord::Schema.define do
48
+ create_table :packages, force: :cascade do |t|
49
+ t.decimal :minimum_weight_value, precision: 10, scale: 2
50
+ t.string :minimum_weight_unit, limit: 12
51
+ t.decimal :total_length_value, precision: 10, scale: 2, default: 0
52
+ t.string :total_length_unit, limit: 12, default: "cm"
53
+ t.decimal :total_volume_value, precision: 10, scale: 2, default: 0
54
+ t.string :total_volume_unit, limit: 12, default: "l"
55
+ end
56
+ end
57
+ end
58
+ RUBY
59
+
60
+ add_ruby_file("package.rb", <<~RUBY)
61
+ class Package < ActiveRecord::Base
62
+ measured Measured::Weight, :minimum_weight
63
+ measured Measured::Length, :total_length
64
+ measured Measured::Volume, :total_volume
65
+ end
66
+ RUBY
67
+
68
+ expected = <<~RBI
69
+ # typed: strong
70
+
71
+ class Package
72
+ include GeneratedMeasuredRailsMethods
73
+
74
+ module GeneratedMeasuredRailsMethods
75
+ sig { returns(T.nilable(::Measured::Weight)) }
76
+ def minimum_weight; end
77
+
78
+ sig { params(value: T.nilable(::Measured::Weight)).void }
79
+ def minimum_weight=(value); end
80
+
81
+ sig { returns(T.nilable(::Measured::Length)) }
82
+ def total_length; end
83
+
84
+ sig { params(value: T.nilable(::Measured::Length)).void }
85
+ def total_length=(value); end
86
+
87
+ sig { returns(T.nilable(::Measured::Volume)) }
88
+ def total_volume; end
89
+
90
+ sig { params(value: T.nilable(::Measured::Volume)).void }
91
+ def total_volume=(value); end
92
+ end
93
+ end
94
+ RBI
95
+
96
+ assert_equal(expected, rbi_for(:Package))
97
+ end
98
+
99
+ test "generates RBI file for measured_weight method" do
100
+ add_ruby_file("schema.rb", <<~RUBY)
101
+ ActiveRecord::Migration.suppress_messages do
102
+ ActiveRecord::Schema.define do
103
+ create_table :packages, force: :cascade do |t|
104
+ t.decimal :minimum_weight_value, precision: 10, scale: 2
105
+ t.string :minimum_weight_unit, limit: 12
106
+ t.decimal :total_length_value, precision: 10, scale: 2, default: 0
107
+ t.string :total_length_unit, limit: 12, default: "cm"
108
+ t.decimal :total_volume_value, precision: 10, scale: 2, default: 0
109
+ t.string :total_volume_unit, limit: 12, default: "l"
110
+ end
111
+ end
112
+ end
113
+ RUBY
114
+
115
+ add_ruby_file("package.rb", <<~RUBY)
116
+ class Package < ActiveRecord::Base
117
+ measured_weight :minimum_weight
118
+ end
119
+ RUBY
120
+
121
+ expected = <<~RBI
122
+ # typed: strong
123
+
124
+ class Package
125
+ include GeneratedMeasuredRailsMethods
126
+
127
+ module GeneratedMeasuredRailsMethods
128
+ sig { returns(T.nilable(::Measured::Weight)) }
129
+ def minimum_weight; end
130
+
131
+ sig { params(value: T.nilable(::Measured::Weight)).void }
132
+ def minimum_weight=(value); end
133
+ end
134
+ end
135
+ RBI
136
+
137
+ assert_equal(expected, rbi_for(:Package))
138
+ end
139
+
140
+ test "generates RBI file for measured_length method" do
141
+ add_ruby_file("schema.rb", <<~RUBY)
142
+ ActiveRecord::Migration.suppress_messages do
143
+ ActiveRecord::Schema.define do
144
+ create_table :packages, force: :cascade do |t|
145
+ t.decimal :minimum_weight_value, precision: 10, scale: 2
146
+ t.string :minimum_weight_unit, limit: 12
147
+ t.decimal :total_length_value, precision: 10, scale: 2, default: 0
148
+ t.string :total_length_unit, limit: 12, default: "cm"
149
+ t.decimal :total_volume_value, precision: 10, scale: 2, default: 0
150
+ t.string :total_volume_unit, limit: 12, default: "l"
151
+ end
152
+ end
153
+ end
154
+ RUBY
155
+
156
+ add_ruby_file("package.rb", <<~RUBY)
157
+ class Package < ActiveRecord::Base
158
+ measured_length :total_length
159
+ end
160
+ RUBY
161
+
162
+ expected = <<~RBI
163
+ # typed: strong
164
+
165
+ class Package
166
+ include GeneratedMeasuredRailsMethods
167
+
168
+ module GeneratedMeasuredRailsMethods
169
+ sig { returns(T.nilable(::Measured::Length)) }
170
+ def total_length; end
171
+
172
+ sig { params(value: T.nilable(::Measured::Length)).void }
173
+ def total_length=(value); end
174
+ end
175
+ end
176
+ RBI
177
+
178
+ assert_equal(expected, rbi_for(:Package))
179
+ end
180
+
181
+ test "generates RBI file for measured_volume method" do
182
+ add_ruby_file("schema.rb", <<~RUBY)
183
+ ActiveRecord::Migration.suppress_messages do
184
+ ActiveRecord::Schema.define do
185
+ create_table :packages, force: :cascade do |t|
186
+ t.decimal :total_volume_value, precision: 10, scale: 2, default: 0
187
+ t.string :total_volume_unit, limit: 12, default: "l"
188
+ end
189
+ end
190
+ end
191
+ RUBY
192
+
193
+ add_ruby_file("package.rb", <<~RUBY)
194
+ class Package < ActiveRecord::Base
195
+ measured_volume :total_volume
196
+ end
197
+ RUBY
198
+
199
+ expected = <<~RBI
200
+ # typed: strong
201
+
202
+ class Package
203
+ include GeneratedMeasuredRailsMethods
204
+
205
+ module GeneratedMeasuredRailsMethods
206
+ sig { returns(T.nilable(::Measured::Volume)) }
207
+ def total_volume; end
208
+
209
+ sig { params(value: T.nilable(::Measured::Volume)).void }
210
+ def total_volume=(value); end
211
+ end
212
+ end
213
+ RBI
214
+
215
+ assert_equal(expected, rbi_for(:Package))
216
+ end
217
+ end
218
+ end
219
+ end
220
+ end
data/test/test_helper.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "pry" unless ENV["CI"]
4
+ require "combustion"
5
+ Combustion.path = "test/internal"
6
+ Combustion.initialize! :active_record, :active_model
3
7
  require "measured"
4
8
  require "minitest/reporters"
5
9
  require "minitest/autorun"
@@ -7,6 +11,13 @@ require "mocha/minitest"
7
11
 
8
12
  ActiveSupport.test_order = :random
9
13
 
14
+ # Prevent two reporters from printing
15
+ # https://github.com/kern/minitest-reporters/issues/230
16
+ # https://github.com/rails/rails/issues/30491
17
+ Minitest.load_plugins
18
+ Minitest.extensions.delete('rails')
19
+ Minitest.extensions.unshift('rails')
20
+
10
21
  Minitest::Reporters.use! [Minitest::Reporters::ProgressReporter.new(color: true)]
11
22
 
12
23
  require "support/subclasses"
@@ -44,4 +55,8 @@ class ActiveSupport::TestCase
44
55
  error = assert_raise(exception) { yield }
45
56
  assert_equal expected_message, error.message, "Exception #{exception} raised but messages are not equal"
46
57
  end
58
+
59
+ def reset_db
60
+ Combustion::Database::LoadSchema.call
61
+ end
47
62
  end
@@ -15,6 +15,8 @@ class Measured::WeightTest < ActiveSupport::TestCase
15
15
  g
16
16
  gram
17
17
  grams
18
+ gm
19
+ gms
18
20
  imperial_ton
19
21
  imperial_tons
20
22
  lb
@@ -39,7 +41,7 @@ class Measured::WeightTest < ActiveSupport::TestCase
39
41
  weight_tons
40
42
  )
41
43
  expected_units += Measured::UnitSystemBuilder::SI_PREFIXES.flat_map do |short, long, _|
42
- ["#{short}g", "#{long}gram", "#{long}grams"]
44
+ ["#{short}g", "#{long}gram", "#{long}grams", "#{long}gm", "#{long}gms"]
43
45
  end
44
46
 
45
47
  assert_equal expected_units.sort, Measured::Weight.unit_names_with_aliases
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: measured
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin McPhillips
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-12-21 00:00:00.000000000 Z
13
+ date: 2024-04-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -96,6 +96,48 @@ dependencies:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
+ - !ruby/object:Gem::Dependency
100
+ name: combustion
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ - !ruby/object:Gem::Dependency
114
+ name: sqlite3
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '1.4'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '1.4'
127
+ - !ruby/object:Gem::Dependency
128
+ name: tapioca
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
99
141
  description: Wrapper objects which encapsulate measurements and their associated units
100
142
  in Ruby.
101
143
  email:
@@ -105,7 +147,9 @@ extensions: []
105
147
  extra_rdoc_files: []
106
148
  files:
107
149
  - ".github/workflows/ci.yml"
150
+ - ".github/workflows/cla.yml"
108
151
  - ".gitignore"
152
+ - ".ruby-version"
109
153
  - CHANGELOG.md
110
154
  - Gemfile
111
155
  - LICENSE
@@ -116,9 +160,10 @@ files:
116
160
  - cache/volume.json
117
161
  - cache/weight.json
118
162
  - dev.yml
119
- - gemfiles/activesupport-5.2.gemfile
120
- - gemfiles/activesupport-6.0.gemfile
121
- - gemfiles/activesupport-6.1.gemfile
163
+ - gemfiles/rails-6.0.gemfile
164
+ - gemfiles/rails-6.1.gemfile
165
+ - gemfiles/rails-7.0.gemfile
166
+ - gemfiles/rails-edge.gemfile
122
167
  - lib/measured.rb
123
168
  - lib/measured/arithmetic.rb
124
169
  - lib/measured/base.rb
@@ -130,6 +175,9 @@ files:
130
175
  - lib/measured/measurable.rb
131
176
  - lib/measured/missing_conversion_path.rb
132
177
  - lib/measured/parser.rb
178
+ - lib/measured/rails/active_record.rb
179
+ - lib/measured/rails/validations.rb
180
+ - lib/measured/railtie.rb
133
181
  - lib/measured/unit.rb
134
182
  - lib/measured/unit_already_added.rb
135
183
  - lib/measured/unit_error.rb
@@ -139,6 +187,7 @@ files:
139
187
  - lib/measured/units/volume.rb
140
188
  - lib/measured/units/weight.rb
141
189
  - lib/measured/version.rb
190
+ - lib/tapioca/dsl/compilers/measured_rails.rb
142
191
  - measured.gemspec
143
192
  - shipit.rubygems.yml
144
193
  - test/arithmetic_test.rb
@@ -147,11 +196,23 @@ files:
147
196
  - test/cache/null_test.rb
148
197
  - test/cache_consistency_test.rb
149
198
  - test/conversion_table_builder_test.rb
199
+ - test/internal/app/models/thing.rb
200
+ - test/internal/app/models/thing_with_custom_unit_accessor.rb
201
+ - test/internal/app/models/thing_with_custom_value_accessor.rb
202
+ - test/internal/app/models/validated_thing.rb
203
+ - test/internal/config.ru
204
+ - test/internal/config/database.yml
205
+ - test/internal/db/.gitignore
206
+ - test/internal/db/schema.rb
207
+ - test/internal/log/.gitignore
150
208
  - test/measurable_test.rb
151
209
  - test/parser_test.rb
210
+ - test/rails/active_record_test.rb
211
+ - test/rails/validation_test.rb
152
212
  - test/support/always_true_cache.rb
153
213
  - test/support/fake_system.rb
154
214
  - test/support/subclasses.rb
215
+ - test/tapioca/dsl/compilers/measured_rails_test.rb
155
216
  - test/test_helper.rb
156
217
  - test/unit_error_test.rb
157
218
  - test/unit_system_builder_test.rb
@@ -173,14 +234,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
234
  requirements:
174
235
  - - ">="
175
236
  - !ruby/object:Gem::Version
176
- version: '0'
237
+ version: 3.0.0
177
238
  required_rubygems_version: !ruby/object:Gem::Requirement
178
239
  requirements:
179
240
  - - ">="
180
241
  - !ruby/object:Gem::Version
181
242
  version: '0'
182
243
  requirements: []
183
- rubygems_version: 3.2.20
244
+ rubygems_version: 3.5.9
184
245
  signing_key:
185
246
  specification_version: 4
186
247
  summary: Encapsulate measurements with their units in Ruby
@@ -191,11 +252,23 @@ test_files:
191
252
  - test/cache/null_test.rb
192
253
  - test/cache_consistency_test.rb
193
254
  - test/conversion_table_builder_test.rb
255
+ - test/internal/app/models/thing.rb
256
+ - test/internal/app/models/thing_with_custom_unit_accessor.rb
257
+ - test/internal/app/models/thing_with_custom_value_accessor.rb
258
+ - test/internal/app/models/validated_thing.rb
259
+ - test/internal/config.ru
260
+ - test/internal/config/database.yml
261
+ - test/internal/db/.gitignore
262
+ - test/internal/db/schema.rb
263
+ - test/internal/log/.gitignore
194
264
  - test/measurable_test.rb
195
265
  - test/parser_test.rb
266
+ - test/rails/active_record_test.rb
267
+ - test/rails/validation_test.rb
196
268
  - test/support/always_true_cache.rb
197
269
  - test/support/fake_system.rb
198
270
  - test/support/subclasses.rb
271
+ - test/tapioca/dsl/compilers/measured_rails_test.rb
199
272
  - test/test_helper.rb
200
273
  - test/unit_error_test.rb
201
274
  - test/unit_system_builder_test.rb
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec path: '..'
4
-
5
- gem 'activesupport', '~> 5.2'