Sha256: 7e087e36f3cdfdf47c81d5e3cdc95b0b0f449a137c1332e0f5875a3f6f58dc2e

Contents?: true

Size: 1.99 KB

Versions: 10

Compression:

Stored size: 1.99 KB

Contents

# -*- encoding : utf-8 -*-
require 'integration/shared'

describe GitStats::GitData::Repo do
  include_context "shared"

  it 'should gather all authors' do
    repo.authors.should =~ expected_authors
  end

  it 'should calculate correct commits period' do
    repo.commits_period.should == [DateTime.parse('2012-10-19 10:44:34 +0200'), DateTime.parse('2012-10-26 17:05:25 +0200')]
  end

  it 'should gather all commits sorted by date' do
    repo.commits.map(&:sha).should =~ %w(b3b4f81 d60b5ec ab47ef8 2c11f5e c87ecf9 b621a5d fd66657 81e8bef 4e7d0e9 872955c)
  end

  it 'should return project name from dir' do
    repo.project_name.should == 'test_repo'
  end

  it 'should return project version as last commit hash' do
    repo.project_version.should == '872955c'
  end

  it 'should count files in repo' do
    repo.files_count.should == 6
  end

  it 'should count files by date' do
    repo.files_count_by_date.keys == Hash[commit_dates_with_empty.zip [1, 2, 2, 3, 3, 4, 5, 5, 6, 6]]
  end

  it 'should count lines by date' do
    repo.files_count_by_date.values == Hash[commit_dates_with_empty.zip [1, 2, 2, 3, 3, 4, 5, 5, 6, 6]]
  end

  it 'should count all lines in repo' do
    repo.lines_count.should == 1114
  end

  it 'should count files by extension in repo' do
    repo.files_by_extension_count.should == {'.haml' => 1, '.txt' => 3, '.rb' => 2}
  end

  it 'should count lines by extension in repo' do
    repo.lines_by_extension.should == {'.haml' => 100, '.txt' => 1008, '.rb' => 6}
  end

  it 'should count commits_count_by_author' do
    repo.commits_count_by_author.keys.should == expected_authors
    repo.commits_count_by_author.values.should == [8, 2]
  end

  it 'should count lines_added_by_author' do
    repo.insertions_by_author.keys.should == expected_authors
    repo.insertions_by_author.values.should == [1021, 103]
  end

  it 'should count lines_deleted_by_author' do
    repo.deletions_by_author.keys.should == expected_authors
    repo.deletions_by_author.values.should == [10, 0]
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
git_stats-1.0.16 spec/integration/repo_spec.rb
git_stats-1.0.15 spec/integration/repo_spec.rb
git_stats-1.0.14 spec/integration/repo_spec.rb
git_stats-1.0.13 spec/integration/repo_spec.rb
git_stats-1.0.12 spec/integration/repo_spec.rb
git_stats-1.0.11 spec/integration/repo_spec.rb
git_stats-1.0.10 spec/integration/repo_spec.rb
git_stats-1.0.9 spec/integration/repo_spec.rb
git_stats-1.0.8 spec/integration/repo_spec.rb
git_stats-1.0.7 spec/integration/repo_spec.rb