hypermodel 0.0.1 → 0.1.0

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.
@@ -3,6 +3,7 @@ require 'json'
3
3
 
4
4
  class PostsControllerTest < ActionController::TestCase
5
5
  def setup
6
+ @blog = Blog.create(title: 'Rants')
6
7
  @post = Post.create(
7
8
  title: "My post",
8
9
  body: "Foo bar baz.",
@@ -14,10 +15,11 @@ class PostsControllerTest < ActionController::TestCase
14
15
  reviews: [
15
16
  Review.create(body: 'This is bad'),
16
17
  Review.create(body: 'This is good'),
17
- ]
18
+ ],
19
+ blog_id: @blog.id
18
20
  )
19
21
 
20
- post :show, { id: @post.id, format: :json }
22
+ post :show, { blog_id: @blog.id, id: @post.id, format: :json }
21
23
  end
22
24
 
23
25
  test "it returns a successful response" do
@@ -26,12 +28,18 @@ class PostsControllerTest < ActionController::TestCase
26
28
 
27
29
  test "returns the post" do
28
30
  body = JSON.load(response.body)
31
+ pp body
29
32
 
30
33
  assert_equal @post.id.to_s, body['_id']
31
34
  assert_equal 'My post', body['title']
32
35
  assert_equal 'Foo bar baz.', body['body']
33
36
  end
34
37
 
38
+ test "returns the parent blog" do
39
+ body = JSON.load(response.body)
40
+ assert_equal blog_url(@blog), body['_links']['blog']['href']
41
+ end
42
+
35
43
  test "returns the embedded comments" do
36
44
  body = JSON.load(response.body)
37
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hypermodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-18 00:00:00.000000000 Z
12
+ date: 2012-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -67,6 +67,7 @@ executables: []
67
67
  extensions: []
68
68
  extra_rdoc_files: []
69
69
  files:
70
+ - lib/hypermodel/resource.rb
70
71
  - lib/hypermodel/responder.rb
71
72
  - lib/hypermodel/serializers/mongoid.rb
72
73
  - lib/hypermodel/version.rb
@@ -81,6 +82,7 @@ files:
81
82
  - test/dummy/app/controllers/posts_controller.rb
82
83
  - test/dummy/app/helpers/application_helper.rb
83
84
  - test/dummy/app/models/author.rb
85
+ - test/dummy/app/models/blog.rb
84
86
  - test/dummy/app/models/comment.rb
85
87
  - test/dummy/app/models/post.rb
86
88
  - test/dummy/app/models/review.rb
@@ -126,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
128
  version: '0'
127
129
  segments:
128
130
  - 0
129
- hash: -711433516152694820
131
+ hash: 3863888300103512107
130
132
  required_rubygems_version: !ruby/object:Gem::Requirement
131
133
  none: false
132
134
  requirements:
@@ -135,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
137
  version: '0'
136
138
  segments:
137
139
  - 0
138
- hash: -711433516152694820
140
+ hash: 3863888300103512107
139
141
  requirements: []
140
142
  rubyforge_project:
141
143
  rubygems_version: 1.8.21
@@ -150,6 +152,7 @@ test_files:
150
152
  - test/dummy/app/controllers/posts_controller.rb
151
153
  - test/dummy/app/helpers/application_helper.rb
152
154
  - test/dummy/app/models/author.rb
155
+ - test/dummy/app/models/blog.rb
153
156
  - test/dummy/app/models/comment.rb
154
157
  - test/dummy/app/models/post.rb
155
158
  - test/dummy/app/models/review.rb
@@ -181,3 +184,4 @@ test_files:
181
184
  - test/dummy/script/rails
182
185
  - test/hypermodel_test.rb
183
186
  - test/test_helper.rb
187
+ has_rdoc: