lib/rspeckled/reporting/runner.rb in rspeckled-2.0.1 vs lib/rspeckled/reporting/runner.rb in rspeckled-2.1.0

- old
+ new

@@ -19,10 +19,12 @@ request_count request_time description }.freeze + private_constant :FIELDS + attr_accessor :example, :outputters def initialize(outputters: [ Rspeckled::Reporting::Outputs::Text, @@ -33,45 +35,45 @@ end def start(_notification) return unless defined?(::ActiveSupport::Notifications) - ActiveSupport::Notifications.subscribe('sql.active_record') do |_name, start, finish, _id, query| - example&.log_query(query, start, finish) - end + ::ActiveSupport::Notifications + .subscribe('sql.active_record') do |_name, start, finish, _id, query| + example&.log_query(query, start, finish) + end - ActiveSupport::Notifications.subscribe('process_action.action_controller') do |_name, start, finish, _id, request| - example&.log_request(request, start, finish) - end + ::ActiveSupport::Notifications + .subscribe('process_action.action_controller') do |_name, start, finish, _id, reqst| + example&.log_request(reqst, start, finish) + end end def example_started(notification) self.example = Example.new(notification.example) end - # rubocop:disable Metrics/AbcSize - def example_finished(_notification) + def example_finished(_notification) # rubocop:disable Metrics/AbcSize outputters.each do |outputter| outputter.insert( - :branch => `git rev-parse --abbrev-ref HEAD`.chomp, - :commit_hash => `git rev-parse HEAD`.chomp, - :date => ::Time.parse(`git show -s --format=%ci HEAD`.chomp), - :file => example.file, - :line_number => example.line_number, - :description => example.description, - :status => example.status, - :exception => example.exception, - :time => example.time, - :query_count => example.query_count, - :query_time => example.query_time, - :query_percentage => example.query_time / example.time * 100.0, - :request_count => example.request_count, - :request_time => example.request_time, - :request_percentage => example.request_time / example.time * 100.0 + branch: `git rev-parse --abbrev-ref HEAD`.chomp, + commit_hash: `git rev-parse HEAD`.chomp, + date: ::Time.parse(`git show -s --format=%ci HEAD`.chomp), + file: example.file, + line_number: example.line_number, + description: example.description, + status: example.status, + exception: example.exception, + time: example.time, + query_count: example.query_count, + query_time: example.query_time, + query_percentage: example.query_time / example.time * 100.0, + request_count: example.request_count, + request_time: example.request_time, + request_percentage: example.request_time / example.time * 100.0, ) end end - # rubocop:enable Metrics/AbcSize alias example_passed example_finished alias example_pending example_finished alias example_failed example_finished end