Sha256: 15c4d94a3130e2f8e037521587777b1e0c574099c4ae0db5872a9cdaf8161955
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe SuperHooks::Runner do let(:hook) { double('hook') } let(:runner) { described_class.new('commit-msg', 'super_argument') } before :each do allow(SuperHooks::Hook).to receive(:where).and_return([hook]) end describe '#initialize' do it 'sets the hooks' do expect(runner.hooks).to eql([hook]) end it 'set the arguments that where sent' do expect(runner.arguments).to eql('super_argument') end end describe '#run' do it 'runs each hook' do expect(hook).to receive(:execute!).with('super_argument').and_return(true) runner.run end it 'returns a bad error code if one script fails' do expect(hook).to receive(:execute!).with('super_argument').and_return(false) expect(hook).to receive(:path).and_return('ok') expect($stderr).to receive(:puts) do |args| expect(args).to include 'Hooks ok failed to exit successfully' end begin runner.run rescue SystemExit => e expect(e.status).to eql 1 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
super_hooks-0.0.2.1 | spec/lib/super_hooks/runner_spec.rb |