Sha256: 5aac6652f2365db00514adfd8a786b2e60bfa91d906a43f9e179a7f9ed667e09

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

# -*- encoding : utf-8 -*-
require 'spec_helper'

describe GitStats::GitData::ShortStat do
  let(:commit) { build(:commit, sha: 'abc') }

  describe 'git output parsing' do
    context 'parsing git show output' do
      [
          {content: '2 files changed, 17 insertions(+), 3 deletions(-)', expect: [2, 17, 3]},
          {content: '1 file changed, 1 insertion(+), 1 deletion(-)', expect: [1, 1, 1]},
          {content: '2 files changed, 3 deletions(-)', expect: [2, 0, 3]},
          {content: '2 files changed, 5 insertions(+)', expect: [2, 5, 0]},
          {content: '', expect: [0, 0, 0]},
      ].each do |test|
        it "#{test[:content]} parsing" do
          commit.repo.should_receive(:run).with("git show --shortstat --oneline abc").and_return("abc some commit\n#{test[:content]}")


          commit.short_stat.should be_a(GitStats::GitData::ShortStat)
          commit.short_stat.files_changed.should == test[:expect][0]
          commit.short_stat.insertions.should == test[:expect][1]
          commit.short_stat.deletions.should == test[:expect][2]
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
git_stats-1.0.11 spec/git_data/short_stat_spec.rb
git_stats-1.0.10 spec/git_data/short_stat_spec.rb
git_stats-1.0.9 spec/git_data/short_stat_spec.rb
git_stats-1.0.8 spec/git_data/short_stat_spec.rb
git_stats-1.0.7 spec/git_data/short_stat_spec.rb
git_stats-1.0.6 spec/git_data/short_stat_spec.rb
git_stats-1.0.5 spec/git_data/short_stat_spec.rb
git_stats-1.0.4 spec/git_data/short_stat_spec.rb
git_stats-1.0.3 spec/git_data/short_stat_spec.rb
git_stats-1.0.2 spec/git_data/short_stat_spec.rb
git_stats-1.0.1 spec/git_data/short_stat_spec.rb
git_stats-1.0.0 spec/git_data/short_stat_spec.rb