Skip to content

Allow any kind of formatter to use profile information

gitlab-qa-bot requested to merge github/fork/MasterLambaster/formatter into master

Created by: MasterLambaster

Right now only BaseTextFormatters are using profile information. This change allows any formatter to get basic profile info for later use. It also fixes JSON formatter that fails with profile flag:

rspec --format=json --profile
# JSON output start ...
rspec-core-2.14.3/lib/rspec/core/formatters/json_formatter.rb:31:in `dump_summary': undefined local variable or method `dump_profile' for #<RSpec::Core::Formatters::JsonFormatter:0x007fbe92094fe0> (NameError)

Sample of JSON profile part

"profile":{
      "examples":[
         {
            "description":"loads mocks and expectations when the constants are referenced",
            "full_description":"RSpec loads mocks and expectations when the constants are referenced",
            "status":"passed",
            "file_path":"./spec/rspec/core_spec.rb",
            "line_number":75,
            "run_time":0.367445
         }
      ],
      "slowest":0.9625640000000001,
      "total":2.489405000000001,
      "groups":[
         {
            "total_time":0.370392,
            "count":10,
            "description":"RSpec",
            "average":0.0370392,
            "location":"./spec/rspec/core_spec.rb:3"
         }
      ]

Merge request reports