Class: Strut::InteractionFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/strut/interaction_factory.rb

Instance Method Summary collapse

Instance Method Details

#extension?(tag) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/strut/interaction_factory.rb', line 21

def extension?(tag)
   tag =~ /^x-/
end

#make_interaction(path_stack) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/strut/interaction_factory.rb', line 5

def make_interaction(path_stack)
  interaction = Interaction.new

  if path_stack[0] == "paths"
    interaction.uri = path_stack[1] unless extension?(path_stack[1])
  end

  interaction.method = path_stack[2] unless extension?(path_stack[2])

  if path_stack[3] == "responses"
    interaction.statusCode = path_stack[4] unless extension?(path_stack[4])
  end

  interaction
end