measured-rails 2.5.2 → 2.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 570c090577cd5e2567ac99c96f88aa867480958c874dd9482edd1f7b902d6027
4
- data.tar.gz: daf241a1c39c641e314212a0934fb93be593f4ab7a3a9d2541062a845a5d9d5e
3
+ metadata.gz: bd5658fda3d706ca2a15122793008dea4a312e8fe6dccbeb72743dbabc165d1d
4
+ data.tar.gz: 96eb251668aca9622ec35cafba76730edfa1243749b8cdced184aa6e49c2c754
5
5
  SHA512:
6
- metadata.gz: 03e93d0847ff6ef2742259af45aee0c2ad7ab5c20266c66a2bbbff9ab16889401ff246da21f5dc54072137ec56d9d2e2475174c478b474cfb1dff1ab20e29eab
7
- data.tar.gz: accdb3469476f5c0d4c5597084e79b46b365eadd41075f162ee7780c00e5a2bdfc9a20c7d03e5e2299a2e0c60eefbb412996d37fc832a2d8f1754db9b60e1d87
6
+ metadata.gz: 130a3980eb4b1eaa5de174316ac1073f144bb1bf9676a906f68f3cc44bb3752a825b81a5a5cc20768c01ad86cad5ee0cb7ca24e32a28327bd0f6853b564fb4bb
7
+ data.tar.gz: edcb3fd7eb2fdd691c49cd31f44047d0cf1d63c3ebe5e27fbad3bd96aee8a2ed965c48ac29da846d11c0ca3f2ac592698e26b6ca9faeff2ea9f5dfe55475a5c8
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ env:
9
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
10
+ strategy:
11
+ matrix:
12
+ ruby:
13
+ - 2.5
14
+ - 2.6
15
+ - 2.7
16
+ gemfile:
17
+ - Gemfile
18
+ - gemfiles/rails-5.2.gemfile
19
+ - gemfiles/rails-6.0.gemfile
20
+ - gemfiles/rails-6.1.gemfile
21
+ - gemfiles/rails-master.gemfile
22
+ name: Ruby ${{ matrix.ruby }} ${{ matrix.gemfile }}
23
+ steps:
24
+ - uses: actions/checkout@v1
25
+ - name: Set up Ruby ${{ matrix.ruby }}
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby }}
29
+ bundler-cache: true
30
+ - name: Run tests
31
+ run: |
32
+ bundle exec rake
@@ -1,3 +1,9 @@
1
+ 2.6.0
2
+ -----
3
+
4
+ * Only support Rails 5.2 and above.
5
+
6
+
1
7
  2.5.2
2
8
  -----
3
9
 
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec path: '..'
4
4
 
5
- gem 'rails', '~> 5.0'
5
+ gem 'rails', '~> 5.2'
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec path: '..'
4
4
 
5
- gem 'rails', '~> 6.0.0.rc1'
5
+ gem 'rails', '~> 6.0'
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec path: '..'
4
4
 
5
- gem 'rails', '~> 5.1'
5
+ gem 'rails', '~> 6.1'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Measured
3
3
  module Rails
4
- VERSION = "2.5.2"
4
+ VERSION = "2.6.0"
5
5
  end
6
6
  end
@@ -13,6 +13,14 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/Shopify/measured-rails"
14
14
  spec.license = "MIT"
15
15
 
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
16
24
  spec.files = `git ls-files -z`.split("\x0")
17
25
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
@@ -20,9 +28,9 @@ Gem::Specification.new do |spec|
20
28
 
21
29
  spec.add_runtime_dependency "measured", Measured::Rails::VERSION
22
30
 
23
- spec.add_runtime_dependency "railties", ">= 4.2"
24
- spec.add_runtime_dependency "activemodel", ">= 4.2"
25
- spec.add_runtime_dependency "activerecord", ">= 4.2"
31
+ spec.add_runtime_dependency "railties", ">= 5.2"
32
+ spec.add_runtime_dependency "activemodel", ">= 5.2"
33
+ spec.add_runtime_dependency "activerecord", ">= 5.2"
26
34
 
27
35
  spec.add_development_dependency "rake", "> 10.0"
28
36
  spec.add_development_dependency "minitest", "> 5.5.1"
@@ -196,109 +196,87 @@ class Measured::Rails::ActiveRecordTest < ActiveSupport::TestCase
196
196
  assert_nil thing.length
197
197
  end
198
198
 
199
- test "update_attribute sets only the _value column" do
199
+ test "update sets one then the other" do
200
200
  thing = Thing.create!
201
- thing.update_attribute(:width_value, 11)
201
+ assert thing.update(width_value: 11.1)
202
202
  assert_nil thing.width
