Sha256: fa5473eecb814a538eb2c9ffb4f078ca1a14a2a906f303d1bb04ea73fdc69fed

Contents?: true

Size: 914 Bytes

Versions: 11

Compression:

Stored size: 914 Bytes

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

require 'tengine/event'

describe Tengine::Core::EventWrapper do
  context "[]でpropertiesの属性にアクセス可能" do
    before do
      @event = Tengine::Core::Event.create!(
        :key => Tengine::Event.uuid_gen.generate,
        :event_type_name => "foo",
        :sender_name => "server1",
        :properties => {
          :foo => [1,2,3,4],
          :bar => "BAR"
        })
      @event.reload
    end

    subject do
      Tengine::Core::EventWrapper.new(@event)
    end

    it do
      @event.properties['foo'].should == [1,2,3,4]
      @event.properties[:foo].should == nil
      subject.properties['foo'].should == [1,2,3,4]
      subject.properties[:foo].should == nil
      subject['foo'].should == [1,2,3,4]
      subject[:foo].should == [1,2,3,4]
      subject['bar'].should == "BAR"
      subject[:bar].should == "BAR"
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tengine_core-0.5.39 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.38 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.37 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.36 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.35 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.34 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.33 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.32 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.31 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.30 spec/tengine/core/event_wrapper_spec.rb
tengine_core-0.5.28 spec/tengine/core/event_wrapper_spec.rb