Sha256: 35a6b0ee6587ea469827d9a3e8790f9b3588b5862afde1637ada5d3e225ce7db

Contents?: true

Size: 843 Bytes

Versions: 7

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

# rubocop:disable Lint/AssignmentInCondition
module RspecJunitFormatterBitbucket
  # Format attribute to xml
  module Attribute
    def self.classname_for(notification)
      fp = example_group_file_path_for(notification)
      fp.sub(%r{\.[^/]*\Z}, '').tr('/', '.').gsub(/\A\.+|\.+\Z/, '')
    end

    def self.description_for(notification)
      notification.example.full_description
    end

    def self.example_group_file_path_for(notification)
      metadata = notification.example.metadata[:example_group]
      while parent_metadata = metadata[:parent_example_group]
        metadata = parent_metadata
      end
      metadata[:file_path]
    end

    def self.duration_for(notification)
      notification.example.execution_result.run_time
    end
  end
end
# rubocop:enable Lint/AssignmentInCondition

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rspec_junit_formatter_bitbucket-0.2.0.pre.184 lib/rspec_junit_formatter_bitbucket/attribute.rb
rspec_junit_formatter_bitbucket-0.2.0.pre.183 lib/rspec_junit_formatter_bitbucket/attribute.rb
rspec_junit_formatter_bitbucket-0.2.0.pre.182 lib/rspec_junit_formatter_bitbucket/attribute.rb
rspec_junit_formatter_bitbucket-0.2.0.pre.181 lib/rspec_junit_formatter_bitbucket/attribute.rb
rspec_junit_formatter_bitbucket-0.2.0.pre.180 lib/rspec_junit_formatter_bitbucket/attribute.rb
rspec_junit_formatter_bitbucket-0.2.0.pre.171 lib/rspec_junit_formatter_bitbucket/attribute.rb
rspec_junit_formatter_bitbucket-0.2.0.pre.170 lib/rspec_junit_formatter_bitbucket/attribute.rb