203
- end
204
-
205
- test "update_attribute sets only the _unit column" do
206
- thing = Thing.create!
207
- thing.update_attribute(:width_unit, "cm")
208
- assert_nil thing.width
209
- end
210
-
211
- test "update_attribute modifies the _value column" do
212
- assert thing.update_attribute(:width_value, 99)
213
- assert_equal Measured::Length.new(99, :in), thing.width
214
- end
215
-
216
- test "update_attribute modifies only the _unit column" do
217
- assert thing.update_attribute(:width_unit, :cm)
218
- assert_equal Measured::Length.new(6, :cm), thing.width
219
- end
220
-
221
- test "update_attribute sets one then the other" do
222
- thing = Thing.create!
223
- assert thing.update_attribute(:width_value, 11.1)
224
- assert_nil thing.width
225
- assert thing.update_attribute(:width_unit, "cm")
203
+ assert thing.update(width_unit: "cm")
226
204
  assert_equal Measured::Length.new(11.1, :cm), thing.width
227
205
  end
228
206
 
229
- test "update_attributes sets only the _value column" do
207
+ test "update sets only the _value column" do
230
208
  thing = Thing.create!
231
- assert thing.update_attributes(width_value: "314")
209
+ assert thing.update(width_value: "314")
232
210
  assert_equal 314, thing.width_value
233
211
  thing.reload
234
212
  assert_equal 314, thing.width_value
235
213
  assert_nil thing.width
236
214
  end
237
215
 
238
- test "update_attributes sets only the _unit column" do
216
+ test "update sets only the _unit column" do
239
217
  thing = Thing.create!
240
- assert thing.update_attributes(width_unit: :cm)
218
+ assert thing.update(width_unit: :cm)
241
219
  assert_equal "cm", thing.width_unit
242
220
  thing.reload
243
221
  assert_equal "cm", thing.width_unit
244
222
  assert_nil thing.width
245
223
  end
246
224
 
247
- test "update_attributes sets only the _unit column and converts it" do
225
+ test "update sets only the _unit column and converts it" do
248
226
  thing = Thing.create!
249
- assert thing.update_attributes(width_unit: "inch")
227
+ assert thing.update(width_unit: "inch")
250
228
  assert_equal "in", thing.width_unit
251
229
  thing.reload
252
230
  assert_equal "in", thing.width_unit
253
231
  end
254
232
 
255
- test "update_attributes sets the _unit column to something invalid" do
233
+ test "update sets the _unit column to something invalid" do
256
234
  thing = Thing.create!
257
- assert thing.update_attributes(width_unit: :invalid)
235
+ assert thing.update(width_unit: :invalid)
258
236
  assert_equal "invalid", thing.width_unit
259
237
  thing.reload
260
238
  assert_equal "invalid", thing.width_unit
261
239
  assert_nil thing.width
262
240
  end
263
241
 
264
- test "update_attributes does not set the _unit column to something invalid if there is validation" do
242
+ test "update does not set the _unit column to something invalid if there is validation" do
265
243
  thing = validated_thing
266
244
  thing.save!
267
- refute thing.update_attributes(length_unit: :invalid)
245
+ refute thing.update(length_unit: :invalid)
268
246
  end
269
247
 
270
- test "update_attributes sets one column then the other" do
248
+ test "update sets one column then the other" do
271
249
  thing = Thing.create!
272
- assert thing.update_attributes(width_unit: "inch")
250
+ assert thing.update(width_unit: "inch")
273
251
  assert_nil thing.width
274
- assert thing.update_attributes(width_value: "314")
252
+ assert thing.update(width_value: "314")
275
253
  assert_equal Measured::Length.new(314, :in), thing.width
276
254
  end
277
255
 
278
- test "update_attributes sets both columns" do
256
+ test "update sets both columns" do
279
257
  thing = Thing.create!
280
- assert thing.update_attributes(width_unit: :cm, width_value: 2)
258
+ assert thing.update(width_unit: :cm, width_value: 2)
281
259
  assert_equal Measured::Length.new(2, :cm), thing.width
282
260
  thing.reload
283
261
  assert_equal Measured::Length.new(2, :cm), thing.width
284
262
  end
285
263
 
286
- test "update_attributes modifies the _value column" do
287
- assert thing.update_attributes(height_value: 2)
264
+ test "update modifies the _value column" do
265
+ assert thing.update(height_value: 2)
288
266
  assert_equal Measured::Length.new(2, :m), thing.height
289
267
  thing.reload
290
268
  assert_equal Measured::Length.new(2, :m), thing.height
291
269
  end
292
270
 
