2012-10-19 20:27:41 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe GitStats::GitData::Repo do
|
|
|
|
let(:repo) { build(:test_repo, last_commit_hash: '872955c') }
|
|
|
|
|
|
|
|
it 'should gather all files in repo' do
|
|
|
|
repo.files.map(&:filename).should =~ %w(long_second.haml long.txt second.txt test2.rb test.rb test.txt)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should retrieve correct file content for old file' do
|
2012-10-20 22:38:11 +02:00
|
|
|
repo.commits.by_sha('c87ecf9').files.by_filename('test.txt').content.should == "bb
|
2012-10-19 20:27:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test
|
|
|
|
"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should retrieve correct file content for the newest file' do
|
|
|
|
file = repo.files.by_filename('test.txt')
|
|
|
|
file.content.should == "bb
|
|
|
|
|
|
|
|
testtest
|
|
|
|
|
|
|
|
test
|
|
|
|
"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|