Sha256: c8415bce234d5fc0de23c23e4645b99689293cfd01bb98155f4035544e25d5f7

Contents?: true

Size: 655 Bytes

Versions: 3

Compression:

Stored size: 655 Bytes

Contents

require 'test_helper'

class BindingsTest < MiniTest::Spec
  describe "ObjectRef with []" do
    before do
      @ref = Representable::XML::ObjectBinding.new(Representable::Definition.new(:songs, :as => [Hash]))
    end
      
    it "responds to #default" do
      assert_equal [], @ref.send(:default)
    end
  end
  
  
  describe "TextRef#read" do
    def parse_xml(xml); Nokogiri::XML(xml).root; end
    
    before do
      @ref = Representable::XML::TextBinding.new(Representable::Definition.new(:song))
    end
    
    it "returns found value" do
      assert_equal "Unkoil", @ref.read(parse_xml("<a><song>Unkoil</song></a>"))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
representable-0.10.2 test/bindings_test.rb
representable-0.10.1 test/bindings_test.rb
representable-0.10.0 test/bindings_test.rb