Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-07-12 01:42:38 +0300
committerStan Hu <stanhu@gmail.com>2017-07-12 01:42:38 +0300
commitbd50b152412dc6c5f2959228110256bfd6b9e81d (patch)
tree975b5a1341cc7aefe6afc623ac1fa160e4c15f67 /spec
parentd3eff572595777389f8b379233c9d918261bada5 (diff)
parentb904a7dbd208f069f618e5ea60de56d8687c606c (diff)
Merge branch 'rs-issue-34941' into 'master'
Make `Redis::Wrapper#_raw_config` and `#fetch_config` more resilient Closes #34941 See merge request !12797
Diffstat (limited to 'spec')
-rw-r--r--spec/support/redis/redis_shared_examples.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/spec/support/redis/redis_shared_examples.rb b/spec/support/redis/redis_shared_examples.rb
index 95a5df181c1..f9552e41894 100644
--- a/spec/support/redis/redis_shared_examples.rb
+++ b/spec/support/redis/redis_shared_examples.rb
@@ -65,14 +65,6 @@ RSpec.shared_examples "redis_shared_examples" do
end
describe '.url' do
- it 'withstands mutation' do
- url1 = described_class.url
- url2 = described_class.url
- url1 << 'foobar'
-
- expect(url2).not_to end_with('foobar')
- end
-
context 'when yml file with env variable' do
let(:config_file_name) { config_with_environment_variable_inside }
@@ -97,6 +89,12 @@ RSpec.shared_examples "redis_shared_examples" do
it 'returns false when the file does not exist' do
expect(subject).to eq(false)
end
+
+ it "returns false when the filename can't be determined" do
+ expect(described_class).to receive(:config_file_name).and_return(nil)
+
+ expect(subject).to eq(false)
+ end
end
describe '.with' do
@@ -192,7 +190,13 @@ RSpec.shared_examples "redis_shared_examples" do
it 'returns false when no config file is present' do
allow(described_class).to receive(:_raw_config) { false }
- expect(subject.send(:fetch_config)).to be_falsey
+ expect(subject.send(:fetch_config)).to eq false
+ end
+
+ it 'returns false when config file is present but has invalid YAML' do
+ allow(described_class).to receive(:_raw_config) { "# development: true" }
+
+ expect(subject.send(:fetch_config)).to eq false
end
end