Module: NiceAssertSelect
- Defined in:
- lib/nice_assert_select.rb
Instance Method Summary collapse
- #build_html_selector(prefix, attributes = {}) ⇒ Object
- #form(attributes) ⇒ Object
- #form_method_field(method) ⇒ Object
- #hidden_field(attributes) ⇒ Object
- #password_field(attributes) ⇒ Object
- #submit_button ⇒ Object
- #text_field(attributes) ⇒ Object
Instance Method Details
#build_html_selector(prefix, attributes = {}) ⇒ Object
2 3 4 5 |
# File 'lib/nice_assert_select.rb', line 2 def build_html_selector(prefix, attributes = {}) attribute_selector = attributes.keys.map {|key| "[#{key}=?]"}.join('') HTML.selector("#{prefix}#{attribute_selector}", *attributes.values) end |
#form(attributes) ⇒ Object
7 8 9 |
# File 'lib/nice_assert_select.rb', line 7 def form(attributes) build_html_selector('form', attributes) end |
#form_method_field(method) ⇒ Object
28 29 30 |
# File 'lib/nice_assert_select.rb', line 28 def form_method_field(method) hidden_field(:name => '_method', :value => method) end |
#hidden_field(attributes) ⇒ Object
15 16 17 |
# File 'lib/nice_assert_select.rb', line 15 def hidden_field(attributes) build_html_selector('input', attributes.merge(:type => 'hidden')) end |
#password_field(attributes) ⇒ Object
20 21 22 |
# File 'lib/nice_assert_select.rb', line 20 def password_field(attributes) build_html_selector('input', attributes.merge(:type => 'password')) end |
#submit_button ⇒ Object
24 25 26 |
# File 'lib/nice_assert_select.rb', line 24 def build_html_selector('input', :type => 'submit') end |
#text_field(attributes) ⇒ Object
11 12 13 |
# File 'lib/nice_assert_select.rb', line 11 def text_field(attributes) build_html_selector('input', attributes.merge(:type => 'text')) end |