Sha256: 01c49fb04494be6dc12df8f059572b5c6fea4c4c1564a6f8b2578f523a4102d7
Contents?: true
Size: 786 Bytes
Versions: 2
Compression:
Stored size: 786 Bytes
Contents
require 'spec_helper' describe "Attribute Method Conversion" do let(:xml_document) do %{<document> <link data-src='http://cooking.com/roastbeef' type='recipe'>Roast Beef</link> </document>} end module AttributeMethodConversion class Document include HappyMapper has_many :link, String, :attributes => { :'data-src' => String, :type => String, :href => String } end end let(:document) do AttributeMethodConversion::Document.parse(xml_document, :single => true) end it "link" do expect(document.link).to eq ["Roast Beef"] end it "link.data_src" do expect(document.link.first.data_src).to eq "http://cooking.com/roastbeef" end it "link.type" do expect(document.link.first.type).to eq "recipe" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nokogiri-happymapper-deiga-0.5.10 | spec/attributes_spec.rb |
nokogiri-happymapper-deiga-0.5.9 | spec/attributes_spec.rb |