conglomerate 0.1.1 → 0.2.0

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: e38daf11ae81750e9556260e06001b9c8510a7d5
4
- data.tar.gz: 0c7edf5b484cbd0d4c3d3953fef6ab1cbffda34f
3
+ metadata.gz: 39ff3bd7063846051708c677ab9f8c3c0ebe0d5d
4
+ data.tar.gz: 24433fc68163aebbbf567868edc05e807a07cf88
5
5
  SHA512:
6
- metadata.gz: 97da55cdc7a6e5128d2317779d3e44a4339a7fc11e7d09c1e2d34cf56449778062adec8dc8ed5a1cfa838e78803ce3669626ab73efb705a3f55b74f5770c669c
7
- data.tar.gz: 3a7d31e8647b1d367b8cebc6039dd1547d1fe03dad3fca2fd32f04e8521b10947eefc1db46310fa8a8b6d60f4ae62804418faba9755c4db284fd15a63b2fe879
6
+ metadata.gz: 2bf22794559d3319db96ffe11989ef093eed2f3402dcc435c645220663dabbb140c980e9eb938163baa4ab0f0cf695bcf3c3d7dc019e9c562c95c9a98c5ae8f6
7
+ data.tar.gz: a82de2fe1c7dd8e60cf911b32eb914a07ba258508af060407d86e1372183a583240b192cd66cc6379a16edcaaef026085e335a783e4f0396fd858bebe50da651
@@ -189,7 +189,7 @@ module Conglomerate
189
189
  attr_writer :_href, :_item_href, :_queries, :_attributes, :_links
190
190
 
191
191
  def _href
192
- @_href || Proc.new { request.original_url }
192
+ @_href || Proc.new { raise ArgumentError, "You must include an href" }
193
193
  end
194
194
 
195
195
  def _item_href
@@ -1,3 +1,3 @@
1
1
  module Conglomerate
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -34,11 +34,18 @@ end
34
34
  class ConglomerateExtraTestSerializer
35
35
  include Conglomerate.serializer
36
36
 
37
+ href { "" }
37
38
  attribute :id
38
39
  end
39
40
 
40
41
  class ConglomerateNullSerializer
41
42
  include Conglomerate.serializer
43
+
44
+ href { "" }
45
+ end
46
+
47
+ class ConglomerateInvalidSerializer
48
+ include Conglomerate.serializer
42
49
  end
43
50
 
44
51
  describe Conglomerate do
@@ -89,12 +96,18 @@ describe Conglomerate do
89
96
  ConglomerateNullSerializer.new(object, :context => context).serialize
90
97
  end
91
98
 
99
+ let(:invalid_serializer) do
100
+ ConglomerateInvalidSerializer.new(object, :context => context).serialize
101
+ end
102
+
92
103
  let(:test_collection) { test_serializer["collection"] }
93
104
 
94
105
  let(:extra_test_collection) { extra_test_serializer["collection"] }
95
106
 
96
107
  let(:null_collection) { null_serializer["collection"] }
97
108
 
109
+ let(:invalid_collection) { invalid_serializer["collection"] }
110
+
98
111
  describe "#version" do
99
112
  it "sets version to 1.0" do
100
113
  expect(null_collection["version"]).to eq("1.0")
@@ -107,8 +120,8 @@ describe Conglomerate do
107
120
  expect(test_collection["href"]).to eq("abc")
108
121
  end
109
122
 
110
- it "uses 'request.original_url' if preset 'rails_current_url' used" do
111
- expect(extra_test_collection["href"]).to eq("https://example.com/items")
123
+ it "errors if no href given" do
124
+ expect { invalid_collection["href"] }.to raise_error
112
125
  end
113
126
  end
114
127
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conglomerate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Emmons
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-31 00:00:00.000000000 Z
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler