spyke 5.3.2 → 5.3.3
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 +4 -4
- data/lib/spyke/attribute_assignment.rb +5 -2
- data/lib/spyke/version.rb +1 -1
- data/test/activemodel_dirty_test.rb +12 -0
- data/test/support/fixtures.rb +7 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a23847f907d4ea043e1ec560e1e74f4bedb2cd4d7771b607d325904e80531c0c
|
|
4
|
+
data.tar.gz: 40fd30b87643d2ad61206067644f324e70cdceef6e729fcab56ea40bd164a71e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd4d48776c197d2e2dafbbea11bd5705c32322334b116328c786742632e5a98d61086e370a0e0ad0c8a3b2587e22959fa1280c1e836db3c855e08d68651d9f81
|
|
7
|
+
data.tar.gz: 753de2bd8d0491b041cceac1c8dce57d1ea3dfe6b0115be1f081cbf30b90cf786bc2e47cf2720fa33e78e46494e91b5d243536e91d88690be899dd19d89274cd
|
|
@@ -6,7 +6,6 @@ module Spyke
|
|
|
6
6
|
extend ActiveSupport::Concern
|
|
7
7
|
|
|
8
8
|
included do
|
|
9
|
-
attr_reader :attributes
|
|
10
9
|
delegate :[], :[]=, to: :attributes
|
|
11
10
|
end
|
|
12
11
|
|
|
@@ -40,8 +39,12 @@ module Spyke
|
|
|
40
39
|
yield self if block_given?
|
|
41
40
|
end
|
|
42
41
|
|
|
42
|
+
def attributes
|
|
43
|
+
@spyke_attributes
|
|
44
|
+
end
|
|
45
|
+
|
|
43
46
|
def attributes=(new_attributes)
|
|
44
|
-
@
|
|
47
|
+
@spyke_attributes ||= Attributes.new(scope.params)
|
|
45
48
|
use_setters(new_attributes) if new_attributes
|
|
46
49
|
end
|
|
47
50
|
|
data/lib/spyke/version.rb
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
module Spyke
|
|
4
|
+
class ActiveModelDirtyTest < MiniTest::Test
|
|
5
|
+
def test_attributes_instance_var_compatibility
|
|
6
|
+
recipe = RecipeWithDirty.new(title: 'Cheeseburger')
|
|
7
|
+
|
|
8
|
+
# If @attributes is set on recipe ActiveModel::Dirty will crash
|
|
9
|
+
assert_equal false, recipe.attribute_changed_in_place?(:title)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/test/support/fixtures.rb
CHANGED
|
@@ -152,3 +152,10 @@ module Cookbook
|
|
|
152
152
|
include_root_in_json :foto
|
|
153
153
|
end
|
|
154
154
|
end
|
|
155
|
+
|
|
156
|
+
class RecipeWithDirty < Recipe
|
|
157
|
+
# NOTE: Simply including ActiveModel::Dirty doesn't provide all the dirty
|
|
158
|
+
# functionality. This is left intentionally incomplete as it's all we need
|
|
159
|
+
# for testing compatibility.
|
|
160
|
+
include ActiveModel::Dirty
|
|
161
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spyke
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.3.
|
|
4
|
+
version: 5.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jens Balvig
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -285,6 +285,7 @@ files:
|
|
|
285
285
|
- lib/spyke/scoping.rb
|
|
286
286
|
- lib/spyke/version.rb
|
|
287
287
|
- spyke.gemspec
|
|
288
|
+
- test/activemodel_dirty_test.rb
|
|
288
289
|
- test/associations_test.rb
|
|
289
290
|
- test/attributes_test.rb
|
|
290
291
|
- test/callbacks_test.rb
|
|
@@ -322,6 +323,7 @@ signing_key:
|
|
|
322
323
|
specification_version: 4
|
|
323
324
|
summary: Interact with REST services in an ActiveRecord-like manner
|
|
324
325
|
test_files:
|
|
326
|
+
- test/activemodel_dirty_test.rb
|
|
325
327
|
- test/associations_test.rb
|
|
326
328
|
- test/attributes_test.rb
|
|
327
329
|
- test/callbacks_test.rb
|