Class: Dommy::Navigation::NullDelegate

Inherits:
Object
  • Object
show all
Defined in:
lib/dommy/navigation.rb

Overview

The default delegate: it performs no navigation, only records each attempt so tests can assert "a navigation to X was triggered" and the observable behaviour is unchanged from before the seam existed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNullDelegate

Returns a new instance of NullDelegate.



46
47
48
# File 'lib/dommy/navigation.rb', line 46

def initialize
  @attempts = []
end

Instance Attribute Details

#attemptsObject (readonly)

Returns the value of attribute attempts.



44
45
46
# File 'lib/dommy/navigation.rb', line 44

def attempts
  @attempts
end

Instance Method Details



50
51
52
53
54
55
56
# File 'lib/dommy/navigation.rb', line 50

def navigate(url:, source:, method: "GET", body: nil, params: nil, enctype: nil, headers: {}, replace: false)
  @attempts << {
    url: url, method: method, body: body, params: params, enctype: enctype,
    headers: headers, replace: replace, source: source
  }
  nil
end

#traverse(delta) ⇒ Object



58
59
60
61
# File 'lib/dommy/navigation.rb', line 58

def traverse(delta)
  @attempts << {traverse: delta, source: :traverse}
  nil
end