Sha256: 2b365ca70f818fe6e14da7ecf00eed33fa8f1cbf39ea2ba03b222782d62e76bf

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

require 'rest-client'
require 'json'

module Cucumber
  module Formatter
    class Cuukie
      def initialize(step_mother, io, options)
      end

      def before_features(features)
        post 'before_features'
      end

      def before_feature(feature)
        post 'before_feature', { 'short_name' => feature.short_name,
                                 'description' => feature.description }
      end
  
      def scenario_name(keyword, name, file_colon_line, source_indent)
        post 'scenario_name', { 'keyword' => keyword,
                                'name' => name,
                                'file_colon_line' => file_colon_line }
      end

      def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
        post 'before_step_result', { 'keyword' => keyword,
                                     'name' => step_match.format_args,
                                     'file_colon_line' => step_match.file_colon_line }
      end

      def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
        post 'after_step_result', { 'status' => status }
      end
  
      def after_steps(*)
        post 'after_steps'
      end
  
      def after_features(*)
        post 'after_features'
      end
  
      private
  
      def post(url, params = {})
        RestClient.post "http://localhost:4569/#{url}", params.to_json
      end
    end
  end
end

require 'cucumber/cli/options'
Cucumber::Cli::Options::BUILTIN_FORMATS['cuukie'] = [
  'Cucumber::Formatter::Cuukie',
  'Shows Cucumber results on a web page as they run'
]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cuukie-0.1.2 lib/cuukie/cucumber/formatter/cuukie.rb