Sha256: f66aa0bed9785d7897e8e1feaac31c4fd0d25dc8fdb5ad0b8e5d05c5fb779d05

Contents?: true

Size: 1.02 KB

Versions: 12

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

12 entries across 12 versions & 3 rubygems

Version Path
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/spec/cucumber/core/event_spec.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/spec/cucumber/core/event_spec.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/spec/cucumber/core/event_spec.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/spec/cucumber/core/event_spec.rb
cucumber-core-11.0.0 spec/cucumber/core/event_spec.rb
cucumber-core-10.1.1 spec/cucumber/core/event_spec.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-core-10.1.0/spec/cucumber/core/event_spec.rb
cucumber-core-10.1.0 spec/cucumber/core/event_spec.rb
cucumber-core-10.0.1 spec/cucumber/core/event_spec.rb
cucumber-core-10.0.0 spec/cucumber/core/event_spec.rb
cucumber-core-9.0.1 spec/cucumber/core/event_spec.rb
cucumber-core-9.0.0 spec/cucumber/core/event_spec.rb