spyke 5.3.2 → 5.3.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
  SHA256:
3
- metadata.gz: 7b4cc7a2c704c8dd15ed7c5aaa2f0f19e198643ea5ee5f91de7d5842da4b6c9b
4
- data.tar.gz: 1b92e7a21d361198245a969be7e27635cafecfa17b3001649b0cb07d7f4ccc42
3
+ metadata.gz: a23847f907d4ea043e1ec560e1e74f4bedb2cd4d7771b607d325904e80531c0c
4
+ data.tar.gz: 40fd30b87643d2ad61206067644f324e70cdceef6e729fcab56ea40bd164a71e
5
5
  SHA512:
6
- metadata.gz: f8748c573657622a373d25a234a2fc628385601a4651f2ce7308aebf929909b0c4bd4eb06aa24ccf7378e3dd3fa469a9b598457b2faf0092646ffba2a257b2a3
7
- data.tar.gz: 05f35ee6a8e7d11755c784c0903e83de0f970f4b071108048045c1570009a5cc514d7ea8121b8b26a125f24b06db08b5138a65e52899b61d4c0e8929351603d7
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
- @attributes ||= Attributes.new(scope.params)
47
+ @spyke_attributes ||= Attributes.new(scope.params)
45
48
  use_setters(new_attributes) if new_attributes
46
49
  end
47
50
 
@@ -1,3 +1,3 @@
1
1
  module Spyke
2
- VERSION = '5.3.2'
2
+ VERSION = '5.3.3'
3
3
  end
@@ -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
@@ -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.2
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-10-01 00:00:00.000000000 Z
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