Module: Capybara::ActiveAdmin::Matchers::Form
- Defined in:
- lib/capybara/active_admin/matchers/form.rb
Instance Method Summary collapse
- #have_fields_date_range(label, options = {}) ⇒ Object
- #have_form_error(text, options = {}) ⇒ Object
- #have_has_many_fields_for(association_name, options = {}) ⇒ Object
- #have_no_form_errors(options = {}) ⇒ Object
- #have_semantic_error(text, options = {}) ⇒ Object
- #have_semantic_errors(options = {}) ⇒ Object
- #have_submit_input(text, options = {}) ⇒ Object
Instance Method Details
#have_fields_date_range(label, options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/capybara/active_admin/matchers/form.rb', line 44 def have_fields_date_range(label, = {}) exact = [:exact] satisfy do |actual| expect(actual).to have_selector('div.filter_date_range label', text: label) container = actual.find('div.filter_date_range label', text: label).ancestor('div.filter_date_range') base_name = container[:id].gsub(/_input\z/, '') expect(container).to have_field("#{base_name}_gteq_datetime", with: [:from].to_s, exact: exact) expect(container).to have_field("#{base_name}_lteq_datetime", with: [:to].to_s, exact: exact) end end |
#have_form_error(text, options = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/capybara/active_admin/matchers/form.rb', line 7 def have_form_error(text, = {}) field = .delete(:field) opts = Util.(text, ) li_selector = input_container_selector field, **.slice(:exact) have_selector("#{li_selector} #{inline_error_selector}", **opts) end |
#have_has_many_fields_for(association_name, options = {}) ⇒ Object
31 32 33 34 |
# File 'lib/capybara/active_admin/matchers/form.rb', line 31 def have_has_many_fields_for(association_name, = {}) selector = has_many_fields_selector(association_name) have_selector(selector, **) end |
#have_no_form_errors(options = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/capybara/active_admin/matchers/form.rb', line 15 def have_no_form_errors( = {}) field = .delete(:field) li_selector = input_container_selector field, **.slice(:exact) have_none_of_selectors(:css, "#{li_selector} #{inline_error_selector}", **) end |
#have_semantic_error(text, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/capybara/active_admin/matchers/form.rb', line 22 def have_semantic_error(text, = {}) opts = Util.(text, ) have_selector(semantic_error_selector, **opts) end |
#have_semantic_errors(options = {}) ⇒ Object
27 28 29 |
# File 'lib/capybara/active_admin/matchers/form.rb', line 27 def have_semantic_errors( = {}) have_selector(semantic_error_selector, **) end |
#have_submit_input(text, options = {}) ⇒ Object
65 66 67 68 69 |
# File 'lib/capybara/active_admin/matchers/form.rb', line 65 def have_submit_input(text, = {}) selector = "#{form_submit_selector(text)}#{.delete(:selector)}" selector += '[disabled="disabled"].disabled' if .delete(:disabled) have_selector(selector, **) end |