2012-10-13 12:22:43 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe GitStats::GitData::Author do
|
2012-10-13 15:32:06 +02:00
|
|
|
let(:repo) { GitStats::GitData::Repo.new("repo_path") }
|
2012-10-13 13:27:15 +02:00
|
|
|
let(:author) { GitStats::GitData::Author.new(repo: repo, name: "author1", email: "author1@gmail.com") }
|
|
|
|
let(:other_author) { GitStats::GitData::Author.new(repo: repo, name: "author2", email: "author2@gmail.com") }
|
2012-10-13 14:31:52 +02:00
|
|
|
let(:my_commits) { 10.times.map { |i| double("my_commit #{i}", :author => author) } }
|
|
|
|
let(:other_commits) { 10.times.map { |i| double("other_commit #{i}", :author => other_author) } }
|
2012-10-13 13:27:15 +02:00
|
|
|
|
2012-10-13 14:31:52 +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
|
|
|
|
|
|
|
|
|
|
|
|
end
|