Sha256: c541982d7936108afce604c59c8e962f0c17bec8a648a8989a23fee07f2e5d2c
Contents?: true
Size: 967 Bytes
Versions: 1
Compression:
Stored size: 967 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe SiteInspector::Endpoint::Wappalyzer do subject { described_class.new(endpoint) } let(:domain) { 'http://ben.balter.com.com' } let(:endpoint) { SiteInspector::Endpoint.new(domain) } let(:url) { "https://api.wappalyzer.com/lookup/v2/?urls=#{domain}/" } before do path = File.expand_path '../fixtures/wappalyzer.json', __dir__ body = File.read path stub_request(:get, url).to_return(status: 200, body: body) end it 'returns the API response' do expected = { 'Analytics' => ['Google Analytics'], 'CDN' => %w[Cloudflare Fastly], 'Caching' => ['Varnish'], 'Other' => %w[Disqus Jekyll], 'PaaS' => ['GitHub Pages'], 'Web frameworks' => ['Ruby on Rails'] } expect(subject.to_h).to eql(expected) end it 'fails gracefully' do stub_request(:get, url).to_return(status: 400, body: '') expect(subject.to_h).to eql({}) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
site-inspector-3.2.0 | spec/checks/site_inspector_endpoint_wappalyzer_spec.rb |