class Cog::SpecHelpers::Runner
Points to the cog
command-line app
Public Class Methods
new(exec_path = nil, opt={})
click to toggle source
@param exec_path [String] path to the executable @option opt [Array<String>] :flags (['–colorless']) command line flags to pass each time the executable is invoked @option opt [Boolean] :use_bundler (true) Should `bundle exec` prefix each invocation of the executable?
# File lib/cog/spec_helpers/runner.rb, line 12 def initialize(exec_path = nil, opt={}) @exec_path = if exec_path exec_path else File.expand_path File.join(File.dirname(__FILE__), '..', '..', '..', 'bin', 'cog') end @flags = opt[:flags] || ['--colorless'] @use_bundler = opt[:use_bundler].nil? ? true : opt[:use_bundler] end
Public Instance Methods
run(*args)
click to toggle source
Run cog with the given arguments @param args [Array<String>] arguments to pass to cog
@return [Invocation] an object which can be used with custom {Matchers}
# File lib/cog/spec_helpers/runner.rb, line 25 def run(*args) cmd = ([@exec_path] + @flags + args).collect &:to_s Invocation.new(cmd, :use_bundler => @use_bundler) end