Module YamlExtension::Assertions
In: lib/yaml_extension.rb

Methods

Attributes

ref  [RW]  @val is here to receive the result of YAML::load, @str receives the result of X.to_yaml, @ref is the reference string
str  [RW]  @val is here to receive the result of YAML::load, @str receives the result of X.to_yaml, @ref is the reference string
val  [RW]  @val is here to receive the result of YAML::load, @str receives the result of X.to_yaml, @ref is the reference string

Public Instance methods

[Source]

# File lib/yaml_extension.rb, line 84
    def assert_yaml_dump ( anObject, ref, options={} )
      assert_nothing_raised { @str = anObject.to_yaml(options) }
      @str.gsub!(/---\s*/, '')
      @str.chomp!
      if ref.is_a? Regexp
        assert_match(ref, @str)
      else
        assert_equal(ref, @str)
      end
    end

[Source]

# File lib/yaml_extension.rb, line 77
    def assert_yaml_load ( aString, aClass, anObject=nil )
      assert_nothing_raised { @val = YAML::load("---\n" + aString) }
      assert_kind_of(aClass, @val)
      assert_equal(anObject, @val) unless anObject.nil?
      @ref = aString
    end

[Validate]