git_stats/spec/author_spec.rb

17 lines
708 B
Ruby
Raw Normal View History

2012-10-13 12:22:43 +02:00
require 'spec_helper'
describe GitStats::GitData::Author do
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") }
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
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