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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2321a4ffd56617ec8f489fbe3ddb96061c4ece5f
4
- data.tar.gz: f7f97d6d1b1356db71a0f384e8c5257ffe81f9ef
3
+ metadata.gz: cad85c078caa849ff351e6f096085b23bc3aa447
4
+ data.tar.gz: 8a28b48d15894f136d3b95f67c071fd2b9e2989e
5
5
  SHA512:
6
- metadata.gz: 6d7f5283de00b250dae9734458d8ef06ceb20705b99f809ec321a5d5701520342ec78114b8d1c9902c4bae75b482050c750ac22fef551c6850fee055083bea3a
7
- data.tar.gz: 61c0cfe2bd04c618512da051ac1c4c35de569b5ba6dc5405580aea0615c2d04377967c4e3c5bf2dd6a0998c1c34284a012eed504169e8399fcb70cb6e307a098
6
+ metadata.gz: e17e259553eb5310cac7194d4711047486b26a1021da2ea43c2fa5a8813b0b0a57fed1c7411232fb8e33670560572878f05e1b9b366f94b213b47ef25d580c22
7
+ data.tar.gz: 6deb4d9939c5e818c4d29287024b794e8dba9c2be7abb61d53bedd7db740281a771c25a7e3c9e3cbe867d7d32539192419d83d93fb1a5f378c83ce19c52c2067
@@ -53,7 +53,9 @@ module Spyke
53
53
  end
54
54
 
55
55
  def reflect_on_association(name)
56
- Relation.new(name.to_s.classify.constantize) # Just enough to support nested_form gem
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
@@ -1,3 +1,3 @@
1
1
  module Spyke
2
- VERSION = '1.8.4'
2
+ VERSION = '1.8.5'
3
3
  end
@@ -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
- skip 'wishlisted'
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
 
@@ -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
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-16 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport