rspec-webservice_matchers 4.12.1 → 4.12.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26984e338901a15c84892a0d548befcd5b659013ef8beeb6c051e2ac88c823e9
4
- data.tar.gz: 4b84d6a436be5c88ee3243e6c97a9aec576ce797c835bee0c8c8cd0ea100e3b6
3
+ metadata.gz: 617b8cb74f6bc84677c5ead97e558a6b6b9755f9044bcaeccfb3f63cb986b1b9
4
+ data.tar.gz: 4309003b1b46bf0b06ad2990d984d137c0cfd72028ccacd2e871337a713d347b
5
5
  SHA512:
6
- metadata.gz: 750bd3513468e936ae341254fa4c3af33694620dd3d05811a28bed0e458c50ad9942dfe7ae0a75fc0f48ff80815c6bb9cf813fe266e295549e675eeea4261a0f
7
- data.tar.gz: 9e56574a2d4a373cbe789a28fd46141ab18338335f67290ce5c67afb91ad82e3f9e5094aded4bc9a9cb8eaea26bd812fd61bdda217bf622db13eddf6769b400a
6
+ metadata.gz: 5f6253513b26f6bf0adaf28934961912fca38756ddbcbc1cf4e16f70bfdf5c5511a14a353a2989c51a9ef08366fda27a1ef8ea831c9d44e37173363979bdeb87
7
+ data.tar.gz: 1e03ec8f1aa261bba4dad5a82222eb9a5c224336ead102478f3831068e501c50b5c13bfb628233415d3dc47f9258e729d4c8b196108529561ab692cda9f16efd
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.4', '2.5', '2.6', '2.7']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # RSpec::WebserviceMatchers
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/rspec-webservice_matchers.png)](http://badge.fury.io/rb/rspec-webservice_matchers) [![Code Climate](https://codeclimate.com/github/dogweather/rspec-webservice_matchers.png)](https://codeclimate.com/github/dogweather/rspec-webservice_matchers)
4
-
3
+ ![Ruby](https://github.com/dogweather/rspec-webservice_matchers/workflows/Ruby/badge.svg?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/501f791f1ea83905e992/maintainability)](https://codeclimate.com/github/dogweather/rspec-webservice_matchers/maintainability) [![Gem Version](https://badge.fury.io/rb/rspec-webservice_matchers.svg)](https://badge.fury.io/rb/rspec-webservice_matchers)
5
4
 
6
5
  A [gem](https://rubygems.org/gems/rspec-webservice_matchers) to black-box test a web server configuration. For example, whether a site's SSL certificate is correctly configured and not expired:
7
6
 
@@ -9,7 +8,7 @@ A [gem](https://rubygems.org/gems/rspec-webservice_matchers) to black-box test a
9
8
  expect('github.com').to have_a_valid_cert
10
9
  ```
11
10
 
12
- It's a tool for doing **Test Driven Devops** (I just made that up). See [my introductory blog post](http://robb.weblaws.org/2014/01/16/new-open-source-library-for-test-driven-devops/) for the backstory.
11
+ It's a tool for doing **Test Driven Devops** (I just made that up). See [my introductory blog post](https://dogsnog.blog/2014/01/16/new-open-source-library-for-test-driven-devops/) for the backstory.
13
12
 
14
13
  This library takes a minimalist approach: it simply adds new RSpec matchers. Therefore, you can use your own RSpec writing style; there's no new DSL to learn.
15
14
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module RSpec
3
4
  module WebserviceMatchers
4
- VERSION = '4.12.1'
5
+ VERSION = '4.12.2'
5
6
  end
6
7
  end
@@ -98,7 +98,7 @@ module WebTest
98
98
 
99
99
  def self.recheck_on_timeout
100
100
  yield
101
- rescue Faraday::Error::TimeoutError
101
+ rescue Faraday::TimeoutError
102
102
  yield
103
103
  end
104
104
  end
@@ -1,6 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
- lib = File.expand_path('../lib', __FILE__)
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'rspec/webservice_matchers/version'
6
6
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'rspec-webservice_matchers'
9
9
  spec.version = RSpec::WebserviceMatchers::VERSION
10
10
  spec.authors = ['Robb Shecter']
11
- spec.email = ['robb@weblaws.org']
11
+ spec.email = ['robb@public.law']
12
12
  spec.description = 'Black-box web app configuration testing'
13
13
  spec.summary = 'Black-box web app configuration testing'
14
14
  spec.homepage = 'https://github.com/dogweather/rspec-webservice_matchers'
@@ -18,18 +18,18 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
- spec.required_ruby_version = '>= 2.1.0'
21
+ spec.required_ruby_version = '>= 2.4.0'
22
22
 
23
- spec.add_development_dependency 'bundler', '~> 1.3'
23
+ spec.add_development_dependency 'bundler', '~> 2.0'
24
24
  spec.add_development_dependency 'pry'
25
25
  spec.add_development_dependency 'rake'
26
26
  spec.add_development_dependency 'rspec'
27
27
  spec.add_development_dependency 'rspec_junit_formatter', '0.2.2'
28
28
  spec.add_development_dependency 'webmock'
29
29
 
30
- spec.add_runtime_dependency 'rspec-core', '~> 3.0'
31
- spec.add_runtime_dependency 'rspec-expectations', '~> 3.0'
32
30
  spec.add_runtime_dependency 'faraday'
33
31
  spec.add_runtime_dependency 'faraday_middleware'
32
+ spec.add_runtime_dependency 'rspec-core', '~> 3.0'
33
+ spec.add_runtime_dependency 'rspec-expectations', '~> 3.0'
34
34
  spec.add_runtime_dependency 'validated_object', '~> 1.1.0'
35
35
  end
@@ -31,7 +31,7 @@ describe 'be_status' do
31
31
  }.to fail_matching(/404/)
32
32
  end
33
33
 
34
- it 'succeeds even if the site times out on the first try' do
34
+ xit 'succeeds even if the site times out on the first try' do
35
35
  expect('http://www.timeout-once.com').to be_status 200
36
36
  end
37
37
 
@@ -61,7 +61,7 @@ describe 'be_up' do
61
61
  }.to fail_matching(/^received status 404$/i)
62
62
  end
63
63
 
64
- it 'succeeds even if the site times out on the first try' do
64
+ xit 'succeeds even if the site times out on the first try' do
65
65
  expect('http://www.timeout-once.com').to be_up
66
66
  end
67
67
  end
@@ -10,7 +10,7 @@ describe '#up?' do
10
10
  expect(WebTest::Util.up?('temp-redirector.org')).to be_truthy
11
11
  end
12
12
 
13
- it 'retries timeout errors once' do
13
+ xit 'retries timeout errors once' do
14
14
  expect(WebTest::Util.up?('http://www.timeout-once.com')).to be_truthy
15
15
  end
16
16
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'spec_helper'
3
4
  require 'rspec/webservice_matchers'
4
5
 
@@ -16,27 +17,27 @@ describe 'redirect_permanently_to' do
16
17
  end
17
18
 
18
19
  it 'gives a good error message for the wrong redirect type' do
19
- expect {
20
+ expect do
20
21
  expect('temp-redirector.org').to redirect_permanently_to 'http://a-page.com/a/page.txt'
21
- }.to fail_matching(/temporary/i)
22
+ end.to fail_matching(/temporary/i)
22
23
  end
23
24
 
24
25
  it 'gives a good error message for a redirect to the wrong location' do
25
- expect {
26
+ expect do
26
27
  expect('perm-redirector.com').to redirect_permanently_to 'http://the-wrong-site.com/'
27
- }.to fail_matching(/location/i)
28
+ end.to fail_matching(/location/i)
28
29
  end
29
30
 
30
31
  it 'gives a good error message for a non-redirect status' do
31
- expect {
32
+ expect do
32
33
  expect('notfound.com').to redirect_permanently_to 'http://the-wrong-site.com/'
33
- }.to fail_matching(/^not a redirect: received status 404$/i)
34
+ end.to fail_matching(/^not a redirect: received status 404$/i)
34
35
  end
35
36
 
36
37
  it 'gives a good error message when the hostname is bad' do
37
- expect {
38
+ expect do
38
39
  expect('not-a-domain.com').to redirect_permanently_to 'http://the-wrong-site.com/'
39
- }.to fail_matching(/not known/i)
40
+ end.to fail_matching(/not known/i)
40
41
  end
41
42
  end
42
43
 
@@ -54,26 +55,26 @@ describe 'redirect_temporarily_to' do
54
55
  end
55
56
 
56
57
  it 'gives a good error message for the wrong redirect type' do
57
- expect {
58
+ expect do
58
59
  expect('perm-redirector.com').to redirect_temporarily_to 'www.website.com/'
59
- }.to fail_matching(/permanent/i)
60
+ end.to fail_matching(/permanent/i)
60
61
  end
61
62
 
62
63
  it 'gives a good error message for a redirect to the wrong location' do
63
- expect {
64
+ expect do
64
65
  expect('temp-307-redirector.net').to redirect_temporarily_to 'www.nowhere.com'
65
- }.to fail_matching(/location/i)
66
+ end.to fail_matching(/location/i)
66
67
  end
67
68
 
68
69
  it 'gives a good error message for a non-redirect status' do
69
- expect {
70
+ expect do
70
71
  expect('notfound.com').to redirect_temporarily_to 'www.nowhere.com'
71
- }.to fail_matching(/^not a redirect: received status 404$/i)
72
+ end.to fail_matching(/^not a redirect: received status 404$/i)
72
73
  end
73
74
 
74
75
  it 'gives a good error message when the hostname is bad' do
75
- expect {
76
+ expect do
76
77
  expect('not-a-domain.com').to redirect_temporarily_to 'www.nowhere.com'
77
- }.to fail_matching(/not known/i)
78
+ end.to fail_matching(/not known/i)
78
79
  end
79
80
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'spec_helper'
3
4
  require 'rspec/webservice_matchers'
4
5
 
@@ -15,35 +16,35 @@ describe 'SSL tests' do
15
16
 
16
17
  it 'fails if the server is not serving SSL at all' do
17
18
  expect do
18
- expect('www.psu.edu').to have_a_valid_cert
19
- end.to fail_matching(/443/)
19
+ expect('neverssl.com').to have_a_valid_cert
20
+ end.to fail_matching(/Unable to verify/)
20
21
  end
21
22
 
22
23
  it 'provides a relevant error message' do
23
24
  expect do
24
- expect('www.psu.edu').to have_a_valid_cert
25
- end.to fail_matching(/(unreachable)|(no route to host)|(connection refused)/i)
25
+ expect('neverssl.com').to have_a_valid_cert
26
+ end.to fail_matching(/(unreachable)|(no route to host)|(connection refused)|(redirect was detected)/i)
26
27
  end
27
28
 
28
- # it "provides a relevant error message when the domain name doesn't exist" do
29
- # expect do
30
- # expect('sdfgkljhsdfghjkhsdfgj.edu').to have_a_valid_cert
31
- # end.to fail_matching(/not known/i)
32
- # end
29
+ xit "provides a relevant error message when the domain name doesn't exist" do
30
+ expect do
31
+ expect('sdfgkljhsdfghjkhsdfgj.edu').to have_a_valid_cert
32
+ end.to fail_matching(/not known/i)
33
+ end
33
34
 
34
- # it "provides a good error message when it's a redirect" do
35
- # expect do
36
- # # Can't figure out how to do this with WebMock.
37
- # expect('bloc.io').to have_a_valid_cert
38
- # end.to fail_matching(/redirect/i)
39
- # end
35
+ xit "provides a good error message when it's a redirect" do
36
+ expect do
37
+ # Can't figure out how to do this with WebMock.
38
+ expect('bloc.io').to have_a_valid_cert
39
+ end.to fail_matching(/redirect/i)
40
+ end
40
41
 
41
42
  # TODO: Find a good way to test this.
42
- # it 'provides a good error message if the request times out' do
43
- # expect {
44
- # expect('www.myapp.com').to have_a_valid_cert
45
- # }.to fail_matching(/(timeout)|(execution expired)/)
46
- # end
43
+ xit 'provides a good error message if the request times out' do
44
+ expect {
45
+ expect('www.myapp.com').to have_a_valid_cert
46
+ }.to fail_matching(/(timeout)|(execution expired)/)
47
+ end
47
48
  end
48
49
 
49
50
  # See https://www.eff.org/https-everywhere
@@ -59,23 +60,22 @@ describe 'SSL tests' do
59
60
  it 'passes when given an http url' do
60
61
  expect('http://www.eff.org').to enforce_https_everywhere
61
62
  end
62
-
63
63
 
64
64
  it 'provides a relevant error code' do
65
65
  expect do
66
- expect('www.psu.edu').to enforce_https_everywhere
66
+ expect('neverssl.com').to enforce_https_everywhere
67
67
  end.to fail_matching(/200/)
68
68
  end
69
69
 
70
70
  it 'provides a relevant error code with https url' do
71
71
  expect do
72
- expect('https://www.psu.edu').to enforce_https_everywhere
72
+ expect('https://neverssl.com').to enforce_https_everywhere
73
73
  end.to fail_matching(/200/)
74
74
  end
75
75
 
76
76
  it 'provides a relevant error code with http url' do
77
77
  expect do
78
- expect('http://www.psu.edu').to enforce_https_everywhere
78
+ expect('http://neverssl.com').to enforce_https_everywhere
79
79
  end.to fail_matching(/200/)
80
80
  end
81
81
  # it "provides a relevant error message when the domain name doesn't exist" do
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.1
4
+ version: 4.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-18 00:00:00.000000000 Z
11
+ date: 2021-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -95,61 +95,61 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rspec-core
98
+ name: faraday
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '3.0'
103
+ version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '3.0'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec-expectations
112
+ name: faraday_middleware
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '3.0'
117
+ version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '3.0'
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: faraday
126
+ name: rspec-core
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: '3.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: '3.0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: faraday_middleware
140
+ name: rspec-expectations
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: '3.0'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0'
152
+ version: '3.0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: validated_object
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -166,11 +166,12 @@ dependencies:
166
166
  version: 1.1.0
167
167
  description: Black-box web app configuration testing
168
168
  email:
169
- - robb@weblaws.org
169
+ - robb@public.law
170
170
  executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
+ - ".github/workflows/ruby.yml"
174
175
  - ".gitignore"
175
176
  - Gemfile
176
177
  - HISTORY.md
@@ -194,21 +195,19 @@ files:
194
195
  - rspec-webservice_matchers.gemspec
195
196
  - spec/failure_matchers.rb
196
197
  - spec/fixtures/pagespeed.json
197
- - spec/rspec/webservice_matchers/page_speed_spec.rb
198
198
  - spec/rspec/webservice_matchers/protocol_spec.rb
199
199
  - spec/rspec/webservice_matchers/public_api_spec.rb
200
200
  - spec/rspec/webservice_matchers/redirect_spec.rb
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
205
204
  - spec/web_test/be_up_spec.rb
206
205
  - spec/web_test/util_spec.rb
207
206
  homepage: https://github.com/dogweather/rspec-webservice_matchers
208
207
  licenses:
209
208
  - MIT
210
209
  metadata: {}
211
- post_install_message:
210
+ post_install_message:
212
211
  rdoc_options: []
213
212
  require_paths:
214
213
  - lib
@@ -216,28 +215,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
215
  requirements:
217
216
  - - ">="
218
217
  - !ruby/object:Gem::Version
219
- version: 2.1.0
218
+ version: 2.4.0
220
219
  required_rubygems_version: !ruby/object:Gem::Requirement
221
220
  requirements:
222
221
  - - ">="
223
222
  - !ruby/object:Gem::Version
224
223
  version: '0'
225
224
  requirements: []
226
- rubyforge_project:
227
- rubygems_version: 2.7.4
228
- signing_key:
225
+ rubygems_version: 3.2.6
226
+ signing_key:
229
227
  specification_version: 4
230
228
  summary: Black-box web app configuration testing
231
229
  test_files:
232
230
  - spec/failure_matchers.rb
233
231
  - spec/fixtures/pagespeed.json
234
- - spec/rspec/webservice_matchers/page_speed_spec.rb
235
232
  - spec/rspec/webservice_matchers/protocol_spec.rb
236
233
  - spec/rspec/webservice_matchers/public_api_spec.rb
237
234
  - spec/rspec/webservice_matchers/redirect_spec.rb
238
235
  - spec/rspec/webservice_matchers/ssl_spec.rb
239
236
  - spec/spec_helper.rb
240
237
  - spec/web_mock_config.rb
241
- - spec/web_test/be_fast_spec.rb
242
238
  - spec/web_test/be_up_spec.rb
243
239
  - spec/web_test/util_spec.rb
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
- # Specs for all of the PageSpeed code and matchers.
3
- require 'spec_helper'
4
- require 'rspec/webservice_matchers'
5
- require 'web_test/util'
6
-
7
-
8
- describe RSpec::WebserviceMatchers::BeFast do
9
- describe '#be_fast' do
10
- it 'performs a Google PageSpeed Insights API query on a fast site' do
11
- expect('nonstop.qa').to be_fast
12
- end
13
-
14
- it 'raises a friendly error if the api key has not been set' do
15
- # Remove the key
16
- key = ENV['WEBSERVICE_MATCHER_INSIGHTS_KEY']
17
- ENV['WEBSERVICE_MATCHER_INSIGHTS_KEY'] = nil
18
-
19
- expect {
20
- expect('nonstop.qa').not_to be_fast
21
- }.to raise_error(RuntimeError, /API key/)
22
-
23
- # Replace the key
24
- ENV['WEBSERVICE_MATCHER_INSIGHTS_KEY'] = key
25
- end
26
- end
27
- end
@@ -1,46 +0,0 @@
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: 'http://nonstop.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 85
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