Sha256: 52b6b7e2e95045e470be6d29c972a87c998eea612b6ef8d52975db7f5dd18ba9

Contents?: true

Size: 1.17 KB

Versions: 34

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

shared_examples "numerical validations" do |numerical_type|
  let(:questionnaire) do
    inject_questionnaire("test", "question :v1, type: :#{numerical_type} do
                                    title 'Example question'
                                    validates_in_range 10..20
                                  end; end_panel")
  end

  let(:too_low_value)  { 4 }
  let(:too_high_value) { 42 }
  let(:not_a_number)   { "OHAI" }

  scenario "by entering a number that is below minimum" do
    visit_new_answer_for(questionnaire)
    filling_in(within: "#item_v1", answering: "answer_v1", with: too_low_value,
               should_show: '.error.minimum')
  end

  scenario "by entering a number that is above maximum" do
    visit_new_answer_for(questionnaire)
    filling_in(within: "#item_v1", answering: "answer_v1", with: too_high_value,
               should_show: '.error.maximum')
  end

  scenario "by entering a number that is not a valid #{numerical_type}" do
    visit_new_answer_for(questionnaire)
    filling_in(within: "#item_v1", answering: "answer_v1", with: not_a_number,
               should_show: ".error.valid_#{numerical_type}")
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
quby-5.6.6 spec/support/javascript_numericality_validations.rb
quby-5.6.5 spec/support/javascript_numericality_validations.rb
quby-5.6.3 spec/support/javascript_numericality_validations.rb
quby-5.6.2 spec/support/javascript_numericality_validations.rb
quby-5.6.1 spec/support/javascript_numericality_validations.rb
quby-5.6.0 spec/support/javascript_numericality_validations.rb
quby-5.5.0 spec/support/javascript_numericality_validations.rb
quby-5.4.0 spec/support/javascript_numericality_validations.rb
quby-5.3.1 spec/support/javascript_numericality_validations.rb
quby-5.3.0 spec/support/javascript_numericality_validations.rb
quby-5.2.0 spec/support/javascript_numericality_validations.rb
quby-5.1.3 spec/support/javascript_numericality_validations.rb
quby-5.1.2 spec/support/javascript_numericality_validations.rb
quby-5.1.1 spec/support/javascript_numericality_validations.rb
quby-5.1.0 spec/support/javascript_numericality_validations.rb
quby-5.0.5 spec/support/javascript_numericality_validations.rb
quby-5.0.4 spec/support/javascript_numericality_validations.rb
quby-5.0.3 spec/support/javascript_numericality_validations.rb
quby-5.0.2 spec/support/javascript_numericality_validations.rb
quby-5.0.1 spec/support/javascript_numericality_validations.rb