Sha256: 7421ad99a13f84cf69e13eeae76eb610d036902d8e924ff6b47e970a28f3f03b
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
require 'spec_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 class="user" id="new_user" />' end it 'returns div without nested tags' do user = User.create(name: 'test') expect(helper.dom_for_record(user)).to eq '<div class="user" data-object-id="1" id="user_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 class="user" data-object-id="1" id="user_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 class="user" data-admin="true" data-object-id="1" id="user_1"><span /></div>' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dom_for-1.0.2 | spec/helpers/dom_for_record_spec.rb |
dom_for-1.0.1 | spec/helpers/dom_for_record_spec.rb |
dom_for-1.0.0 | spec/helpers/dom_for_record_spec.rb |