class Cuukie::Formatter

Public Class Methods

new(*) click to toggle source
# File lib/cuukie/formatter.rb, line 8
def initialize(*)
  @server = ENV['CUUKIE_SERVER'] || 'http://localhost:4569'
  RestClient.get "#{@server}/ping"
rescue
  puts "I cannot find the cuukie server on #{@server}."
  puts "Please start the server with cuukie --server."
  exit
end

Public Instance Methods

after_features(features) click to toggle source
# File lib/cuukie/formatter.rb, line 71
def after_features(features)
  post 'after_features', { :duration => features.duration }
end
after_step_result(keyword, step_match, multiline_arg, status, *) click to toggle source
# File lib/cuukie/formatter.rb, line 63
def after_step_result(keyword, step_match, multiline_arg, status, *)
  post 'after_step_result', { :status => status }
end
after_steps(*) click to toggle source
# File lib/cuukie/formatter.rb, line 67
def after_steps(*)
  post 'after_steps'
end
before_feature(feature) click to toggle source
# File lib/cuukie/formatter.rb, line 21
def before_feature(feature)
  post 'before_feature', { :short_name => feature.short_name,
                           :description => feature.description }
end
before_features(*) click to toggle source
# File lib/cuukie/formatter.rb, line 17
def before_features(*)
  post 'before_features'
end
before_step(step) click to toggle source
# File lib/cuukie/formatter.rb, line 36
def before_step(step)
  post 'before_step', { :keyword => step.keyword,
                        :name => step.name,
                        :file_colon_line => step.file_colon_line }
end
before_table_row(*) click to toggle source
# File lib/cuukie/formatter.rb, line 42
def before_table_row(*)
  post 'before_table_row'
end
doc_string(string) click to toggle source
# File lib/cuukie/formatter.rb, line 50
def doc_string(string)
  post 'doc_string', { :multiline_string => string }
end
exception(exception, *) click to toggle source
# File lib/cuukie/formatter.rb, line 54
def exception(exception, *)
  source = backtrace_to_snippet(exception.backtrace)
  post 'exception', { :message => exception.message,
                      :backtrace => exception.backtrace.join('\n'),
                      :raw_lines => source[:raw_lines],
                      :first_line => source[:first_line],
                      :marked_line => source[:marked_line]  }
end
feature_name(keyword, *) click to toggle source
# File lib/cuukie/formatter.rb, line 26
def feature_name(keyword, *)
  post 'feature_name', { :keyword => keyword }
end
scenario_name(keyword, name, file_colon_line, *) click to toggle source
# File lib/cuukie/formatter.rb, line 30
def scenario_name(keyword, name, file_colon_line, *)
  post 'scenario_name', { :keyword => keyword,
                          :name => name,
                          :file_colon_line => file_colon_line }
end
table_cell_value(value, *) click to toggle source
# File lib/cuukie/formatter.rb, line 46
def table_cell_value(value, *)
  post 'table_cell_value', { :value => value }
end

Private Instance Methods

post(url, params = {}) click to toggle source
# File lib/cuukie/formatter.rb, line 77
def post(url, params = {})
  RestClient.post "#{@server}/#{url}", params
end