Skip to content

Commit 97719a0

Browse files
committed
Clear some warnings and test against Ruby 2.7
1 parent daaba73 commit 97719a0

8 files changed

Lines changed: 17 additions & 13 deletions

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ inherit_from:
22
- https://shopify.github.io/ruby-style-guide/rubocop.yml
33

44
AllCops:
5-
TargetRubyVersion: 2.6
5+
TargetRubyVersion: 2.4

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ language: ruby
33
rvm:
44
- 2.4
55
- 2.6
6+
- 2.7
67

78
gemfile:
89
- gemfiles/Gemfile.rails52

dev.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name: identity-cache
33
up:
44
- homebrew:
55
- postgresql
6-
- ruby: 2.4.10
6+
- mysql-client@5.7:
7+
or: [mysql@5.7]
8+
conflicts: [mysql-connector-c, mysql, mysql-client]
9+
- ruby: 2.6.5
710
- railgun
811
- bundler
912

identity_cache.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Gem::Specification.new do |gem|
4848
else
4949
gem.add_development_dependency('cityhash', '0.6.0')
5050
gem.add_development_dependency('mysql2')
51-
gem.add_development_dependency('pg', '~> 0.18')
51+
gem.add_development_dependency('pg')
5252
gem.add_development_dependency('stackprof')
5353
end
5454
end

test/attribute_cache_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ def test_cached_attribute_values_are_expired_from_the_cache_when_a_new_record_is
8080
def test_value_coercion
8181
assert_queries(1) { assert_equal 'foo', AssociatedRecord.fetch_name_by_id(@record.id.to_f) }
8282
assert_no_queries { assert_equal 'foo', AssociatedRecord.fetch_name_by_id(@record.id) }
83-
@record.update_attributes!(name: 'bar')
83+
@record.update!(name: 'bar')
8484
assert_queries(1) { assert_equal 'bar', AssociatedRecord.fetch_name_by_id(@record.id.to_f) }
8585
end
8686

8787
def test_no_nil_empty_string_cache_key_conflict
8888
Item.cache_attribute(:id, by: [:title])
89-
@parent.update_attributes!(title: "")
89+
@parent.update!(title: "")
9090
assert_queries(1) { assert_equal @parent.id, Item.fetch_id_by_title("") }
9191
assert_queries(1) { assert_nil Item.fetch_id_by_title(nil) }
92-
@parent.update_attributes!(title: nil)
92+
@parent.update!(title: nil)
9393
assert_queries(1) { assert_nil Item.fetch_id_by_title("") }
9494
assert_queries(1) { assert_equal @parent.id, Item.fetch_id_by_title(nil) }
9595
end

test/fetch_multi_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def test_fetch_multi_after_expiring_a_record
270270

271271
def test_fetch_multi_id_coercion
272272
assert_equal(@joe.title, Item.fetch_multi(@joe.id.to_f).first.title)
273-
@joe.update_attributes!(title: "#{@joe.title} changed")
273+
@joe.update!(title: "#{@joe.title} changed")
274274

275275
assert_equal(@joe.title, Item.fetch_multi(@joe.id.to_f).first.title)
276276
end

test/lazy_load_associated_classes_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_cache_invalidation
2828
assert_queries(0) do
2929
assert_equal 'baz', Item.fetch(item.id).fetch_associated_records.first.name
3030
end
31-
associated_record.update_attributes!(name: 'buzz')
31+
associated_record.update!(name: 'buzz')
3232
assert_queries(2) do
3333
assert_equal 'buzz', Item.fetch(item.id).fetch_associated_records.first.name
3434
end

test/prefetch_associations_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def test_prefetch_associations_without_using_cache
8080

8181
def test_prefetch_associations_cached_belongs_to
8282
Item.send(:cache_belongs_to, :item)
83-
@bob.update_attributes!(item_id: @joe.id)
84-
@joe.update_attributes!(item_id: @fred.id)
83+
@bob.update!(item_id: @joe.id)
84+
@joe.update!(item_id: @fred.id)
8585
@bob.fetch_item
8686
@joe.fetch_item
8787
items = [@bob, @joe].map(&:reload)
@@ -101,8 +101,8 @@ def test_prefetch_associations_cached_belongs_to
101101

102102
def test_prefetch_associations_notifies_about_hydration
103103
Item.send(:cache_belongs_to, :item)
104-
@bob.update_attributes!(item_id: @joe.id)
105-
@joe.update_attributes!(item_id: @fred.id)
104+
@bob.update!(item_id: @joe.id)
105+
@joe.update!(item_id: @fred.id)
106106
@bob.fetch_item
107107
@joe.fetch_item
108108
items = [@bob, @joe].map(&:reload)
@@ -119,7 +119,7 @@ def test_prefetch_associations_notifies_about_hydration
119119

120120
def test_prefetch_associations_with_nil_cached_belongs_to
121121
Item.send(:cache_belongs_to, :item)
122-
@bob.update_attributes!(item_id: 1234)
122+
@bob.update!(item_id: 1234)
123123
assert_nil(@bob.fetch_item)
124124

125125
assert_no_queries do

0 commit comments

Comments
 (0)