File tree Expand file tree Collapse file tree 3 files changed +8
-16
lines changed Expand file tree Collapse file tree 3 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,9 @@ def strict
56
56
end
57
57
58
58
def strict_string
59
- if Settings . strict . is_a? String
60
- Settings . strict
61
- elsif Settings . strict
59
+ if strict . is_a? String
60
+ strict
61
+ elsif strict
62
62
'set -euo pipefail'
63
63
else
64
64
'set -e'
Original file line number Diff line number Diff line change 1
1
require 'spec_helper'
2
2
3
3
describe Settings do
4
- subject { described_class }
4
+ subject { BaselineSettings . clone }
5
5
6
6
describe 'standard value' do
7
7
it 'returns a predefined default value' do
8
8
expect ( subject . tab_indent ) . to be false
9
9
end
10
10
11
11
context 'when settings.yml exists' do
12
- original_value = described_class . source_dir
13
-
14
12
before do
15
13
reset_tmp_dir
16
14
File . write 'spec/tmp/settings.yml' , 'source_dir: somedir'
17
15
subject . source_dir = nil
18
16
end
19
17
20
- after { described_class . source_dir = original_value }
21
-
22
18
it 'returns the value from the settings file' do
23
19
Dir . chdir 'spec/tmp' do
24
20
expect ( subject . source_dir ) . to eq 'somedir'
27
23
end
28
24
29
25
context 'when bashly-settings.yml exists' do
30
- original_value = described_class . source_dir
31
-
32
26
before do
33
27
reset_tmp_dir
34
28
File . write 'spec/tmp/bashly-settings.yml' , 'source_dir: somedir'
35
29
subject . source_dir = nil
36
30
end
37
31
38
- after { described_class . source_dir = original_value }
39
-
40
32
it 'returns the value from the settings file' do
41
33
Dir . chdir 'spec/tmp' do
42
34
expect ( subject . source_dir ) . to eq 'somedir'
93
85
end
94
86
95
87
describe 'strict_string' do
96
- original_value = described_class . strict
97
-
98
- after { subject . strict = original_value }
99
-
100
88
context 'when strict is true' do
101
89
before { subject . strict = true }
102
90
Original file line number Diff line number Diff line change 34
34
Settings . env = :development
35
35
reset_tmp_dir
36
36
37
+ # This is used in the Settings spec, to ensure we are working with an
38
+ # eigenclass that has a known state
39
+ BaselineSettings = Settings . clone
40
+
37
41
# Consistent Colsole output (for rspec_fixtures)
38
42
ENV [ 'TTY' ] = 'off'
39
43
ENV [ 'COLUMNS' ] = '80'
You can’t perform that action at this time.
0 commit comments