lib/cucumber/formatter/json.rb in cucumber-0.8.0 vs lib/cucumber/formatter/json.rb in cucumber-0.8.1
- old
+ new
@@ -67,11 +67,12 @@
end
end
def step_name(keyword, step_match, status, source_indent, background)
@current_step[:status] = status
- @current_step[:name] = "#{keyword}#{step_match.name || step_match.format_args}" # ?
+ @current_step[:keyword] = "#{keyword}"
+ @current_step[:name] = "#{step_match.name || step_match.format_args}"
@current_step[:file_colon_line] = step_match.file_colon_line
end
def after_step(step)
@current_step = nil
@@ -122,9 +123,20 @@
end
def after_features(features)
@io.write json_string
@io.flush
+ end
+
+ def embed(file, mime_type)
+ obj = @current_step || @current_object
+ obj[:embedded] ||= []
+
+ obj[:embedded] << {
+ :file => file,
+ :mime_type => mime_type,
+ :data => [File.read(file)].pack("m*") # base64
+ }
end
private
def json_string