Sha256: fe72fb010c15c0c46a44e988218edf3f610b7e27255835c159eeb11136c96080
Contents?: true
Size: 1.38 KB
Versions: 4
Compression:
Stored size: 1.38 KB
Contents
Feature: Running Observed inside Clockwork In order to integrate Observed with Clockwork, I want to configure Clockwork to run Observed. Scenario: Create a .rb file containing Observed code and run it with the ruby command Given a file named "observed.conf" with: """ require 'observed/builtin_plugins' require_relative 'foo_plugin' observe 'foo_1', via: 'foo' report /foo_1/, via: 'stdout' """ Given a file named "foo_plugin.rb" with: """ module OneshotSpec class FooPlugin < Observed::Observer plugin_name 'foo' default timeout_in_milliseconds: 5000 default number_of_trials: 10 def observe sleep_duration = rand / 20 sleep sleep_duration ::Thread.start { sleep 1 exit } system.report(tag, {text: "Foo #{sleep_duration}"}) end def logger @logger ||= Logger.new(STDOUT) end end end """ Given a file named "clockwork.rb" with: """ require 'clockwork' require 'observed/clockwork' include Clockwork include Observed::Clockwork register_observed_handler :config_file => File.dirname(__FILE__) + '/observed.conf' every(10.seconds, 'foo_1') """ When I run `clockwork clockwork.rb` Then the output should contain: """ 00 foo_1 {:text=>"Foo """
Version data entries
4 entries across 4 versions & 2 rubygems