Sha256: 7847f0cec406dcb2ddc76b15efb2f1a8f84e2871bf4e89494da756cd466c71e7
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'rails_helper' describe DomFor::Record do context '#dom_for_record' do it 'returns empty div' do expect(helper.dom_for_record(User)).to eq '<div></div>' end it 'returns div for the new user' do expect(helper.dom_for_record(User.new)).to eq '<div id="new_user" class="user" />' end it 'returns div without nested tags' do user = User.create(name: 'test') expect(helper.dom_for_record(user)).to eq '<div id="user_1" class="user" data-object-id="1" />' end it 'returns div with nested tags' do user = User.create(name: 'test') expect( helper.dom_for_record(user) { helper.tag(:span) } ).to eq '<div id="user_1" class="user" data-object-id="1"><span /></div>' end it 'returns div with the additional data-attributes' do user = User.create(name: 'test') expect( helper.dom_for_record(user, admin: true) { helper.tag(:span) } ).to eq '<div id="user_1" class="user" data-admin="true" data-object-id="1"><span /></div>' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dom_for-1.0.3 | spec/helpers/dom_for_record_spec.rb |