rspec-webservice_matchers 4.12.2 → 4.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,9 +43,9 @@ RSpec.configure do |config|
43
43
  # PageSpeed Insights API
44
44
  key = ENV['WEBSERVICE_MATCHER_INSIGHTS_KEY']
45
45
  WebMock.stub_request(:get,
46
- 'https://www.googleapis.com/pagespeedonline/v2/' \
46
+ 'https://www.googleapis.com/pagespeedonline/v5/' \
47
47
  "runPagespeed?key=#{key}&screenshot=false" \
48
- '&url=http://nonstop.qa')
48
+ '&url=https://constant.qa')
49
49
  .to_return(
50
50
  status: 200,
51
51
  body: IO.read('spec/fixtures/pagespeed.json'),
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+ require 'web_test/be_fast'
4
+
5
+ RSpec.describe WebTest::BeFast do
6
+ it { is_expected.not_to be_nil }
7
+
8
+ describe '#test' do
9
+ it 'handles a fast site' do
10
+ result = WebTest::BeFast.test url: 'https://constant.qa'
11
+ expect(result.success?).to be true
12
+ expect(result.score).to be >= 85
13
+ end
14
+ end
15
+
16
+ describe '#parse' do
17
+ it 'can parse the overall score' do
18
+ api_response = File.read(SAMPLE_PAGESPEED_JSON_RESPONSE)
19
+ data = WebTest::BeFast.parse json: api_response
20
+ expect(data[:score]).to eq 91
21
+ end
22
+ end
23
+
24
+ describe WebTest::BeFast::TestResult do
25
+ it 'requires :success' do
26
+ expect do
27
+ WebTest::BeFast::TestResult.new {}
28
+ end.to raise_error(ArgumentError, /success/i)
29
+ end
30
+
31
+ it 'requires :score' do
32
+ expect do
33
+ WebTest::BeFast::TestResult.new { |r| r.success = true }
34
+ end.to raise_error(ArgumentError, /score/i)
35
+ end
36
+
37
+ it 'requires :response' do
38
+ expect do
39
+ WebTest::BeFast::TestResult.new { |r|
40
+ r.success = true
41
+ r.score = 90
42
+ }
43
+ end.to raise_error(ArgumentError, /response/i)
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-webservice_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.2
4
+ version: '4.13'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-21 00:00:00.000000000 Z
11
+ date: 2021-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -201,6 +201,7 @@ files:
201
201
  - spec/rspec/webservice_matchers/ssl_spec.rb
202
202
  - spec/spec_helper.rb
203
203
  - spec/web_mock_config.rb
204
+ - spec/web_test/be_fast_spec.rb
204
205
  - spec/web_test/be_up_spec.rb
205
206
  - spec/web_test/util_spec.rb
206
207
  homepage: https://github.com/dogweather/rspec-webservice_matchers
@@ -222,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
223
  - !ruby/object:Gem::Version
223
224
  version: '0'
224
225
  requirements: []
225
- rubygems_version: 3.2.6
226
+ rubygems_version: 3.2.9
226
227
  signing_key:
227
228
  specification_version: 4
228
229
  summary: Black-box web app configuration testing
@@ -235,5 +236,6 @@ test_files:
235
236
  - spec/rspec/webservice_matchers/ssl_spec.rb
236
237
  - spec/spec_helper.rb
237
238
  - spec/web_mock_config.rb
239
+ - spec/web_test/be_fast_spec.rb
238
240
  - spec/web_test/be_up_spec.rb
239
241
  - spec/web_test/util_spec.rb