2012-10-23 20:37:42 +02:00
|
|
|
# -*- encoding : utf-8 -*-
|
2012-10-21 22:41:54 +02:00
|
|
|
require 'integration/shared'
|
2012-10-19 20:27:41 +02:00
|
|
|
|
|
|
|
describe GitStats::GitData::Repo do
|
2012-10-21 22:41:54 +02:00
|
|
|
include_context "shared"
|
2012-10-19 20:27:41 +02:00
|
|
|
|
|
|
|
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
|
2014-06-22 15:45:55 +02:00
|
|
|
repo.commits.first! { |c| c.sha == 'c87ecf9' }.files.first! { |f| f.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
|
2014-06-22 15:45:55 +02:00
|
|
|
file = repo.files.first! { |f| f.filename == 'test.txt' }
|
2012-10-19 20:27:41 +02:00
|
|
|
file.content.should == "bb
|
|
|
|
|
|
|
|
testtest
|
|
|
|
|
|
|
|
test
|
|
|
|
"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-10-23 20:37:42 +02:00
|
|
|
end
|