Sha256: 51cf4d1d84119d543b7c3abba480ecd5f9ae7b8b04b5103e4c7119286cb1b66d

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

Feature: Integration via single Ruby source

  In order to easily integrate Observed with EventMachine,
  I want to extend Observed's DSL with words specific to the EventMachine integration,
  and make it runnable and testable in single Ruby source.

  Scenario: Create a .rb file containing Observed code and run it with the ruby command
    Given a file named "test.rb" with:
    """
    require 'observed'
    require 'observed/eventmachine'

    include Observed

    extend Observed::EM

    $count = 0

    class Test < Observed::Observer
      plugin_name 'test'
      def observe
        $count += 1
        system.report(tag, {foo:1})
        if $count >= 2
          Thread.start {
            sleep 1
            exit
          }
        end
      end
    end

    observe 'foo', via: 'test'

    report /foo/, via: 'stdout', with: {
      format: -> tag, _, data { "#{tag} #{$count} #{data}" }
    }

    every 1, run: 'foo'

    start
    """
    When I run `ruby test.rb`
    Then the output should contain:
    """
    foo 1 {:foo=>1}
    foo 2 {:foo=>1}
    """

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
observed-0.2.0 integrations/observed-eventmachine/features/integration_via_single_ruby_source.feature
observed-0.2.0.rc2 integrations/observed-eventmachine/features/integration_via_single_ruby_source.feature
observed-0.2.0.rc1 integrations/observed-eventmachine/features/integration_via_single_ruby_source.feature