Sha256: 0ff3bdb9b3baa5fd03712a4c688cf4e9bce48461a9d83a4f7ddfdf1683c425d0
Contents?: true
Size: 781 Bytes
Versions: 5
Compression:
Stored size: 781 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
5 entries across 5 versions & 3 rubygems