def cli_spec(spec_dir, head_args=nil, tail_args=nil, based_on: nil)
      file_spec(spec_dir, based_on: based_on) do
        output, status = subject.launch(head_args, tail_args)

        args = [head_args, tail_args].compact
        it "$ #{subject.name} #{args.join(' ')}" do
          status.should.satisfy("Binary failed\n\n#{output}") do
            status.success?
          end
        end
        status.success?
      end
    end
def cli_spec(spec_dir, head_args=nil, tail_args=nil, based_on: nil)
      file_spec(spec_dir, based_on: based_on) do
        output, status = subject.launch(head_args, tail_args)

        args = [head_args, tail_args].compact
        it "$ #{subject.name} #{args.join(' ')}" do
          status.should.satisfy("Binary failed\n\n#{output}") do
            status.success?
          end
        end
        status.success?
      end
    end
Ad-hoc defines a set of shared expectations to be consumed directly by `behaves_like`.
 See the following example for usage:

   behaves_like cli_spec('my_spec_dir', 'install --verbose')

 @note    This expects that a method `file_tree_spec_context` is defined, which is
          returning an instance of {FileTreeSpecContext}.

 @param   [String] spec_dir
          the concrete directory of the spec, see {file_spec}.

 @param   [String] head_args
          the arguments to pass before the +default_args+ on launch to {CLIntegracon::Subject}.

 @param   [String] tail_args
          the arguments to pass after the +default_args+ on launch to {CLIntegracon::Subject}.

 @param   [String] based_on
          Allows to specify an optional base spec, whose after directory will be used
          as before directory. You have to ensure that the specs are defined in order,
          so that the base spec was executed before.

 @return  [String]
          name of the set of shared expectations