spec/td_logger_spec.rb in td-logger-0.3.18 vs spec/td_logger_spec.rb in td-logger-0.3.19
- old
+ new
@@ -1,9 +1,21 @@
require 'spec_helper'
describe TreasureData::Logger::TreasureDataLogger do
context 'init' do
+ it 'with apikey' do
+ td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'test_1')
+ td.instance_variable_get(:@client).api.apikey.should == 'test_1'
+ td.instance_variable_get(:@client).api.instance_variable_get(:@ssl).should be_false
+ end
+
+ it 'with apikey and use_ssl' do
+ td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'test_1', :use_ssl => true)
+ td.instance_variable_get(:@client).api.apikey.should == 'test_1'
+ td.instance_variable_get(:@client).api.instance_variable_get(:@ssl).should be_true
+ end
+
it 'db config' do
td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'test_1')
time = Time.now
td.should_receive(:add).with('db1', 'table1', {:foo=>:bar, :time=>time.to_i})
td.post_with_time('table1', {:foo=>:bar}, time)