Sha256: f75562b91bdc0915fcec4bfbf1b623a6b5767411706b7374d152ac3c39ca2a50

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

require 'cucumber/core/event'

module Cucumber
  module Core
    describe Event do

      describe ".new" do
        it "generates new types of events" do
          my_event_type = Event.new
          my_event = my_event_type.new
          expect(my_event).to be_kind_of(Core::Event)
        end

        it "generates events with attributes" do
          my_event_type = Event.new(:foo, :bar)
          my_event = my_event_type.new(1,2)
          expect(my_event.attributes).to eq [1, 2]
          expect(my_event.foo).to eq 1
          expect(my_event.bar).to eq 2
        end
      end

      describe "a generated event" do
        class MyEventType < Event.new(:foo, :bar)
        end

        it "can be converted to a hash" do
          my_event = MyEventType.new(1,2)
          expect(my_event.to_h).to eq foo: 1, bar: 2
        end

        it "has an event_id" do
          expect(MyEventType.event_id).to eq :my_event_type
          expect(MyEventType.new(1,2).event_id).to eq :my_event_type
        end
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cucumber-core-8.0.1 spec/cucumber/core/event_spec.rb
cucumber-core-7.1.0 spec/cucumber/core/event_spec.rb
cucumber-core-7.0.0 spec/cucumber/core/event_spec.rb
cucumber-core-6.0.0 spec/cucumber/core/event_spec.rb
cucumber-core-5.0.2 spec/cucumber/core/event_spec.rb
cucumber-core-5.0.1 spec/cucumber/core/event_spec.rb
cucumber-core-5.0.0 spec/cucumber/core/event_spec.rb
cucumber-core-3.0.0 spec/cucumber/core/event_spec.rb
cucumber-core-3.0.0.pre.2 spec/cucumber/core/event_spec.rb
cucumber-core-2.0.0 spec/cucumber/core/event_spec.rb