# Testing Ruby For Logstash Event Object

**URL:** <https://discuss.elastic.co/t/testing-ruby-for-logstash-event-object/253196>\
**Category:** Logstash\
**Created:** [October 24, 2020, 6:35am UTC](https://discuss.elastic.co/t/testing-ruby-for-logstash-event-object/253196 "2020-10-24T06:35:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mastersmit](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mastersmit](https://discuss.elastic.co/u/mastersmit)\
**Post date:** [October 24, 2020, 6:35am UTC](https://discuss.elastic.co/t/testing-ruby-for-logstash-event-object/253196/1 "2020-10-24T06:35:12Z")

</div>

I am planning on writing some unit test for a ruby code i have written.

Here is the snippet:

```auto
require 'minitest/autorun'

describe "Test Event Object" do

    before do
        @event = new Event()
    end

    it "should add key value to the event" do
        @event.set('test', 'value')
        puts @event
    end
end

```

But it gives me error

```auto
1) Error:
Test Event Object#test_0001_should add key value to the event:
NoMethodError: undefined method `Event' for #<#<Class:0x00007f9e6a964bb8>:0x00007f9e6d849870>
    eventObject.spec.rb:7:in `block (2 levels) in <main>'

1 runs, 0 assertions, 0 failures, 1 errors, 0 skips

```

Any idea how i can import Event object used by Logstash?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 21, 2020, 6:35am UTC](https://discuss.elastic.co/t/testing-ruby-for-logstash-event-object/253196/2 "2020-11-21T06:35:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
