@@ -119,7 +119,7 @@ def as_jsonapi(options = {})
119119 end
120120end
121121
122- describe JSONAPI , '#render' do
122+ describe JSONAPI :: Renderer , '#render' do
123123 before ( :all ) do
124124 @users = [
125125 UserResource . new ( 1 , 'User 1' , '123 Example st.' , [ ] ) ,
@@ -137,7 +137,7 @@ def as_jsonapi(options = {})
137137 end
138138
139139 it 'renders nil' do
140- actual = JSONAPI . render ( data : nil )
140+ actual = subject . render ( data : nil )
141141 expected = {
142142 data : nil
143143 }
@@ -146,7 +146,7 @@ def as_jsonapi(options = {})
146146 end
147147
148148 it 'renders an empty array' do
149- actual = JSONAPI . render ( data : [ ] )
149+ actual = subject . render ( data : [ ] )
150150 expected = {
151151 data : [ ]
152152 }
@@ -155,7 +155,7 @@ def as_jsonapi(options = {})
155155 end
156156
157157 it 'renders a single resource' do
158- actual = JSONAPI . render ( data : @users [ 0 ] )
158+ actual = subject . render ( data : @users [ 0 ] )
159159 expected = {
160160 data : {
161161 type : 'users' ,
@@ -193,7 +193,7 @@ def as_jsonapi(options = {})
193193 end
194194
195195 it 'renders a collection of resources' do
196- actual = JSONAPI . render ( data : [ @users [ 0 ] ,
196+ actual = subject . render ( data : [ @users [ 0 ] ,
197197 @users [ 1 ] ] )
198198 expected = {
199199 data : [
@@ -264,7 +264,7 @@ def as_jsonapi(options = {})
264264 end
265265
266266 it 'renders included relationships' do
267- actual = JSONAPI . render ( data : @users [ 0 ] ,
267+ actual = subject . render ( data : @users [ 0 ] ,
268268 include : 'posts' )
269269 expected = {
270270 data : {
@@ -325,7 +325,7 @@ def as_jsonapi(options = {})
325325 end
326326
327327 it 'filters out fields' do
328- actual = JSONAPI . render ( data : @users [ 0 ] ,
328+ actual = subject . render ( data : @users [ 0 ] ,
329329 fields : { users : [ :name ] } )
330330 expected = {
331331 data : {
@@ -347,7 +347,7 @@ def as_jsonapi(options = {})
347347 end
348348
349349 it 'renders a toplevel meta' do
350- actual = JSONAPI . render ( data : nil ,
350+ actual = subject . render ( data : nil ,
351351 meta : { this : 'is_meta' } )
352352 expected = {
353353 data : nil ,
@@ -358,7 +358,7 @@ def as_jsonapi(options = {})
358358 end
359359
360360 it 'renders toplevel links' do
361- actual = JSONAPI . render ( data : nil ,
361+ actual = subject . render ( data : nil ,
362362 links : { self : 'http://api.example.com/users' } )
363363 expected = {
364364 data : nil ,
@@ -369,7 +369,7 @@ def as_jsonapi(options = {})
369369 end
370370
371371 it 'renders a toplevel jsonapi object' do
372- actual = JSONAPI . render ( data : nil ,
372+ actual = subject . render ( data : nil ,
373373 jsonapi : {
374374 version : '1.0' ,
375375 meta : 'For real'
@@ -386,7 +386,7 @@ def as_jsonapi(options = {})
386386 end
387387
388388 it 'renders an empty hash if neither errors nor data provided' do
389- actual = JSONAPI . render ( { } )
389+ actual = subject . render ( { } )
390390 expected = { }
391391
392392 expect ( actual ) . to eq ( expected )
@@ -406,7 +406,7 @@ def as_jsonapi
406406 it 'renders errors' do
407407 errors = [ ErrorResource . new ( '1' , 'Not working' ) ,
408408 ErrorResource . new ( '2' , 'Works poorly' ) ]
409- actual = JSONAPI . render ( errors : errors )
409+ actual = subject . render ( errors : errors )
410410 expected = {
411411 errors : [ { id : '1' , title : 'Not working' } ,
412412 { id : '2' , title : 'Works poorly' } ]
0 commit comments