Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git_stats_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f9c70da2bd5d4064d07018f771145f2d9512b820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'spec_helper'

describe Gitlab::GitStats do

  describe "#parsed_log" do
    let(:stats) { Gitlab::GitStats.new(nil, nil) }
    before(:each) do
      stats.stub(:log).and_return("anything")
    end

    context "LogParser#parse_log returns 'test'" do
      it "returns 'test'" do
        LogParser.stub(:parse_log).and_return("test")
        stats.parsed_log.should eq("test")
      end
    end
  end

  describe "#log" do
    let(:repo) { Repository.new(nil, nil) }
    let(:gs) { Gitlab::GitStats.new(repo.raw, repo.root_ref) }
    
    before(:each) do
      repo.stub(:raw).and_return(nil)
      repo.stub(:root_ref).and_return(nil)
      repo.raw.stub(:git)
    end

    context "repo.git.run returns 'test'" do
      it "returns 'test'" do
        repo.raw.git.stub(:run).and_return("test")
        gs.log.should eq("test")
      end
    end
  end
end