Sha256: 49c59c0f17d198e99bb4c3940011ebfa476a127767d2d928435b24ab7645c4a6
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
# frozen_string_literal: true 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nokogiri-happymapper-0.7.0 | spec/attributes_spec.rb |