hstore_accessor 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 592e1d4cc9607136333c47a39aecafc5591c81b0
4
- data.tar.gz: c5c93b8c441dfea93d0f61c030f58b0f4f1caf7c
3
+ metadata.gz: a9947ed783eebb9457fc7ec4e47df6278dc1e9e8
4
+ data.tar.gz: aeb90a29e1da91b8bec4bcb8fa68678c4a5434bb
5
5
  SHA512:
6
- metadata.gz: c27f4b979405b4c6fbe1aa67de3a3ed0924460daaed0d5002bc5ea320171dc3c448aae24940f90a8a3fdb909e16d48422e7871ca450f017734953cc70b291f94
7
- data.tar.gz: f46afee55e0b917c7e24cdb8a092594502efe177169ff5f06324c6b6ad74b570002be99aaf23a24d0af1a6bcdb86715acff10f83eca1a55b56ffb243e7cca52f
6
+ metadata.gz: ac8573daf232752241a7238afee768809b7b69de96bc63959736122a930b93009a97d818d136acc8ef98c866a5146ebd5444bd30f4eabe7976f2ba3df5730628
7
+ data.tar.gz: dfed111a025d41a09370f25193c4990aa1fe06d5dee6d5a330b6e2588c270c06bfcedb8db9c418c9009be096781c2f16db4bfc796bfac1d0dfb2b1ef45f77174
@@ -0,0 +1 @@
1
+ 2.1.5
@@ -92,7 +92,7 @@ module HstoreAccessor
92
92
  hstore_changes = send("#{hstore_attribute}_change")
93
93
  return if hstore_changes.nil?
94
94
  attribute_changes = hstore_changes.map { |change| change.try(:[], store_key.to_s) }
95
- attribute_changes.compact.present? ? attribute_changes : nil
95
+ attribute_changes.uniq.size == 1 ? nil : attribute_changes
96
96
  end
97
97
 
98
98
  define_method("restore_#{key}!") do
@@ -1,3 +1,3 @@
1
1
  module HstoreAccessor
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
@@ -163,8 +163,9 @@ describe HstoreAccessor do
163
163
  let!(:product_category) { ProductCategory.create!(name: "widget", likes: 2) }
164
164
 
165
165
  before do
166
- product_category.products = Product.all
167
- product_category.save!
166
+ Product.all.to_a.each do |product|
167
+ product_category.products << product
168
+ end
168
169
  end
169
170
 
170
171
  context "eq query" do
@@ -492,7 +493,7 @@ describe HstoreAccessor do
492
493
  product.save!
493
494
  product.reload
494
495
  Time.use_zone(new_york_timezone) do
495
- expect(product.build_timestamp.utc_offset).to eq new_york_timezone.utc_offset
496
+ expect(product.build_timestamp.to_s).to eq timestamp.in_time_zone(new_york_timezone).to_s
496
497
  end
497
498
  end
498
499
  end
@@ -675,12 +676,14 @@ describe HstoreAccessor do
675
676
  product.color = "GREEN"
676
677
  expect(product.color_change).to eq %w(ORANGE GREEN)
677
678
  end
679
+
678
680
  context "when store_key differs from key" do
679
681
  it "returns the old and new values" do
680
682
  product.weight = 100.01
681
683
  expect(product.weight_change[1]).to eq "100.01"
682
684
  end
683
685
  end
686
+
684
687
  context "hstore attribute was nil" do
685
688
  it "returns old and new values" do
686
689
  product.options = nil
@@ -697,6 +700,18 @@ describe HstoreAccessor do
697
700
  product.price = 6
698
701
  expect(product.color_change).to be_nil
699
702
  end
703
+
704
+ it "returns nil when other attributes were changed" do
705
+ product.price = 5
706
+ product.save!
707
+ product = Product.first
708
+
709
+ expect(product.price_change).to be_nil
710
+
711
+ product.color = "red"
712
+
713
+ expect(product.price_change).to be_nil
714
+ end
700
715
  end
701
716
 
702
717
  context "not persisted" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hstore_accessor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Hirn
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-03-16 00:00:00.000000000 Z
15
+ date: 2015-04-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activerecord
@@ -181,6 +181,7 @@ extra_rdoc_files: []
181
181
  files:
182
182
  - ".gitignore"
183
183
  - ".rubocop.yml"
184
+ - ".ruby-version"
184
185
  - Appraisals
185
186
  - Gemfile
186
187
  - LICENSE.txt