Sha256: 3fd2dfc5cb597b2eb5bca08baa864e40845b9ee66f3473b2ecfaab758d3eec61
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'tempfile' require 'tmpdir' describe "Chatterbot::ConfigManager" do before(:each) do tempdir = Dir.tmpdir @tmp_config_dest = File.join(tempdir, 'bot.yml') @config = Chatterbot::ConfigManager.new(@tmp_config_dest, {:consumer_key => "bar"}) end after(:each) do if File.exist?(@tmp_config_dest) File.unlink(@tmp_config_dest) end end describe "delete" do it "deletes a key" do expect(@config.delete(:baz)).to be_nil end it "retains read-only data" do expect(@config[:consumer_key]).to eql("bar") expect(@config.delete(:consumer_key)).to be_nil expect(@config[:consumer_key]).to eql("bar") end end describe "[]=" do it "writes a key" do expect(@config[:baz]).to be_nil @config[:baz] = "hello" expect(@config[:baz]).to eql("hello") end it "does not overwrite read-only data" do expect(@config[:consumer_key]).to eql("bar") @config[:consumer_key] = "baz" expect(@config[:consumer_key]).to eql("bar") end end describe "[]" do it "works with missing key" do expect(@config[:baz]).to be_nil end it "works with read-only data" do expect(@config[:consumer_key]).to eql("bar") end it "works with present key" do @config[:baz] = "hello" expect(@config[:baz]).to eql("hello") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chatterbot-2.2.0 | spec/config_manager_spec.rb |
chatterbot-2.1.0 | spec/config_manager_spec.rb |