File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,13 @@ def user_settings
101
101
end
102
102
103
103
def user_settings_path
104
- ENV [ 'BASHLY_SETTINGS_PATH' ] || 'settings.yml'
104
+ @user_settings_path ||= if ENV [ 'BASHLY_SETTINGS_PATH' ]
105
+ ENV [ 'BASHLY_SETTINGS_PATH' ]
106
+ elsif File . exist? 'bashly-settings.yml'
107
+ 'bashly-settings.yml'
108
+ else
109
+ 'settings.yml'
110
+ end
105
111
end
106
112
107
113
def defsult_settings
Original file line number Diff line number Diff line change 8
8
expect ( subject . tab_indent ) . to be false
9
9
end
10
10
11
+ context 'when settings.yml exists' do
12
+ original_value = described_class . source_dir
13
+
14
+ before do
15
+ reset_tmp_dir
16
+ File . write 'spec/tmp/settings.yml' , 'source_dir: somedir'
17
+ subject . source_dir = nil
18
+ end
19
+
20
+ after { described_class . source_dir = original_value }
21
+
22
+ it 'returns the value from the settings file' do
23
+ Dir . chdir 'spec/tmp' do
24
+ expect ( subject . source_dir ) . to eq 'somedir'
25
+ end
26
+ end
27
+ end
28
+
29
+ context 'when bashly-settings.yml exists' do
30
+ original_value = described_class . source_dir
31
+
32
+ before do
33
+ reset_tmp_dir
34
+ File . write 'spec/tmp/bashly-settings.yml' , 'source_dir: somedir'
35
+ subject . source_dir = nil
36
+ end
37
+
38
+ after { described_class . source_dir = original_value }
39
+
40
+ it 'returns the value from the settings file' do
41
+ Dir . chdir 'spec/tmp' do
42
+ expect ( subject . source_dir ) . to eq 'somedir'
43
+ end
44
+ end
45
+ end
46
+
11
47
context 'when its corresponding env var is set' do
12
48
original_value = ENV [ 'BASHLY_TAB_INDENT' ]
13
49
You can’t perform that action at this time.
0 commit comments