Sha256: 8536b0c6434c832c7dcc8664909e9c18c0447f81b35fe823ca0f7f894fa9fb1e

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe TreasureData::Logger::Event do
  context 'preset' do
    let(:test_logger) do
      Fluent::Logger::TestLogger.new
    end
    before(:each) do
      t = test_logger
      TreasureData::Logger.class_variable_set(:@@logger, t)
      TD.event.attribute.clear
    end

    it 'action' do
      test_logger.should_receive(:post).with(:doit, {:action=>"doit", :foo=>:bar, :uid=>"uid1"}).twice
      TD.event.action(:doit, {:foo=>:bar}, "uid1")
      TD.event.attribute[:uid] = "uid1"
      TD.event.action(:doit, {:foo=>:bar})
    end

    it 'register' do
      test_logger.should_receive(:post).with(:register, {:action=>"register", :uid=>"uid1"}).twice
      TD.event.register("uid1")
      TD.event.attribute[:uid] = "uid1"
      TD.event.register
    end

    it 'login' do
      test_logger.should_receive(:post).with(:login, {:action=>"login", :uid=>"uid1"}).twice
      TD.event.login("uid1")
      TD.event.attribute[:uid] = "uid1"
      TD.event.login
    end

    it 'pay' do
      test_logger.should_receive(:post).with(:pay, {:action=>"pay", :category=>"cat", :sub_category=>"subcat", :name=>"name", :price=>1980, :count=>1, :uid=>"uid1"}).twice
      TD.event.pay("cat", "subcat", "name", 1980, 1, "uid1")
      TD.event.attribute[:uid] = "uid1"
      TD.event.pay("cat", "subcat", "name", 1980, 1)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
td-logger-0.3.6 spec/event_spec.rb
td-logger-0.3.5 spec/event_spec.rb
td-logger-0.3.4 spec/event_spec.rb
td-logger-0.3.3 spec/event_spec.rb
td-logger-0.3.2 spec/event_spec.rb