Sha256: 6b458d49b04317f54cfeda5085241d73ac3ff26a14e849cf9170270db989eaec
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require 'spec_helper' require 'compo' describe Compo::Parentless do let(:child) { double(:child) } describe '#add' do before(:each) { allow(child).to receive(:update_parent) } it 'returns the given child exactly' do expect(subject.add(:id, child)).to be(child) end it 'calls #update_parent on the child with a Parentless' do expect(child).to receive(:update_parent).once do |parent, _| expect(parent).to be_a(Compo::Parentless) end subject.add(:id, child) end it 'calls #update_parent on the child with a nil-returning ID proc' do expect(child).to receive(:update_parent).once do |_, idp| expect(idp.call).to be_nil end subject.add(:id, child) end end describe '#remove' do it 'returns the given child exactly' do expect(subject.remove(child)).to be(child) end end describe '#children' do specify { expect(subject.children).to eq({}) } end describe '#url' do specify { expect(subject.url).to eq('') } end describe '#child_url' do specify { expect(subject.child_url(:id)).to eq('') } end describe '#parent' do it 'returns the exact same Parentless object' do expect(subject.parent).to be(subject) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
compo-0.3.1 | spec/parentless_spec.rb |
compo-0.3.0 | spec/parentless_spec.rb |
compo-0.2.0 | spec/parentless_spec.rb |