Sha256: fda00b971d7e7f201bf2bde0970326fce40fffe0f3eb0e057d636b4f7173c73e

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true
# Specs for all of the PageSpeed code and matchers.
require 'spec_helper'
require 'rspec/webservice_matchers'
require 'web_test/util'


describe RSpec::WebserviceMatchers::BeFast do
  describe '#be_fast' do
    it 'performs a Google PageSpeed Insights API query on a fast site' do
      expect('nonstop.qa').to be_fast
    end

    it 'raises a friendly error if the api key has not been set' do
      # Remove the key
      key = ENV['WEBSERVICE_MATCHER_INSIGHTS_KEY']
      ENV['WEBSERVICE_MATCHER_INSIGHTS_KEY'] = nil

      expect {
        expect('nonstop.qa').not_to be_fast
      }.to raise_error(RuntimeError, /API key/)

      # Replace the key
      ENV['WEBSERVICE_MATCHER_INSIGHTS_KEY'] = key
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-webservice_matchers-4.12.1 spec/rspec/webservice_matchers/page_speed_spec.rb
rspec-webservice_matchers-4.12.0 spec/rspec/webservice_matchers/page_speed_spec.rb
rspec-webservice_matchers-4.11.0 spec/rspec/webservice_matchers/page_speed_spec.rb