-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
113 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
module Roar | ||
module JSON | ||
module JSONAPI | ||
VERSION = '0.0.3' | ||
VERSION = '0.0.3' # rubocop:disable Style/MutableConstant | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
begin | ||
require 'rubocop/rake_task' | ||
RuboCop::RakeTask.new(:rubocop) | ||
|
||
task default: [:rubocop] | ||
rescue LoadError | ||
puts 'Rubocop not available' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,39 @@ | |
require 'json' | ||
|
||
class JsonapiCollectionRenderTest < MiniTest::Spec | ||
let(:article) { Article.new(1, 'Health walk', Author.new(2, '[email protected]'), Author.new('editor:1'), [Comment.new('comment:1', 'Ice and Snow'), Comment.new('comment:2', 'Red Stripe Skank')], [Author.new('contributor:1'), Author.new('contributor:2')]) } | ||
let(:article2) { Article.new(2, 'Virgin Ska', Author.new('author:1'), nil, [Comment.new('comment:3', 'Cool song!')], [Author.new('contributor:1'), Author.new('contributor:2')]) } | ||
let(:article3) { Article.new(3, 'Gramo echo', Author.new('author:1'), nil, [Comment.new('comment:4', 'Skalar')], [Author.new('contributor:1'), Author.new('contributor:2')]) } | ||
let(:article) do | ||
Article.new( | ||
1, | ||
'Health walk', | ||
Author.new(2, '[email protected]'), | ||
Author.new('editor:1'), | ||
[Comment.new('comment:1', 'Ice and Snow'), Comment.new('comment:2', 'Red Stripe Skank')], | ||
[Author.new('contributor:1'), Author.new('contributor:2')] | ||
) | ||
end | ||
|
||
let(:article2) do | ||
Article.new( | ||
2, | ||
'Virgin Ska', | ||
Author.new('author:1'), | ||
nil, | ||
[Comment.new('comment:3', 'Cool song!')], | ||
[Author.new('contributor:1'), Author.new('contributor:2')] | ||
) | ||
end | ||
|
||
let(:article3) do | ||
Article.new( | ||
3, | ||
'Gramo echo', | ||
Author.new('author:1'), | ||
nil, | ||
[Comment.new('comment:4', 'Skalar')], | ||
[Author.new('contributor:1'), Author.new('contributor:2')] | ||
) | ||
end | ||
|
||
let(:decorator) { ArticleDecorator.for_collection.new([article, article2, article3]) } | ||
|
||
it 'renders full document' do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,7 +319,7 @@ class DocumentResourceWithDifferentIdAtRoot < Roar::Decorator | |
let(:article) { | ||
klass = Struct.new(:article_id, :title, :summary, :comments, :author) | ||
klass.new(1, 'My Article', 'An interesting read.', comments, | ||
Author.new('a:1', 'Celso', '[email protected]')) | ||
Author.new('a:1', 'Celso', '[email protected]')) | ||
} | ||
|
||
let(:document) { | ||
|
@@ -541,7 +541,7 @@ class DocumentAndRelationWithDifferentId < Roar::Decorator | |
|
||
it do | ||
DocumentAndRelationWithDifferentId.new(article).to_json(include: 'comments') | ||
.must_equal_json document | ||
.must_equal_json document | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters