Skip to content

Commit 1e24620

Browse files
jawshooahsds
authored andcommittedJul 19, 2015
Stub exception classes to avoid requiring w3c_validators
1 parent 8821007 commit 1e24620

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed
 

‎overcommit.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ Gem::Specification.new do |s|
3131

3232
s.add_development_dependency 'rspec', '~> 3.0'
3333
s.add_development_dependency 'travis', '~> 1.7'
34-
s.add_development_dependency 'w3c_validators', '~> 1.2'
3534
end

‎spec/overcommit/hook/pre_commit/w3c_css_spec.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
require 'spec_helper'
2-
require 'w3c_validators'
32

43
describe Overcommit::Hook::PreCommit::W3cCss do
54
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
65
let(:context) { double('context') }
76
subject { described_class.new(config, context) }
87

8+
let(:fake_exception) { Class.new(StandardError) }
9+
910
before do
1011
subject.stub(:applicable_files).and_return(%w[file1.css file2.css])
12+
stub_const('W3CValidators::ValidatorUnavailable', fake_exception)
13+
stub_const('W3CValidators::ParsingError', fake_exception)
1114
end
1215

1316
context 'when w3c_validators exits with an exception' do

‎spec/overcommit/hook/pre_commit/w3c_html_spec.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
require 'spec_helper'
2-
require 'w3c_validators'
32

43
describe Overcommit::Hook::PreCommit::W3cHtml do
54
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
65
let(:context) { double('context') }
76
subject { described_class.new(config, context) }
87

8+
let(:fake_exception) { Class.new(StandardError) }
9+
910
before do
1011
subject.stub(:applicable_files).and_return(%w[file1.html file2.html])
12+
stub_const('W3CValidators::ValidatorUnavailable', fake_exception)
13+
stub_const('W3CValidators::ParsingError', fake_exception)
1114
end
1215

1316
context 'when w3c_validators exits with an exception' do

0 commit comments

Comments
 (0)