Sha256: d0a5115c1ee126f747e79e5c408b3716e1af981333efa0b58f067b383799c38a

Contents?: true

Size: 1.36 KB

Versions: 18

Compression:

Stored size: 1.36 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.module_eval do
        class_variable_set(:@@logger, t)
      end
      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

18 entries across 18 versions & 1 rubygems

Version Path
td-logger-0.3.24 spec/event_spec.rb
td-logger-0.3.23 spec/event_spec.rb
td-logger-0.3.22 spec/event_spec.rb
td-logger-0.3.21 spec/event_spec.rb
td-logger-0.3.20 spec/event_spec.rb
td-logger-0.3.19 spec/event_spec.rb
td-logger-0.3.18 spec/event_spec.rb
td-logger-0.3.17 spec/event_spec.rb
td-logger-0.3.16 spec/event_spec.rb
td-logger-0.3.15 spec/event_spec.rb
td-logger-0.3.14 spec/event_spec.rb
td-logger-0.3.13 spec/event_spec.rb
td-logger-0.3.12 spec/event_spec.rb
td-logger-0.3.11 spec/event_spec.rb
td-logger-0.3.10 spec/event_spec.rb
td-logger-0.3.9 spec/event_spec.rb
td-logger-0.3.8 spec/event_spec.rb
td-logger-0.3.7 spec/event_spec.rb