Sha256: 20de8b4f4c54ab979b101658f6f022af60e1111d442951fed4ad5df22b2a35df

Contents?: true

Size: 661 Bytes

Versions: 3

Compression:

Stored size: 661 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::Node.from(xml); 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.9.3 test/bindings_test.rb
representable-0.9.2 test/bindings_test.rb
representable-0.9.1 test/bindings_test.rb