Module: FormsValidationsHelpers

Defined in:
lib/decidim/dev/test/rspec_support/forms_validations.rb

Constant Summary collapse

MESSAGES =
{
  text: "Please fill out this field.",
  select: "Please select an item in the list."
}.freeze

Instance Method Summary collapse

Instance Method Details

#expect_blank_field_validation_message(selector, opts = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/decidim/dev/test/rspec_support/forms_validations.rb', line 9

def expect_blank_field_validation_message(selector, opts = {})
  type = opts.fetch(:type, :text).to_sym
  expected_message = opts.fetch(:message, MESSAGES[type])
  message = page.find(selector).native.attribute("validationMessage")

  expect(message).to eq expected_message
end