Sha256: b32e762ad6eabc7828519d8d77f79153d8d36a93e6e532190f7abe41ff98dada
Contents?: true
Size: 1.83 KB
Versions: 3
Compression:
Stored size: 1.83 KB
Contents
# frozen_string_literal: true require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Stealth::Configuration" do describe "accessing via method calling" do let(:services_yml) { File.read(File.join(File.dirname(__FILE__), 'support', 'services.yml')) } let(:parsed_config) { YAML.load(ERB.new(services_yml).result)[Stealth.env] } let(:config) { Stealth.load_services_config!(services_yml) } it "should return the root node" do expect(config.facebook).to eq parsed_config['facebook'] end it "should access deeply nested nodes" do expect(config.facebook.setup.greeting).to eq parsed_config['facebook']['setup']['greeting'] end it "should handle values that are arrays correctly" do expect(config.facebook.setup.persistent_menu).to be_a(Array) end it "should retain the configuration at the class level" do expect(Stealth.config.facebook.setup.greeting).to eq parsed_config['facebook']['setup']['greeting'] end it "should handle multiple keys at the root level" do expect(config.twilio_sms.account_sid).to eq parsed_config['twilio_sms']['account_sid'] end end describe "config files with ERB" do let(:services_yml) { File.read(File.join(File.dirname(__FILE__), 'support', 'services_with_erb.yml')) } let(:config) { Stealth.load_services_config!(services_yml) } it "should replace available embedded env vars" do ENV['FACEBOOK_VERIFY_TOKEN'] = 'it works' expect(config.facebook.verify_token).to eq 'it works' end it "should replace unavailable embedded env vars with nil" do expect(config.facebook.challenge).to be_nil end it "should not reload the configuration file if one already exists" do Stealth.load_services_config(services_yml) expect(config.facebook.challenge).to be_nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
stealth-0.10.2 | spec/configuration_spec.rb |
stealth-0.10.1 | spec/configuration_spec.rb |
stealth-0.10.0 | spec/configuration_spec.rb |