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 +4 -4
- data/.ruby-version +1 -0
- data/lib/hstore_accessor/macro.rb +1 -1
- data/lib/hstore_accessor/version.rb +1 -1
- data/spec/hstore_accessor_spec.rb +18 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9947ed783eebb9457fc7ec4e47df6278dc1e9e8
|
4
|
+
data.tar.gz: aeb90a29e1da91b8bec4bcb8fa68678c4a5434bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac8573daf232752241a7238afee768809b7b69de96bc63959736122a930b93009a97d818d136acc8ef98c866a5146ebd5444bd30f4eabe7976f2ba3df5730628
|
7
|
+
data.tar.gz: dfed111a025d41a09370f25193c4990aa1fe06d5dee6d5a330b6e2588c270c06bfcedb8db9c418c9009be096781c2f16db4bfc796bfac1d0dfb2b1ef45f77174
|
data/.ruby-version
ADDED
@@ -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.
|
95
|
+
attribute_changes.uniq.size == 1 ? nil : attribute_changes
|
96
96
|
end
|
97
97
|
|
98
98
|
define_method("restore_#{key}!") do
|
@@ -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
|
-
|
167
|
-
|
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.
|
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.
|
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-
|
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
|