Sha256: 071e50fbfe69760af3b2007b12f0baa4a928680a62778c26f64c6295f1795c75

Contents?: true

Size: 1.05 KB

Versions: 18

Compression:

Stored size: 1.05 KB

Contents

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

describe GitStats::GitData::Repo do
  let(:repo) { build(:repo) }

  describe 'command observers' do
    context 'should be invoked after every command' do
      it 'should accept block' do
        command_runner = double('command_runner')
        repo = build(:repo, command_runner: command_runner)

        observer = double('observer')
        repo.add_command_observer { |command, result| observer.invoked(command, result) }
        command_runner.should_receive(:run).with(repo.path, 'aa').and_return('bb')
        observer.should_receive(:invoked).with('aa', 'bb')

        repo.run('aa')
      end

      it 'should accept Proc' do
        command_runner = double('command_runner')
        repo = build(:repo, command_runner: command_runner)

        observer = double('observer')
        repo.add_command_observer(observer)
        command_runner.should_receive(:run).with(repo.path, 'aa').and_return('bb')
        observer.should_receive(:call).with('aa', 'bb')

        repo.run('aa')
      end
    end
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
git_stats-1.0.17 spec/git_data/command_observer_spec.rb
git_stats-1.0.16 spec/git_data/command_observer_spec.rb
git_stats-1.0.15 spec/git_data/command_observer_spec.rb
git_stats-1.0.14 spec/git_data/command_observer_spec.rb
git_stats-1.0.13 spec/git_data/command_observer_spec.rb
git_stats-1.0.12 spec/git_data/command_observer_spec.rb
git_stats-1.0.11 spec/git_data/command_observer_spec.rb
git_stats-1.0.10 spec/git_data/command_observer_spec.rb
git_stats-1.0.9 spec/git_data/command_observer_spec.rb
git_stats-1.0.8 spec/git_data/command_observer_spec.rb
git_stats-1.0.7 spec/git_data/command_observer_spec.rb
git_stats-1.0.6 spec/git_data/command_observer_spec.rb
git_stats-1.0.5 spec/git_data/command_observer_spec.rb
git_stats-1.0.4 spec/git_data/command_observer_spec.rb
git_stats-1.0.3 spec/git_data/command_observer_spec.rb
git_stats-1.0.2 spec/git_data/command_observer_spec.rb
git_stats-1.0.1 spec/git_data/command_observer_spec.rb
git_stats-1.0.0 spec/git_data/command_observer_spec.rb