Sha256: 25ec3ea45f9b58d75457ee36db3f2f9f8ecfe8215ba21d84cf8bd51c701861ee

Contents?: true

Size: 753 Bytes

Versions: 5

Compression:

Stored size: 753 Bytes

Contents

require "minitest_helper"

module Hermod
  describe XmlSection do

    IntegerXml = XmlSection.build do |builder|
      builder.integer_node :day_of_the_week, range: {min: 1, max: 7}
    end

    describe "Integer nodes" do
      subject do
        IntegerXml.new
      end

      it "should accept a valid number" do
        subject.day_of_the_week 7
        expect(value_of_node("DayOfTheWeek")).must_equal "7"
      end

      it "should raise an error if the number is above the maximum" do
        expect { subject.day_of_the_week 8 }.must_raise InvalidInputError
      end

      it "should raise an error if the number is below the minimum" do
        expect { subject.day_of_the_week 0 }.must_raise InvalidInputError
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hermod-3.3.0 spec/hermod/xml_section_builder/integer_node_spec.rb
hermod-3.2.0 spec/hermod/xml_section_builder/integer_node_spec.rb
hermod-3.0.0 spec/hermod/xml_section_builder/integer_node_spec.rb
hermod-2.7.0 spec/hermod/xml_section_builder/integer_node_spec.rb
hermod-2.7.0.pre.rc.1 spec/hermod/xml_section_builder/integer_node_spec.rb