Skip to content

Commit

Permalink
Merge pull request #61 from benbalter/cliver
Browse files Browse the repository at this point in the history
Use cliver to detect pa11y
  • Loading branch information
benbalter committed Aug 10, 2015
2 parents 0d2a561 + a712401 commit 839c36b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
1 change: 1 addition & 0 deletions lib/site-inspector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'addressable/uri'
require 'public_suffix'
require 'typhoeus'
require 'cliver'
require 'cgi'

require_relative 'site-inspector/cache'
Expand Down
4 changes: 2 additions & 2 deletions lib/site-inspector/checks/accessibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def pa11y_version
end

def pa11y?
!pa11y_version.nil?
!!(Cliver.detect('pa11y'))
end
alias_method :enabled?, :pa11y?
end
Expand Down Expand Up @@ -83,7 +83,7 @@ def respond_to?(method_sym, include_private = false)
private

def pa11y(standard)
raise "pa11y not found. To install: [sudo] npm install -g pa11y" unless self.class.pa11y?
Cliver.assert('pa11y')
raise ArgumentError, "Unknown standard '#{standard}'" unless standard?(standard)

args = [
Expand Down
1 change: 1 addition & 0 deletions site-inspector.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Gem::Specification.new do |s|
s.add_dependency("oj", "~> 2.11")
s.add_dependency("mercenary", "~> 0.3")
s.add_dependency("colorator", "~> 0.1")
s.add_dependency("cliver", "~> 0.3")
s.add_development_dependency("pry", "~> 0.10")
s.add_development_dependency( "rake", "~> 10.4" )
s.add_development_dependency( "rspec", "~> 3.2")
Expand Down
14 changes: 0 additions & 14 deletions spec/checks/site_inspector_endpoint_accessibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,4 @@
expect(subject.check[:results].first["code"]).to eql("Section508.L.NoContentAnchor")
end
end

context "without pa11y installed" do
before do
allow(subject.class).to receive(:pa11y_version) { nil }
end

it "knows when pa11y insn't installed" do
expect(subject.class.pa11y?).to eql(false)
end

it "fails loudly withouy pa11y" do
expect{subject.check}.to raise_error("pa11y not found. To install: [sudo] npm install -g pa11y")
end
end
end

0 comments on commit 839c36b

Please sign in to comment.