Sha256: 60b0e1a43d2091303f1465d0e480c09f1c511cc6fd5b21b3cb419d53ef31b327

Contents?: true

Size: 792 Bytes

Versions: 10

Compression:

Stored size: 792 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

require 'sequel'

describe "Chatterbot::DB" do
  before(:each) do
    @db_tmp = Tempfile.new("config.db")
    @db_uri = "sqlite://#{@db_tmp.path}"

    @bot = Chatterbot::Bot.new    
    @bot.config[:db_uri] = @db_uri
  end
  
  describe "table creation" do
    [:blacklist, :tweets, :config].each do |table|
      it "should create table #{table}" do
        @bot.db
        @tmp_conn = Sequel.connect(@db_uri)
        @tmp_conn.tables.include?(table).should == true
      end
    end      
  end
  
  describe "store_database_config" do
    it "doesn't fail" do
      @bot = Chatterbot::Bot.new    
      @bot.config[:db_uri] = @db_uri

      @bot.db      
      @bot.store_database_config.should == true
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
chatterbot-0.2.9 spec/db_spec.rb
chatterbot-0.2.8 spec/db_spec.rb
chatterbot-0.2.7 spec/db_spec.rb
chatterbot-0.2.6 spec/db_spec.rb
chatterbot-0.2.5 spec/db_spec.rb
chatterbot-0.2.4 spec/db_spec.rb
chatterbot-0.2.3 spec/db_spec.rb
chatterbot-0.2.2 spec/db_spec.rb
chatterbot-0.2.1 spec/db_spec.rb
chatterbot-0.2.0 spec/db_spec.rb