secret_string 1.1.1 → 1.1.3
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/CHANGELOG.md +18 -0
- data/lib/secret_string/core_extensions/string.rb +8 -15
- data/lib/secret_string/version.rb +2 -3
- data/lib/secret_string.rb +8 -20
- metadata +9 -72
- data/spec/secret_string_test/helpers.rb +0 -1
- data/spec/secret_string_test/tests/rubocop_spec.rb +0 -31
- data/spec/secret_string_test/tests/secret_string_spec.rb +0 -90
- data/spec/secret_string_test/tests/string_spec.rb +0 -18
- data/spec/spec_helper.rb +0 -102
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e4ca31c2ae4c178429d38fdfaa8cd9e93ed53c4c73903e6a3e0b8ba4cb58753
|
|
4
|
+
data.tar.gz: 4ba7577dc4cdfe9e2a30cfd0a8e3d23be577a5cd7ee9190a3cd30296046c2f32
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 784b47eefee297746afa1a3340d0772aee6a9c70071e644d9f125eb834ec30e5117a085920a8243dd7a0af123b3d1b436507c18e5f204b213c37fc2a0eb6d8ac
|
|
7
|
+
data.tar.gz: '078425be9a59175c5c3de5a9cb296080942742d0b328f9217836c3a1ec55d4488cab724a8261654daf45b88157eb93721a9c7f47b112b7ecdf038db1e330861a'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
# [v1.1.3](https://github.com/Muriel-Salvan/secret_string/compare/v1.1.2...v1.1.3) (2026-11-30 17:32:20)
|
|
2
|
+
|
|
3
|
+
## Global changes
|
|
4
|
+
### Patches
|
|
5
|
+
|
|
6
|
+
* [chore(ci): upgrade to Ruby 4, modernize workflows and update lint configuration](https://github.com/Muriel-Salvan/secret_string/commit/355b5664b123f46796b3f2c14f3fe8a4895a34ea)
|
|
7
|
+
|
|
8
|
+
## Changes for ci
|
|
9
|
+
### Patches
|
|
10
|
+
|
|
11
|
+
* [chore(ci): upgrade to Ruby 4, modernize workflows and update lint configuration](https://github.com/Muriel-Salvan/secret_string/commit/355b5664b123f46796b3f2c14f3fe8a4895a34ea)
|
|
12
|
+
|
|
13
|
+
# [v1.1.2](https://github.com/Muriel-Salvan/secret_string/compare/v1.1.1...v1.1.2) (2022-12-31 11:23:01)
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
* [Update to Ruby 3.1 - Support of 2.7 dropped](https://github.com/Muriel-Salvan/secret_string/commit/a339478b3ab6e4477971d9a7b583595586dfcce8)
|
|
18
|
+
|
|
1
19
|
# [v1.1.1](https://github.com/Muriel-Salvan/secret_string/compare/v1.1.0...v1.1.1) (2021-08-13 09:59:55)
|
|
2
20
|
|
|
3
21
|
### Patches
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
class SecretString
|
|
2
|
-
|
|
2
|
+
# Module defining standard and core Ruby integrations
|
|
3
3
|
module CoreExtensions
|
|
4
|
-
|
|
5
4
|
# Make sure a String can be used as a SecretString.
|
|
6
5
|
# This helps in avoiding code like "if my_str.is_a?(SecretString)" to access to its content.
|
|
7
6
|
module String
|
|
8
|
-
|
|
9
|
-
# Return the unprotected String
|
|
10
|
-
#
|
|
11
|
-
# Result::
|
|
12
|
-
# * String: Unprotected string
|
|
7
|
+
# @return [String] Unprotected string
|
|
13
8
|
def to_unprotected
|
|
14
9
|
self
|
|
15
10
|
end
|
|
@@ -21,10 +16,8 @@ class SecretString
|
|
|
21
16
|
|
|
22
17
|
# Compare the String with another object
|
|
23
18
|
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
# Result::
|
|
27
|
-
# * Boolean: Are objects equal?
|
|
19
|
+
# @param [Object] other Other object
|
|
20
|
+
# @return [Boolean] Are objects equal?
|
|
28
21
|
def ==(other)
|
|
29
22
|
if other.is_a?(SecretString)
|
|
30
23
|
other == self
|
|
@@ -32,11 +25,11 @@ class SecretString
|
|
|
32
25
|
super
|
|
33
26
|
end
|
|
34
27
|
end
|
|
35
|
-
|
|
36
28
|
end
|
|
37
|
-
|
|
38
29
|
end
|
|
39
|
-
|
|
40
30
|
end
|
|
41
31
|
|
|
42
|
-
String
|
|
32
|
+
# Ruby core String class, extended to be usable as a SecretString.
|
|
33
|
+
class String
|
|
34
|
+
prepend SecretString::CoreExtensions::String
|
|
35
|
+
end
|
data/lib/secret_string.rb
CHANGED
|
@@ -4,13 +4,10 @@ require 'secret_string/core_extensions/string'
|
|
|
4
4
|
|
|
5
5
|
# Protect sensitive data in Strings by erasing it from memory when not needed anymore.
|
|
6
6
|
class SecretString
|
|
7
|
-
|
|
8
7
|
class << self
|
|
9
|
-
|
|
10
8
|
# Securely erase a String from memory
|
|
11
9
|
#
|
|
12
|
-
#
|
|
13
|
-
# * *secret* (String): The secret to erase from memory
|
|
10
|
+
# @param [String] secret The secret to erase from memory
|
|
14
11
|
def erase(secret)
|
|
15
12
|
raise 'Can\'t erase a frozen string' if secret.frozen?
|
|
16
13
|
|
|
@@ -22,30 +19,25 @@ class SecretString
|
|
|
22
19
|
# Protect a String by giving access only to a secured version of it.
|
|
23
20
|
# Make sure the String will be erased at the end of its access.
|
|
24
21
|
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# * Proc: Code called with the string secured
|
|
29
|
-
# * Parameters::
|
|
30
|
-
# * *secretstring* (SecretString): The secret string
|
|
22
|
+
# @param [String] str String to protect, unfrozen
|
|
23
|
+
# @param [String] silenced_str The protected representation of this string
|
|
24
|
+
# @yieldparam [SecretString] secret_string The secret string
|
|
31
25
|
def protect(str, silenced_str: 'XXXXX')
|
|
32
26
|
raise 'Can\'t protect a frozen string' if str.frozen?
|
|
33
27
|
|
|
34
28
|
begin
|
|
35
|
-
secret_string = SecretString.new(str, silenced_str:
|
|
29
|
+
secret_string = SecretString.new(str, silenced_str:)
|
|
36
30
|
yield secret_string
|
|
37
31
|
ensure
|
|
38
32
|
secret_string.erase
|
|
39
33
|
end
|
|
40
34
|
end
|
|
41
|
-
|
|
42
35
|
end
|
|
43
36
|
|
|
44
37
|
# Constructor
|
|
45
38
|
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
# * *silenced_str* (String): The silenced representation of this string [default: 'XXXXX']
|
|
39
|
+
# @param [String] str The original string to protect, unfrozen
|
|
40
|
+
# @param [String] silenced_str The silenced representation of this string
|
|
49
41
|
def initialize(str, silenced_str: 'XXXXX')
|
|
50
42
|
raise 'Can\'t silence a frozen string' if str.frozen?
|
|
51
43
|
|
|
@@ -70,10 +62,7 @@ class SecretString
|
|
|
70
62
|
size
|
|
71
63
|
]
|
|
72
64
|
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
# Result::
|
|
76
|
-
# * String: Unprotected string
|
|
65
|
+
# @return [String] Unprotected string
|
|
77
66
|
def to_unprotected
|
|
78
67
|
@str
|
|
79
68
|
end
|
|
@@ -82,5 +71,4 @@ class SecretString
|
|
|
82
71
|
def erase
|
|
83
72
|
SecretString.erase(@str)
|
|
84
73
|
end
|
|
85
|
-
|
|
86
74
|
end
|
metadata
CHANGED
|
@@ -1,71 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: secret_string
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Muriel Salvan
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: rspec
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '3.8'
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '3.8'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: sem_ver_components
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0.0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0.0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rubocop
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '1.16'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - "~>"
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '1.16'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rubocop-rspec
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - "~>"
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '2.4'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - "~>"
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '2.4'
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
69
12
|
description: Remove secrets (passwords, keys...) from memory
|
|
70
13
|
email:
|
|
71
14
|
- muriel@x-aeon.com
|
|
@@ -73,8 +16,8 @@ executables: []
|
|
|
73
16
|
extensions: []
|
|
74
17
|
extra_rdoc_files:
|
|
75
18
|
- CHANGELOG.md
|
|
76
|
-
- README.md
|
|
77
19
|
- LICENSE.md
|
|
20
|
+
- README.md
|
|
78
21
|
files:
|
|
79
22
|
- CHANGELOG.md
|
|
80
23
|
- LICENSE.md
|
|
@@ -82,16 +25,11 @@ files:
|
|
|
82
25
|
- lib/secret_string.rb
|
|
83
26
|
- lib/secret_string/core_extensions/string.rb
|
|
84
27
|
- lib/secret_string/version.rb
|
|
85
|
-
|
|
86
|
-
- spec/secret_string_test/tests/rubocop_spec.rb
|
|
87
|
-
- spec/secret_string_test/tests/secret_string_spec.rb
|
|
88
|
-
- spec/secret_string_test/tests/string_spec.rb
|
|
89
|
-
- spec/spec_helper.rb
|
|
90
|
-
homepage:
|
|
28
|
+
homepage: https://github.com/Muriel-Salvan/secret_string
|
|
91
29
|
licenses:
|
|
92
30
|
- BSD-3-Clause
|
|
93
|
-
metadata:
|
|
94
|
-
|
|
31
|
+
metadata:
|
|
32
|
+
rubygems_mfa_required: 'true'
|
|
95
33
|
rdoc_options: []
|
|
96
34
|
require_paths:
|
|
97
35
|
- lib
|
|
@@ -99,15 +37,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
99
37
|
requirements:
|
|
100
38
|
- - "~>"
|
|
101
39
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
40
|
+
version: '4.0'
|
|
103
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
42
|
requirements:
|
|
105
43
|
- - ">="
|
|
106
44
|
- !ruby/object:Gem::Version
|
|
107
45
|
version: '0'
|
|
108
46
|
requirements: []
|
|
109
|
-
rubygems_version:
|
|
110
|
-
signing_key:
|
|
47
|
+
rubygems_version: 4.0.20
|
|
111
48
|
specification_version: 4
|
|
112
49
|
summary: Secret String
|
|
113
50
|
test_files: []
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require 'secret_string'
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
describe 'Coding guidelines' do
|
|
4
|
-
|
|
5
|
-
it 'makes sure code style follow Rubocop guides' do
|
|
6
|
-
rubocop_report = JSON.parse(`bundle exec rubocop --format json`)
|
|
7
|
-
expect(rubocop_report['summary']['offense_count']).to(
|
|
8
|
-
eq(0),
|
|
9
|
-
proc do
|
|
10
|
-
# Format a great error message to help
|
|
11
|
-
wrong_files = rubocop_report['files'].reject { |file_info| file_info['offenses'].empty? }
|
|
12
|
-
<<~EO_ERROR
|
|
13
|
-
#{wrong_files.size} files have Rubocop issues:
|
|
14
|
-
#{
|
|
15
|
-
wrong_files.map do |file_info|
|
|
16
|
-
offenses = file_info['offenses'].map { |offense_info| "L#{offense_info['location']['start_line']}: #{offense_info['cop_name']} - #{offense_info['message']}" }
|
|
17
|
-
"* #{file_info['path']}:#{
|
|
18
|
-
if offenses.size == 1
|
|
19
|
-
" #{offenses.first}"
|
|
20
|
-
else
|
|
21
|
-
" #{offenses.size} offenses:\n#{offenses.map { |offense| " - #{offense}" }.join("\n")}"
|
|
22
|
-
end
|
|
23
|
-
}"
|
|
24
|
-
end.join("\n")
|
|
25
|
-
}
|
|
26
|
-
EO_ERROR
|
|
27
|
-
end
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
end
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
describe SecretString do
|
|
2
|
-
|
|
3
|
-
context 'with a silenced string' do
|
|
4
|
-
|
|
5
|
-
subject(:secret) { described_class.new('MySecret', silenced_str: 'SilencedString') }
|
|
6
|
-
|
|
7
|
-
it 'silences using to_s' do
|
|
8
|
-
expect(secret.to_s).to eq 'SilencedString'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it 'silences using inspect' do
|
|
12
|
-
expect(secret.inspect).to eq '"SilencedString"'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it 'reveals using to_unprotected' do
|
|
16
|
-
expect(secret.to_unprotected).to eq 'MySecret'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it 'erases the data in memory' do
|
|
20
|
-
secret.erase
|
|
21
|
-
expect(secret.to_unprotected).not_to eq 'MySecret'
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it 'equals correctly with a string having the same content' do
|
|
25
|
-
expect(secret).to eq 'MySecret'
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'matches correctly with a string having the same content' do
|
|
29
|
-
expect(secret).to match(/Secret/)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'matches correctly using the =~ operator with a string having the same content' do
|
|
33
|
-
expect(secret =~ /Secret/).not_to be nil
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it 'reports the correct size' do
|
|
37
|
-
expect(secret.size).to eq 'MySecret'.size
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
context 'with a silenced frozen string' do
|
|
43
|
-
|
|
44
|
-
it 'fails to initialize a secret string frozen' do
|
|
45
|
-
expect { described_class.new('MySecret'.freeze, silenced_str: 'SilencedString') }.to raise_error 'Can\'t silence a frozen string'
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe 'erase' do
|
|
51
|
-
|
|
52
|
-
it 'erases a String' do
|
|
53
|
-
str = 'MySecret'
|
|
54
|
-
described_class.erase(str)
|
|
55
|
-
expect(str).not_to eq 'MySecret'
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it 'fails to erase a frozen String' do
|
|
59
|
-
str = 'MySecret'.freeze
|
|
60
|
-
expect { described_class.erase(str) }.to raise_error 'Can\'t erase a frozen string'
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
describe 'protect' do
|
|
66
|
-
|
|
67
|
-
it 'protects a String' do
|
|
68
|
-
str = 'MySecret'
|
|
69
|
-
described_class.protect(str, silenced_str: 'SilencedString') do |secret_string|
|
|
70
|
-
expect(secret_string.to_s).to eq 'SilencedString'
|
|
71
|
-
expect(secret_string.to_unprotected).to eq 'MySecret'
|
|
72
|
-
expect(str.to_s).to eq 'MySecret'
|
|
73
|
-
end
|
|
74
|
-
expect(str.to_s).not_to eq 'MySecret'
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it 'fails to protect a frozen String' do
|
|
78
|
-
str = 'MySecret'.freeze
|
|
79
|
-
called = false
|
|
80
|
-
expect do
|
|
81
|
-
described_class.protect(str, silenced_str: 'SilencedString') do
|
|
82
|
-
called = true
|
|
83
|
-
end
|
|
84
|
-
end.to raise_error 'Can\'t protect a frozen string'
|
|
85
|
-
expect(called).to eq false
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
describe String do
|
|
2
|
-
|
|
3
|
-
it 'implements the same API as SecretString: to_unprotected' do
|
|
4
|
-
expect('MySecret'.to_unprotected).to eq 'MySecret'
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
it 'implements the same API as SecretString: erase' do
|
|
8
|
-
str = 'MySecret'
|
|
9
|
-
expect { str.erase }.not_to raise_error
|
|
10
|
-
expect(str).to eq 'MySecret'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it 'equals the unprotected value of a secret string' do
|
|
14
|
-
str = 'MySecret'
|
|
15
|
-
expect(str).to eq SecretString.new('MySecret', silenced_str: 'SilencedString')
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
require 'secret_string_test/helpers'
|
|
2
|
-
|
|
3
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
4
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
5
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
6
|
-
# this file to always be loaded, without a need to explicitly require it in any
|
|
7
|
-
# files.
|
|
8
|
-
#
|
|
9
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
|
10
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
11
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
12
|
-
# individual file that may not need all of that loaded. Instead, consider making
|
|
13
|
-
# a separate helper file that requires the additional dependencies and performs
|
|
14
|
-
# the additional setup, and require it from the spec files that actually need
|
|
15
|
-
# it.
|
|
16
|
-
#
|
|
17
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
18
|
-
RSpec.configure do |config|
|
|
19
|
-
# rspec-expectations config goes here. You can use an alternate
|
|
20
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
21
|
-
# assertions if you prefer.
|
|
22
|
-
config.expect_with :rspec do |expectations|
|
|
23
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
24
|
-
# and `failure_message` of custom matchers include text for helper methods
|
|
25
|
-
# defined using `chain`, e.g.:
|
|
26
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
|
27
|
-
# # => "be bigger than 2 and smaller than 4"
|
|
28
|
-
# ...rather than:
|
|
29
|
-
# # => "be bigger than 2"
|
|
30
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
|
34
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
35
|
-
config.mock_with :rspec do |mocks|
|
|
36
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
|
37
|
-
# a real object. This is generally recommended, and will default to
|
|
38
|
-
# `true` in RSpec 4.
|
|
39
|
-
mocks.verify_partial_doubles = true
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
|
43
|
-
# have no way to turn it off -- the option exists only for backwards
|
|
44
|
-
# compatibility in RSpec 3). It causes shared context metadata to be
|
|
45
|
-
# inherited by the metadata hash of host groups and examples, rather than
|
|
46
|
-
# triggering implicit auto-inclusion in groups with matching metadata.
|
|
47
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
48
|
-
|
|
49
|
-
# The settings below are suggested to provide a good initial experience
|
|
50
|
-
# with RSpec, but feel free to customize to your heart's content.
|
|
51
|
-
|
|
52
|
-
# This allows you to limit a spec run to individual examples or groups
|
|
53
|
-
# you care about by tagging them with `:focus` metadata. When nothing
|
|
54
|
-
# is tagged with `:focus`, all examples get run. RSpec also provides
|
|
55
|
-
# aliases for `it`, `describe`, and `context` that include `:focus`
|
|
56
|
-
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
|
57
|
-
# config.filter_run_when_matching :focus
|
|
58
|
-
|
|
59
|
-
# Allows RSpec to persist some state between runs in order to support
|
|
60
|
-
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
61
|
-
# you configure your source control system to ignore this file.
|
|
62
|
-
# config.example_status_persistence_file_path = "spec/examples.txt"
|
|
63
|
-
|
|
64
|
-
# Limits the available syntax to the non-monkey patched syntax that is
|
|
65
|
-
# recommended. For more details, see:
|
|
66
|
-
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
|
67
|
-
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
68
|
-
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
|
69
|
-
# config.disable_monkey_patching!
|
|
70
|
-
|
|
71
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
|
72
|
-
# be too noisy due to issues in dependencies.
|
|
73
|
-
# config.warnings = true
|
|
74
|
-
|
|
75
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
|
76
|
-
# file, and it's useful to allow more verbose output when running an
|
|
77
|
-
# individual spec file.
|
|
78
|
-
# if config.files_to_run.one?
|
|
79
|
-
# # Use the documentation formatter for detailed output,
|
|
80
|
-
# # unless a formatter has already been configured
|
|
81
|
-
# # (e.g. via a command-line flag).
|
|
82
|
-
# config.default_formatter = "doc"
|
|
83
|
-
# end
|
|
84
|
-
|
|
85
|
-
# Print the 10 slowest examples and example groups at the
|
|
86
|
-
# end of the spec run, to help surface which specs are running
|
|
87
|
-
# particularly slow.
|
|
88
|
-
# config.profile_examples = 10
|
|
89
|
-
|
|
90
|
-
# Run specs in random order to surface order dependencies. If you find an
|
|
91
|
-
# order dependency and want to debug it, you can fix the order by providing
|
|
92
|
-
# the seed, which is printed after each run.
|
|
93
|
-
# --seed 1234
|
|
94
|
-
# config.order = :random
|
|
95
|
-
|
|
96
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
|
97
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
98
|
-
# test failures related to randomization by passing the same `--seed` value
|
|
99
|
-
# as the one that triggered the failure.
|
|
100
|
-
# Kernel.srand config.seed
|
|
101
|
-
|
|
102
|
-
end
|