Module: YaksHTML::CapybaraDSL
- Defined in:
- lib/yaks-html/rspec.rb
Class Method Summary collapse
Instance Method Summary collapse
- #click_first_rel(rel) ⇒ Object
- #click_rel(rel) ⇒ Object
- #env ⇒ Object
- #refresh ⇒ Object
- #submit! ⇒ Object
- #submit_form(name, &block) ⇒ Object
- #within_form(name, &block) ⇒ Object
Class Method Details
.included(base) ⇒ Object
17 18 19 20 21 |
# File 'lib/yaks-html/rspec.rb', line 17 def self.included(base) base.class_eval do let(:rel_prefix) { '' } end end |
Instance Method Details
#click_first_rel(rel) ⇒ Object
28 29 30 31 |
# File 'lib/yaks-html/rspec.rb', line 28 def click_first_rel(rel) rel = [rel_prefix, rel].join unless rel.is_a? Symbol all("a[rel=\"#{rel}\"]").first.click end |
#click_rel(rel) ⇒ Object
23 24 25 26 |
# File 'lib/yaks-html/rspec.rb', line 23 def click_rel(rel) rel = [rel_prefix, rel].join unless rel.is_a? Symbol find("a[rel=\"#{rel}\"]").click end |
#refresh ⇒ Object
48 49 50 |
# File 'lib/yaks-html/rspec.rb', line 48 def refresh visit current_path end |
#submit! ⇒ Object
33 34 35 |
# File 'lib/yaks-html/rspec.rb', line 33 def submit! find('input[type="submit"]').click end |
#submit_form(name, &block) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/yaks-html/rspec.rb', line 41 def submit_form(name, &block) within(all("form[@name=\"#{name}\"]").first) do yield block submit! end end |
#within_form(name, &block) ⇒ Object
37 38 39 |
# File 'lib/yaks-html/rspec.rb', line 37 def within_form(name, &block) within(all("form[@name=\"#{name}\"]").first, &block) end |