The formatter used for --format json
# File lib/cucumber/formatter/json.rb, line 37 37: def after_background(background) 38: @current_object = last_feature 39: end
# File lib/cucumber/formatter/json.rb, line 120 120: def after_feature_element(feature_element) 121: # change current object back to the last feature 122: @current_object = last_feature 123: end
# File lib/cucumber/formatter/json.rb, line 125 125: def after_features(features) 126: @io.write json_string 127: @io.flush 128: end
# File lib/cucumber/formatter/json.rb, line 77 77: def after_step(step) 78: @current_step = nil 79: end
# File lib/cucumber/formatter/json.rb, line 109 109: def after_table_row(row) 110: if row.exception 111: @current_row[:exception] = exception_hash_for(row.exception) 112: end 113: @current_row = nil 114: end
# File lib/cucumber/formatter/json.rb, line 31 31: def before_background(background) 32: background = {} 33: @current_object[:background] = background 34: @current_object = background 35: end
# File lib/cucumber/formatter/json.rb, line 81 81: def before_examples(examples) 82: @current_object[:examples] = {} 83: end
# File lib/cucumber/formatter/json.rb, line 22 22: def before_feature(feature) 23: @current_object = {:file => feature.file, :name => feature.name} 24: @json[:features] << @current_object 25: end
# File lib/cucumber/formatter/json.rb, line 41 41: def before_feature_element(feature_element) 42: elements = @current_object[:elements] ||= [] 43: 44: # change current object to the feature_element 45: @current_object = {} 46: elements << @current_object 47: end
# File lib/cucumber/formatter/json.rb, line 18 18: def before_features(features) 19: @json = {:features => []} 20: end
# File lib/cucumber/formatter/json.rb, line 89 89: def before_outline_table(*args) 90: @current_object[:examples][:table] = [] 91: end
# File lib/cucumber/formatter/json.rb, line 59 59: def before_step(step) 60: @current_step = {} 61: @current_object[:steps] << @current_step 62: end
# File lib/cucumber/formatter/json.rb, line 64 64: def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) 65: if exception 66: @current_step[:exception] = exception_hash_for(exception) 67: end 68: end
# File lib/cucumber/formatter/json.rb, line 55 55: def before_steps(steps) 56: @current_object[:steps] = [] 57: end
# File lib/cucumber/formatter/json.rb, line 93 93: def before_table_row(row) 94: @current_row = {:cells => []} 95: 96: if @current_object.member? :examples 97: @current_object[:examples][:table] << @current_row 98: elsif @current_step 99: (@current_step[:table] ||= []) << @current_row 100: else 101: internal_error 102: end 103: end
# File lib/cucumber/formatter/json.rb, line 130 130: def embed(file, mime_type) 131: obj = @current_step || @current_object 132: obj[:embedded] ||= [] 133: 134: obj[:embedded] << { 135: :file => file, 136: :mime_type => mime_type, 137: :data => [File.read(file)].pack("m*") # base64 138: } 139: end
# File lib/cucumber/formatter/json.rb, line 85 85: def examples_name(keyword, name) 86: @current_object[:examples][:name] = "#{keyword} #{name}" 87: end
# File lib/cucumber/formatter/json.rb, line 116 116: def py_string(string) 117: @current_step[:py_string] = string 118: end
# File lib/cucumber/formatter/json.rb, line 49 49: def scenario_name(keyword, name, file_colon_line, source_indent) 50: @current_object[:keyword] = keyword 51: @current_object[:name] = name 52: @current_object[:file_colon_line] = file_colon_line 53: end
# File lib/cucumber/formatter/json.rb, line 70 70: def step_name(keyword, step_match, status, source_indent, background) 71: @current_step[:status] = status 72: @current_step[:keyword] = keyword 73: @current_step[:name] = "#{step_match.name || step_match.format_args}" 74: @current_step[:file_colon_line] = step_match.file_colon_line 75: end
# File lib/cucumber/formatter/json.rb, line 151 151: def exception_hash_for(e) 152: { 153: :class => e.class.name, 154: :message => e.message, 155: :backtrace => e.backtrace 156: } 157: end
# File lib/cucumber/formatter/json.rb, line 159 159: def internal_error 160: raise Error, "you've found a bug in the JSON formatter!" 161: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.