From eefcf483de2d45994d845f08b6d41204edeb7be8 Mon Sep 17 00:00:00 2001 From: Glenn Gillen Date: Mon, 19 Jan 2015 15:47:24 +1100 Subject: [PATCH] Allow ENV and yaml configs to co-exist. --- lib/nesta/config.rb | 2 +- spec/config_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/nesta/config.rb b/lib/nesta/config.rb index 758bca36..93cf548a 100644 --- a/lib/nesta/config.rb +++ b/lib/nesta/config.rb @@ -91,7 +91,7 @@ def self.yaml_exists? private_class_method :yaml_exists? def self.can_use_yaml? - ENV.keys.grep(/^NESTA/).empty? && yaml_exists? + yaml_exists? end private_class_method :can_use_yaml? diff --git a/spec/config_spec.rb b/spec/config_spec.rb index a9437db3..66886d20 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -18,10 +18,10 @@ @title = "Title from ENV" ENV["NESTA_TITLE"] = @title end - - it "should never try and access config.yml" do + + it "should fallback to config.yml" do stub_config_key("subtitle", "Subtitle in YAML file") - Nesta::Config.subtitle.should be_nil + Nesta::Config.subtitle.should == "Subtitle in YAML file" end it "should override config.yml" do