Skip to content

Commit

Permalink
Allow ENV and yaml configs to co-exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
glenngillen committed Jan 19, 2015
1 parent 826043a commit eefcf48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/nesta/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
6 changes: 3 additions & 3 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eefcf48

Please sign in to comment.