Sha256: f8cddf02fde8d0ba1a1293224ea3fdcd15f3efa32b0f3fb9ded828d5867a87c3

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

module Pione
  module TestHelper
    class PioneClientRunner < StructX
      member :title
      member :template, default: "%s"
      member :args
      member :base, default: lambda {Pione::Location[Temppath.mkdir]}
      member :default_arguments
      member :context

      def self.test(context, &b)
        # with client mode
        new(context: context).tap do |runner|
          runner.default_arguments = ["--base", runner.base.path.to_s]
          b.call(runner)
        end
      end

      def run(&b)
        _args = args
        _base = base
        context.it(template % title) do
          Rootage::ScenarioTest.succeed(Pione::Command::PioneClient, _args)
          b.call(_base)
        end
      end

      def fail
        _args = args
        context.it(template % title) do
          Rootage::ScenarioTest.fail(Pione::Command::PioneClient, _args)
        end
      end

      def timeout(sec)
        _args = args + ["--timeout", sec.to_s]
        context.it(template % title) do
          Rootage::ScenarioTest.fail(Pione::Command::PioneClient, _args)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pione-0.5.0 lib/pione/test-helper/command-helper.rb
pione-0.5.0.alpha.2 lib/pione/test-helper/command-helper.rb
pione-0.5.0.alpha.1 lib/pione/test-helper/command-helper.rb
pione-0.4.2 lib/pione/test-helper/command-helper.rb
pione-0.4.1 lib/pione/test-helper/command-helper.rb