spec/config_spec.rb in chatterbot-0.9.0 vs spec/config_spec.rb in chatterbot-0.9.1
- old
+ new
@@ -60,9 +60,17 @@
expect(@bot.config[:consumer_key]).to eq("env_chatterbot_consumer_key")
expect(@bot.config[:consumer_secret]).to eq("env_chatterbot_consumer_secret")
expect(@bot.config[:token]).to eq("env_chatterbot_token")
expect(@bot.config[:secret]).to eq("env_chatterbot_secret")
end
+
+ it "works if env var is nil" do
+ ENV["chatterbot_consumer_key"] = nil
+ @bot.config = nil
+ allow(@bot).to receive(:slurp_file).and_return({:chatterbot_consumer_key => "foo"})
+
+ expect(@bot.config[:chatterbot_consumer_key]).to eq("foo")
+ end
end
it "update_config? is true by default" do
expect(@bot.update_config?).to eq(true)
end