superstore 2.4.0 → 2.4.1

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: 5684a72108f25316fd6cfc5b187f1f637cf86ed6
4
- data.tar.gz: 8ec22cebf483751984796e2b5ab9f6f4ca312ffe
3
+ metadata.gz: d67c4ca714fea17a25c063f07f8afa5be165e084
4
+ data.tar.gz: 225ecaa179c93d680697c38eb2c3f95f3970aa4a
5
5
  SHA512:
6
- metadata.gz: 5c6e4a89c79f90fa7c79eba4fdf42fbf10fba8c85a92a23643dd6bbb717ff30d90983a399202fb7889a6399bf393a426fe01a87dde9d9a64404269e21b860f46
7
- data.tar.gz: 0cd0147c2951aae69c0e340c91d91da881a5c19ce2402fbaefb460316b946f735d2a0765c63780d72d5d77bf02bb9e20c287220709fbc956a09964da8ad8189e
6
+ metadata.gz: 4829d5057189c613fd5501e2c27adcdba3d12aaa45198bdc19aadf06cf7262a3787393e34a58f3d26f22d3b267fa4c3dc68e8d12e9f4548f9078f05359a0e220
7
+ data.tar.gz: 106a4a274f4fdad36df79ec7b1820a1a478c0e0367aaee884380227750cdd8efecbac76ba47d5cc895cd6709cc0a0a3b2bb94be93a948edc59ae42a5c4b45b5a
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
+ .bundle
1
2
  Gemfile*.lock
2
3
  *.gem
@@ -1,3 +1,11 @@
1
+ # 2.4.0
2
+
3
+ Released 2016-08-10.
4
+
5
+ ## New Features
6
+
7
+ * Rails 5 compatibility (#19)
8
+
1
9
  # 2.3.0
2
10
 
3
11
  Released 2016-06-29.
@@ -12,7 +20,7 @@ Released 2016-06-02.
12
20
 
13
21
  ## New Features
14
22
 
15
- * Add `geo_point` type.
23
+ * Add `geo_point` type (#18)
16
24
 
17
25
  # 2.1.2
18
26
 
@@ -136,7 +136,6 @@ module Superstore
136
136
  private
137
137
 
138
138
  def create_self
139
- @new_record = false
140
139
  write :insert_record
141
140
  end
142
141
 
@@ -145,6 +144,7 @@ module Superstore
145
144
  end
146
145
 
147
146
  def write(method)
147
+ @new_record = false
148
148
  self.class.send(method, id, unapplied_changes)
149
149
  end
150
150
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'superstore'
5
- s.version = '2.4.0'
5
+ s.version = '2.4.1'
6
6
  s.description = 'ActiveModel-based JSONB document store'
7
7
  s.summary = 'ActiveModel for JSONB documents'
8
8
  s.authors = ['Michael Koziarski', 'Infogroup']
@@ -5,7 +5,15 @@ class Superstore::CallbacksTest < Superstore::TestCase
5
5
  self.table_name = 'issues'
6
6
  string :description
7
7
 
8
- %w(before_validation after_validation after_save after_create after_update after_destroy).each do |method|
8
+ %w(
9
+ before_validation
10
+ after_validation
11
+ before_save
12
+ after_save
13
+ after_create
14
+ after_update
15
+ after_destroy
16
+ ).each do |method|
9
17
  send(method) do
10
18
  callback_history << method
11
19
  end
@@ -23,7 +31,14 @@ class Superstore::CallbacksTest < Superstore::TestCase
23
31
  test 'create' do
24
32
  issue = TestIssue.create
25
33
 
26
- assert_equal ['before_validation', 'after_validation', 'after_save', 'after_create'], issue.callback_history
34
+ expected = %w(
35
+ before_validation
36
+ after_validation
37
+ before_save
38
+ after_save
39
+ after_create
40
+ )
41
+ assert_equal expected, issue.callback_history
27
42
  end
28
43
 
29
44
  test 'update' do
@@ -32,7 +47,7 @@ class Superstore::CallbacksTest < Superstore::TestCase
32
47
 
33
48
  issue.update_attribute :description, 'foo'
34
49
 
35
- assert_equal ['after_save', 'after_update'], issue.callback_history
50
+ assert_equal %w(before_save after_save after_update), issue.callback_history
36
51
  end
37
52
 
38
53
  test 'destroy' do
@@ -43,4 +58,26 @@ class Superstore::CallbacksTest < Superstore::TestCase
43
58
 
44
59
  assert_equal ['after_destroy'], issue.callback_history
45
60
  end
61
+
62
+ test 'new_record during callbacks' do
63
+ class NewRecordTestClass < Superstore::Base
64
+ self.table_name = 'issues'
65
+ string :description
66
+
67
+ before_create :expect_new_record
68
+ before_save :expect_new_record
69
+ after_create :refute_new_record
70
+ after_save :refute_new_record
71
+
72
+ def expect_new_record
73
+ raise "Expected new_record? to be true!" unless new_record?
74
+ end
75
+
76
+ def refute_new_record
77
+ raise "Expected new_record? to be false!" if new_record?
78
+ end
79
+ end
80
+
81
+ NewRecordTestClass.create
82
+ end
46
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Koziarski
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-10 00:00:00.000000000 Z
12
+ date: 2016-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel