Class: Pact::Doc::SortInteractions

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/doc/sort_interactions.rb

Class Method Summary collapse

Class Method Details

.call(interactions) ⇒ Object



4
5
6
# File 'lib/pact/doc/sort_interactions.rb', line 4

def self.call interactions
  interactions.sort{|a, b| sortable_id(a) <=> sortable_id(b)}
end

.sortable_id(interaction) ⇒ Object



9
10
11
# File 'lib/pact/doc/sort_interactions.rb', line 9

def self.sortable_id interaction
  "#{(interaction.description || '').downcase} #{interaction.response.status} #{(interaction.provider_state || '').downcase}"
end