Skip to content

Commit

Permalink
Use contributor serializator for index page
Browse files Browse the repository at this point in the history
  • Loading branch information
davydovanton committed Apr 17, 2017
1 parent 85fb098 commit 2ee5da6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/api/controllers/contributors/index.rb
Expand Up @@ -4,6 +4,8 @@ class Index

def call(params)
contributors = repo.all_with_commits_count
.map! { |c| ContributorSerialization.new(c) }

self.body = JSON.generate(
count: contributors.size,
data: contributors
Expand Down
2 changes: 1 addition & 1 deletion spec/api/controllers/contributors/index_spec.rb
Expand Up @@ -31,7 +31,7 @@

it 'contains contributors information' do
expect(json['count']).to eq 1
expect(json['data'].count).to eq 1
expect(json['data']).to eq [{"github"=>"davydovanton", "avatar_url"=>nil, "commits_count"=>1}]
end
end
end

0 comments on commit 2ee5da6

Please sign in to comment.