git_stats/spec/git_data/author_spec.rb

26 lines
841 B
Ruby
Raw Normal View History

2012-10-23 20:37:42 +02:00
# -*- encoding : utf-8 -*-
2012-10-13 12:22:43 +02:00
require 'spec_helper'
describe GitStats::GitData::Author do
2012-10-16 20:52:22 +02:00
let(:repo) { build(:repo) }
let(:author) { build(:author, repo: repo) }
let(:other_author) { build(:author, repo: repo) }
2012-10-20 22:38:11 +02:00
let(:my_commits) { 10.times.map { |i| double("my_commit #{i}", author: author, short_stat: double("my_short_stat #{i}", insertions: 5, deletions: 10)) } }
let(:other_commits) { 10.times.map { |i| double("other_commit #{i}", author: other_author) } }
2012-10-13 13:27:15 +02:00
before { repo.stub(:commits => my_commits + other_commits) }
2012-10-13 12:22:43 +02:00
it 'commits should give repo commits filtered to this author' do
author.commits.should == my_commits
end
2012-10-20 22:38:11 +02:00
it 'should count lines added from short stat' do
2012-10-21 23:03:41 +02:00
author.insertions.should == 50
2012-10-20 22:38:11 +02:00
end
it 'should count lines deleted from short stat' do
2012-10-21 23:03:41 +02:00
author.deletions.should == 100
2012-10-20 22:38:11 +02:00
end
2012-10-13 12:22:43 +02:00
2012-10-23 20:37:42 +02:00
end