Module: Gizmo::Helpers
- Defined in:
- lib/gizmo/helpers.rb
Instance Method Summary collapse
- #on_page {|Page.new(self, resp.body, current_url)| ... } ⇒ Object
- #on_page_with(*module_names) ⇒ Object
Instance Method Details
#on_page {|Page.new(self, resp.body, current_url)| ... } ⇒ Object
5 6 7 8 9 |
# File 'lib/gizmo/helpers.rb', line 5 def on_page &block resp = response raise NilResponseError, "Doh! response object is nil. This generally means your scenario has not yet visited a page!" if resp.nil? yield Page.new(self, resp.body, current_url) end |
#on_page_with(*module_names) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/gizmo/helpers.rb', line 11 def on_page_with *module_names raise ArgumentError, 'You must supply at least one mixin' if module_names.empty? on_page do |page| module_names.each do |module_name| raise ArgumentError, 'module_name must be a symbol' unless module_name.is_a?(Symbol) add_mixin_to_page page, module_name end yield page if block_given? end end |