spyke 1.8.4 → 1.8.5
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/associations.rb +3 -1
- data/lib/spyke/version.rb +1 -1
- data/test/associations_test.rb +8 -1
- data/test/support/webmock.rb +9 -0
- data/test/test_helper.rb +0 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cad85c078caa849ff351e6f096085b23bc3aa447
|
4
|
+
data.tar.gz: 8a28b48d15894f136d3b95f67c071fd2b9e2989e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e17e259553eb5310cac7194d4711047486b26a1021da2ea43c2fa5a8813b0b0a57fed1c7411232fb8e33670560572878f05e1b9b366f94b213b47ef25d580c22
|
7
|
+
data.tar.gz: 6deb4d9939c5e818c4d29287024b794e8dba9c2be7abb61d53bedd7db740281a771c25a7e3c9e3cbe867d7d32539192419d83d93fb1a5f378c83ce19c52c2067
|
data/lib/spyke/associations.rb
CHANGED
@@ -53,7 +53,9 @@ module Spyke
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def reflect_on_association(name)
|
56
|
-
|
56
|
+
# Just enough to support nested_form gem
|
57
|
+
assoc = associations[name] || associations[name.to_s.pluralize.to_sym]
|
58
|
+
Association.new(nil, name, assoc)
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
data/lib/spyke/version.rb
CHANGED
data/test/associations_test.rb
CHANGED
@@ -144,6 +144,13 @@ module Spyke
|
|
144
144
|
assert_equal 1, recipe.groups.first.recipe_id
|
145
145
|
end
|
146
146
|
|
147
|
+
def test_destroy_has_many_association
|
148
|
+
endpoint = stub_request(:delete, 'http://sushi.com/recipes/1/groups/2')
|
149
|
+
recipe = Recipe.new(id: 1)
|
150
|
+
recipe.groups.destroy(2)
|
151
|
+
assert_requested endpoint
|
152
|
+
end
|
153
|
+
|
147
154
|
def test_changing_attributes_directly_after_build_on_has_many_association
|
148
155
|
recipe = Recipe.new(id: 1)
|
149
156
|
recipe.groups.build(name: 'Dessert')
|
@@ -341,7 +348,7 @@ module Spyke
|
|
341
348
|
|
342
349
|
def test_reflect_on_association
|
343
350
|
assert_equal Group, Recipe.reflect_on_association(:group).klass
|
344
|
-
|
351
|
+
assert_equal Cookbook::Like, Cookbook::Tip.reflect_on_association(:like).klass
|
345
352
|
assert_equal Recipe, Recipe.reflect_on_association(:alternate).klass
|
346
353
|
end
|
347
354
|
|
data/test/support/webmock.rb
CHANGED
@@ -1,6 +1,15 @@
|
|
1
|
+
require 'webmock/minitest'
|
2
|
+
|
1
3
|
class WebMock::RequestStub
|
2
4
|
def to_return_json(hash, options = {})
|
3
5
|
options[:body] = MultiJson.dump(hash)
|
4
6
|
to_return(options)
|
5
7
|
end
|
6
8
|
end
|
9
|
+
|
10
|
+
# Don't raise but report uncaught net connections
|
11
|
+
WebMock.allow_net_connect!
|
12
|
+
WebMock.stub_request(:any, /.*/).to_return do |request|
|
13
|
+
puts "\e[35mUNSTUBBED REQUEST:\e[0m #{request.method.upcase} #{request.uri}"
|
14
|
+
{ body: nil }
|
15
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -9,17 +9,9 @@ require 'minitest/reporters'
|
|
9
9
|
require 'mocha/mini_test'
|
10
10
|
require 'multi_json'
|
11
11
|
require 'pry'
|
12
|
-
require 'webmock/minitest'
|
13
12
|
|
14
13
|
# Require support files
|
15
14
|
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }
|
16
15
|
|
17
16
|
# Pretty colors
|
18
17
|
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
19
|
-
|
20
|
-
# Don't raise but report uncaught net connections
|
21
|
-
WebMock.allow_net_connect!
|
22
|
-
WebMock.stub_request(:any, /.*/).to_return do |request|
|
23
|
-
puts "\e[35mUNSTUBBED REQUEST:\e[0m #{request.method.upcase} #{request.uri}"
|
24
|
-
{ body: nil }
|
25
|
-
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: 1.8.
|
4
|
+
version: 1.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Balvig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|