Sha256: 3bf96e3b421c702cc1fa5810fbbbb424c2edd2886fabe3c70ee0e04e73c9b8e9

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

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

describe GitStats::Generator do
  let(:repo_path) { 'repo_path' }
  let(:out_path) { 'out_path' }
  let(:generator) { GitStats::Generator.new(repo_path, out_path) }

  before { Dir.stub!(:exists? => true) }

  it 'should raise exception if given repo path is not a git repository' do
    Dir.should_receive(:exists?).with("#{repo_path}/.git").and_return(false)
    expect { generator }.to raise_error(ArgumentError)
  end

  it 'should pass command observer to repo' do
    repo = double('repo')
    GitStats::GitData::Repo.should_receive(:new).with(path: repo_path, first_commit_sha: nil, last_commit_sha: "HEAD").and_return(repo)

    generator = GitStats::Generator.new(repo_path, out_path)

    observer = double('observer')
    repo.should_receive(:add_command_observer).with(observer)

    generator.add_command_observer observer
  end

  it 'should render all templates with view data for this repo' do
    repo = double('repo')
    GitStats::GitData::Repo.should_receive(:new).with(path: repo_path, first_commit_sha: nil, last_commit_sha: "HEAD").and_return(repo)

    view_data = double('view_data')
    GitStats::StatsView::ViewData.should_receive(:new).with(repo).and_return(view_data)

    view = double('view')
    GitStats::StatsView::View.should_receive(:new).with(view_data, out_path).and_return(view)
    view.should_receive(:render_all)

    generator.render_all
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
git_stats-1.0.11 spec/git_data/generator_spec.rb
git_stats-1.0.10 spec/git_data/generator_spec.rb
git_stats-1.0.9 spec/git_data/generator_spec.rb
git_stats-1.0.8 spec/git_data/generator_spec.rb
git_stats-1.0.7 spec/git_data/generator_spec.rb
git_stats-1.0.6 spec/git_data/generator_spec.rb