293
- test "update_attributes modifies only the _unit column" do
294
- assert thing.update_attributes(height_unit: "foot")
271
+ test "update modifies only the _unit column" do
272
+ assert thing.update(height_unit: "foot")
295
273
  assert_equal Measured::Length.new(1, :ft), thing.height
296
274
  thing.reload
297
275
  assert_equal Measured::Length.new(1, :ft), thing.height
298
276
  end
299
277
 
300
- test "update_attributes modifies the _unit column to be something invalid" do
301
- assert thing.update_attributes(height_unit: :invalid)
278
+ test "update modifies the _unit column to be something invalid" do
279
+ assert thing.update(height_unit: :invalid)
302
280
  assert_nil thing.height
303
281
  assert_equal "invalid", thing.height_unit
304
282
  thing.reload
@@ -306,8 +284,8 @@ class Measured::Rails::ActiveRecordTest < ActiveSupport::TestCase
306
284
  assert_equal "invalid", thing.height_unit
307
285
  end
308
286
 
309
- test "update_attributes modifies both columns" do
310
- assert thing.update_attributes(height_unit: "mm", height_value: 1.23)
287
+ test "update modifies both columns" do
288
+ assert thing.update(height_unit: "mm", height_value: 1.23)
311
289
  assert_equal Measured::Length.new(1.23, :mm), thing.height
312
290
  thing.reload
313
291
  assert_equal Measured::Length.new(1.23, :mm), thing.height
@@ -17,7 +17,7 @@ class Measured::Rails::ValidationTest < ActiveSupport::TestCase
17
17
  test "validation fails when unit is nil" do
18
18
  thing.length_unit = ''
19
19
  refute thing.valid?
20
- assert_equal({ length: "is not a valid unit" }, thing.errors.to_h)
20
+ assert_equal({ length: ["is not a valid unit"] }, thing.errors.to_hash)
21
21
  end
22
22
 
23
23
  test "validation fails on model with custom unit with nil value" do
@@ -25,11 +25,11 @@ class Measured::Rails::ValidationTest < ActiveSupport::TestCase
25
25
  refute custom_unit_thing.valid?
26
26
  assert_equal(
27
27
  {
28
- length: "is not a valid unit",
29
- width: "is not a valid unit",
30
- height: "is not a valid unit",
28
+ length: ["is not a valid unit"],
29
+ width: ["is not a valid unit"],
30
+ height: ["is not a valid unit"],
31
31
  },
32
- custom_unit_thing.errors.to_h
32
+ custom_unit_thing.errors.to_hash
33
33
  )
34
34
  end
35
35
 
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.5.2
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin McPhillips
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-09 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: measured
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.5.2
19
+ version: 2.6.0
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.5.2
26
+ version: 2.6.0
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: '4.2'
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: '4.2'
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: '4.2'
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: '4.2'
54
+ version: '5.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activerecord
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '4.2'
61
+ version: '5.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '4.2'
68
+ version: '5.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -158,17 +158,17 @@ executables: []
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
+ - ".github/workflows/ci.yml"
161
162
  - ".gitignore"
162
- - ".travis.yml"
163
163
  - CHANGELOG.md
164
164
  - Gemfile
165
165
  - LICENSE
166
166
  - README.md
167
167
  - Rakefile
168
168
  - dev.yml
169
- - gemfiles/rails-5.0.gemfile
170
- - gemfiles/rails-5.1.gemfile
169
+ - gemfiles/rails-5.2.gemfile
171
170
  - gemfiles/rails-6.0.gemfile
171
+ - gemfiles/rails-6.1.gemfile
172
172
  - gemfiles/rails-master.gemfile
173
173
  - lib/measured-rails.rb
174
174
  - lib/measured/rails/active_record.rb
@@ -191,7 +191,8 @@ files:
191
191
  homepage: https://github.com/Shopify/measured-rails
192
192
  licenses:
193
193
  - MIT
194
- metadata: {}
194
+ metadata:
195
+ allowed_push_host: https://rubygems.org
195
196
  post_install_message:
196
197
  rdoc_options: []
197
198
  require_paths:
@@ -1,22 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
- rvm:
5
- - 2.4.9
6
- - 2.5.7
7
- - 2.6.5
8
- - 2.7.0
9
- gemfile:
10
- - Gemfile
11
- - gemfiles/rails-5.0.gemfile
12
- - gemfiles/rails-5.1.gemfile
13
- - gemfiles/rails-6.0.gemfile
14
- - gemfiles/rails-master.gemfile
15
- matrix:
16
- exclude:
17
- - gemfile: gemfiles/rails-master.gemfile
18
- rvm: 2.4.9
19
- - gemfile: gemfiles/rails-6.0.gemfile
20
- rvm: 2.4.9
21
- allow_failures:
22
- - gemfile: gemfiles/rails-master.gemfile