Sha256: 73f3208f003dc7bf954ebf196ea4c50db7f9383e85cfe636df3477feeaeec98a

Contents?: true

Size: 1007 Bytes

Versions: 6

Compression:

Stored size: 1007 Bytes

Contents

$:.unshift(File.expand_path('../../lib', __FILE__))

require 'dynflow'

class ExampleHelper
  class << self
    def world
      @world ||= create_world
    end

    def create_world(options = {})
      options = default_world_options.merge(options)
      Dynflow::SimpleWorld.new(options)
    end

    def default_world_options
      { logger_adapter: logger_adapter }
    end

    def logger_adapter
      Dynflow::LoggerAdapters::Simple.new $stderr, 4
    end


    def run_web_console(world = ExampleHelper.world)
      require 'dynflow/web_console'
      dynflow_console = Dynflow::WebConsole.setup do
        set :world, world
      end
      dynflow_console.run!
    end

    # for simulation of the execution failing for the first time
    def something_should_fail!
      @should_fail = true
    end

    # for simulation of the execution failing for the first time
    def something_should_fail?
      @should_fail
    end

    def nothing_should_fail!
      @should_fail = false
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dynflow-0.7.5 examples/example_helper.rb
dynflow-0.7.4 examples/example_helper.rb
dynflow-0.7.3 examples/example_helper.rb
dynflow-0.7.2 examples/example_helper.rb
dynflow-0.7.1 examples/example_helper.rb
dynflow-0.7.0 examples/example_helper.rb