git_stats/spec/git_data/author_spec.rb
2012-10-23 20:37:42 +02:00

25 lines
841 B
Ruby

# -*- encoding : utf-8 -*-
require 'spec_helper'
describe GitStats::GitData::Author do
let(:repo) { build(:repo) }
let(:author) { build(:author, repo: repo) }
let(:other_author) { build(:author, repo: repo) }
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) } }
before { repo.stub(:commits => my_commits + other_commits) }
it 'commits should give repo commits filtered to this author' do
author.commits.should == my_commits
end
it 'should count lines added from short stat' do
author.insertions.should == 50
end
it 'should count lines deleted from short stat' do
author.deletions.should == 100
end
end