Skip to content

Commit fcc09ca

Browse files
committed
fix specs
1 parent f4d1f66 commit fcc09ca

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

lib/bashly/settings.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def strict
5656
end
5757

5858
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
6262
'set -euo pipefail'
6363
else
6464
'set -e'

spec/bashly/settings_spec.rb

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
require 'spec_helper'
22

33
describe Settings do
4-
subject { described_class }
4+
subject { BaselineSettings.clone }
55

66
describe 'standard value' do
77
it 'returns a predefined default value' do
88
expect(subject.tab_indent).to be false
99
end
1010

1111
context 'when settings.yml exists' do
12-
original_value = described_class.source_dir
13-
1412
before do
1513
reset_tmp_dir
1614
File.write 'spec/tmp/settings.yml', 'source_dir: somedir'
1715
subject.source_dir = nil
1816
end
1917

20-
after { described_class.source_dir = original_value }
21-
2218
it 'returns the value from the settings file' do
2319
Dir.chdir 'spec/tmp' do
2420
expect(subject.source_dir).to eq 'somedir'
@@ -27,16 +23,12 @@
2723
end
2824

2925
context 'when bashly-settings.yml exists' do
30-
original_value = described_class.source_dir
31-
3226
before do
3327
reset_tmp_dir
3428
File.write 'spec/tmp/bashly-settings.yml', 'source_dir: somedir'
3529
subject.source_dir = nil
3630
end
3731

38-
after { described_class.source_dir = original_value }
39-
4032
it 'returns the value from the settings file' do
4133
Dir.chdir 'spec/tmp' do
4234
expect(subject.source_dir).to eq 'somedir'
@@ -93,10 +85,6 @@
9385
end
9486

9587
describe 'strict_string' do
96-
original_value = described_class.strict
97-
98-
after { subject.strict = original_value }
99-
10088
context 'when strict is true' do
10189
before { subject.strict = true }
10290

spec/spec_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
Settings.env = :development
3535
reset_tmp_dir
3636

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+
3741
# Consistent Colsole output (for rspec_fixtures)
3842
ENV['TTY'] = 'off'
3943
ENV['COLUMNS'] = '80'

0 commit comments

Comments
 (0)