Sha256: d617bb67ca3d7ec0e36d67db8aac66b73e8c20ed988d3529fab68b5c3399cca4

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

module PrePush
	describe Validator do
		describe 'validate' do
			it "should fail when a .git dir doesn't exit" do
				Dir.stub('exists?').with('.git').and_return(false)
				PrePush::Validator.should_receive('puts').with("Couldn't find a git repository")
				PrePush::Validator.validate('nunit262').should be false
			end
			it "should fail when a .git/hooks dir doesn't exit" do
				Dir.stub('exists?').with('.git').and_return(true)
				Dir.stub('exists?').with('.git/hooks').and_return(false)
				PrePush::Validator.should_receive('puts').with("Couldn't find the git hooks dir")
				PrePush::Validator.validate('nunit262').should be false
			end
			it "should fail when runner not found" do
				Dir.stub('exists?').with('.git').and_return(true)
				Dir.stub('exists?').with('.git/hooks').and_return(true)
				PrePush::Validator.should_receive('puts').with("Couldn't find test runner non-existant-runner")
				PrePush::Validator.validate('non-existant-runner').should be false
			end
			it "should validate when runner found" do
				Dir.stub('exists?').with('.git').and_return(true)
				Dir.stub('exists?').with('.git/hooks').and_return(true)
				Dir.stub('entries').with(/lib\/runners$/).and_return(['existant-runner'])
				PrePush::Validator.validate('existant-runner').should be true
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pre_push-0.0.1.1 spec/prepush_validator_spec.rb
pre_push-0.0.1.2 spec/prepush_validator_spec.rb