rspec-ssltls 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +2 -2
- data/lib/rspec_ssltls/have_certificate.rb +4 -3
- data/lib/rspec_ssltls/support_cipher.rb +1 -1
- data/lib/rspec_ssltls/support_protocol.rb +1 -1
- data/lib/rspec_ssltls/util.rb +2 -2
- data/lib/rspec_ssltls/version.rb +1 -1
- data/spec/rspec_ssltls/have_certificate_spec.rb +13 -0
- data/spec/rspec_ssltls/support_cipher_spec.rb +1 -1
- data/spec/rspec_ssltls/support_protocol_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebcb1bdd6abc0edc91220ce31eadbd055d67e81d
|
4
|
+
data.tar.gz: bf3b5de3dcb886625cfc72ff7d79afa3cdbeaf79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae375ce794d0dd417f7e8608aa15cab8f4e6b44d287ed3e4cc494f8ef9bfbf4192755a1e769e4404bd0fb1d03de199b418be46d854ae827cb14068a9d627c61d
|
7
|
+
data.tar.gz: 4365194fedb0e6b0a77c1ee888e2419c5524dfea68c3f32c39eaadcac85ebdf1e34154e28b6027b6810eae9a334b24b5a815f43c6fac02ad898a765c7391faa3
|
data/README.md
CHANGED
@@ -5,11 +5,11 @@ Rspec-ssltls is an rspec plugin for easy SSL/TLS testing.
|
|
5
5
|
|
6
6
|
## Usage
|
7
7
|
|
8
|
-
RSpec-ssltls is best described by example. First, require `
|
8
|
+
RSpec-ssltls is best described by example. First, require `rspec_ssltls` in your `spec_helper.rb`:
|
9
9
|
|
10
10
|
```ruby
|
11
11
|
# spec/spec_helper.rb
|
12
|
-
require '
|
12
|
+
require 'rspec_ssltls'
|
13
13
|
```
|
14
14
|
|
15
15
|
Then, create a spec like this:
|
@@ -3,8 +3,8 @@ require 'uri'
|
|
3
3
|
|
4
4
|
RSpec::Matchers.define :have_certificate do
|
5
5
|
match do |dest|
|
6
|
-
@chain_string
|
7
|
-
@result_string
|
6
|
+
@chain_string ||= ''
|
7
|
+
@result_string ||= ''
|
8
8
|
uri = URI.parse('https://' + dest)
|
9
9
|
socket = TCPSocket.open(uri.host, uri.port)
|
10
10
|
ssl_context = OpenSSL::SSL::SSLContext.new
|
@@ -47,7 +47,8 @@ RSpec::Matchers.define :have_certificate do
|
|
47
47
|
|
48
48
|
@subject = subject
|
49
49
|
@subject.each_pair do |k, v|
|
50
|
-
|
50
|
+
@chain_string =
|
51
|
+
RspecSsltls::Util.add_string(@chain_string, "#{k}=\"#{v}\"")
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
data/lib/rspec_ssltls/util.rb
CHANGED
data/lib/rspec_ssltls/version.rb
CHANGED
@@ -56,5 +56,18 @@ describe 'rspec-ssltls matchers' do
|
|
56
56
|
expect('www.example.com:443')
|
57
57
|
.not_to have_certificate.subject(CN: 'www.example.com')
|
58
58
|
end
|
59
|
+
|
60
|
+
# show default description
|
61
|
+
it do
|
62
|
+
stub_ssl_socket(peer_cert: example_cert)
|
63
|
+
expect('www.example.com:443')
|
64
|
+
.to have_certificate.subject(CN: '*.example.com',
|
65
|
+
C: 'JP',
|
66
|
+
ST: 'Tokyo',
|
67
|
+
O: 'Example Co., Ltd.',
|
68
|
+
OU: 'Example Div.',
|
69
|
+
CN: '*.example.com'
|
70
|
+
)
|
71
|
+
end
|
59
72
|
end
|
60
73
|
end
|
@@ -26,7 +26,7 @@ describe 'rspec-ssltls matchers' do
|
|
26
26
|
it do
|
27
27
|
stub_ssl_socket(cipher: ['DES-CBC3-SHA', 'TLSv1/SSLv3', 168, 168])
|
28
28
|
expect('www.example.com:443')
|
29
|
-
.to support_cipher('DES-CBC3-SHA')
|
29
|
+
.to support_cipher(['DES-CBC3-SHA', 'AES256-SHA']).protocol('TLSv1')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -23,7 +23,7 @@ describe 'rspec-ssltls matchers' do
|
|
23
23
|
it do
|
24
24
|
# show default description
|
25
25
|
stub_ssl_socket(ssl_version: 'TLSv1')
|
26
|
-
expect('www.example.com:443').to support_protocol(
|
26
|
+
expect('www.example.com:443').to support_protocol(%w(TLSv1 SSLv3))
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-ssltls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OTA Hiroshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|