rspec-webservice_matchers 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b238603ebf7eb99200ebeed083b9d902362abce
4
- data.tar.gz: e66536bd2aebb782227b02ad3d8aa2f3f01d2f04
3
+ metadata.gz: 8651a565b58e694aaded1c7e89faf9ee79f2b020
4
+ data.tar.gz: 1cf00d26f4cd5dd7f3e7697429f2662b316012ae
5
5
  SHA512:
6
- metadata.gz: 336f8d6acad41a9a274d8cdd816522a4545bc6a3d7c24d8ed6dd2c98e588036b35dd176890752e1e9e1997bd18f687066688a79b9e1aecfd103924d7bd3f7c15
7
- data.tar.gz: 34abd12248f8b59a2f058f203f9bd67d321147760fa3f5543fe440533701d468bf64922d746c208d442c334552c0845844fc415e3ccd47196fe7188f9ecae575
6
+ metadata.gz: 5c6e385cbee4b154cfd367270e4dad775cf2028a142f70481e4f70a22f3e20cdba3831f850e0b78dbaef2ae2aeb49c3ed6234e1625e51686d7143224d91d813a
7
+ data.tar.gz: a95d2c497c4023d43a8501574e38817e5ae97a3abc18ac4fc14ad9bd99bf35f9e70daa2d9df64a9ccab95b6d68177b371eeb2195247adfc04f4c4bc09dfc1c46
@@ -1,5 +1,6 @@
1
1
  require 'faraday'
2
2
  require 'rspec/webservice_matchers/util'
3
+ require 'rspec/webservice_matchers/redirect_helpers'
3
4
 
4
5
  module RSpec
5
6
  module WebserviceMatchers
@@ -9,6 +10,7 @@ module RSpec
9
10
  # 2. to an https url
10
11
  # 3. which is correctly configured
11
12
  RSpec::Matchers.define :enforce_https_everywhere do
13
+ include RedirectHelpers
12
14
  error_msg = status = final_protocol = has_valid_cert = nil
13
15
 
14
16
  match do |domain_name|
@@ -30,7 +32,7 @@ module RSpec
30
32
  end
31
33
 
32
34
  def meets_expectations?(status, protocol, valid_cert)
33
- (status == 301) && (protocol == 'https') && valid_cert
35
+ permanent_redirect?(status) && (protocol == 'https') && valid_cert
34
36
  end
35
37
 
36
38
  # Create a compound error message listing all of the
@@ -40,13 +42,15 @@ module RSpec
40
42
  end
41
43
 
42
44
  def higher_level_errors(status, protocol, cert_is_valid)
43
- mesgs = []
44
- mesgs << "received status #{status} instead of 301" if status != 301
45
- if !protocol.nil? && protocol != 'https'
46
- mesgs << "destination uses protocol #{protocol.upcase}"
45
+ errors = []
46
+ unless permanent_redirect?(status)
47
+ errors << "received status #{status} instead of 301"
47
48
  end
48
- mesgs << "there's no valid SSL certificate" unless cert_is_valid
49
- mesgs.join('; ').capitalize
49
+ if protocol && (protocol != 'https')
50
+ errors << "destination uses protocol #{protocol.upcase}"
51
+ end
52
+ errors << "there's no valid SSL certificate" unless cert_is_valid
53
+ Util.error_message(errors)
50
54
  end
51
55
  end
52
56
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module WebserviceMatchers
3
- VERSION = '4.1.0'
3
+ VERSION = '4.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-webservice_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter