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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 106422eae27ce3fcfb374cad4f40064c67c0ced8
4
- data.tar.gz: 408d3000f6594d1c366767d1601717d6e478c7e7
3
+ metadata.gz: ebcb1bdd6abc0edc91220ce31eadbd055d67e81d
4
+ data.tar.gz: bf3b5de3dcb886625cfc72ff7d79afa3cdbeaf79
5
5
  SHA512:
6
- metadata.gz: 745474287c2168102ea143d447d3d1b1cff131c9b92c766b222b412030e340fdcdd399b65b643860960f228adc9aa24b3f9ccbd245ef843f7e29782bc1190979
7
- data.tar.gz: a37e12b745101f13bf736f0fa3580287ac5808475230d05b7d9972891923b16ac8e1a82b8392ccd075b4d37b3c30269c409c93d4455221857a637a23bce89a00
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 `rspec-ssltls` in your `spec_helper.rb`:
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 'rspec-ssltls'
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
- RspecSsltls::Util.add_string(@chain_string, "#{k}=#{v}")
50
+ @chain_string =
51
+ RspecSsltls::Util.add_string(@chain_string, "#{k}=\"#{v}\"")
51
52
  end
52
53
  end
53
54
 
@@ -42,7 +42,7 @@ RSpec::Matchers.define :support_cipher do |cipher|
42
42
  end
43
43
 
44
44
  description do
45
- "support cipher #{@cipher.to_a}"
45
+ "support cipher #{@cipher.to_a.join(', ')}#{@chain_string}"
46
46
  end
47
47
 
48
48
  failure_message do
@@ -33,7 +33,7 @@ RSpec::Matchers.define :support_protocol do |protocol|
33
33
  end
34
34
 
35
35
  description do
36
- "support protocol #{@protocol.to_a}"
36
+ "support protocol #{@protocol.to_a.join(', ')}"
37
37
  end
38
38
 
39
39
  failure_message do
@@ -4,9 +4,9 @@ module RspecSsltls
4
4
  class Util
5
5
  def self.add_string(target, addition)
6
6
  if target.nil?
7
- target = ' ' + addition
7
+ ' ' + addition
8
8
  else
9
- target.join(addition, ' ')
9
+ target + ', ' + addition
10
10
  end
11
11
  end
12
12
 
@@ -1,4 +1,4 @@
1
1
  # Easily test your SSL/TLS with RSpec.
2
2
  module RspecSsltls
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
@@ -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('TLSv1')
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.1
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-19 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec