Sha256: 5d9bcf29f6041f56bdd254a5f355ea56315f992e189018174c1144c983f60513

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.rb'])
				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.2 spec/prepush_validator_spec.rb
pre_push-0.0.1.3 spec/prepush_validator_spec.rb