Sha256: 49edfd5b4984c357ba467713111fb159900e78fc09d16fd3bd9cc27d1767c73b

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

require 'spec_helper'
require 'compo'

describe Compo::Leaf do
  describe '#initialize' do
    it 'initialises with no parent' do
      expect(subject.parent).to be_nil
    end

    it 'initialises with an ID function returning nil' do
      expect(subject.id).to be_nil
    end
  end

  describe '#url' do
    context 'when the Leaf has no parent' do
      it 'returns the empty string' do
        expect(subject.url).to eq('')
      end
    end
    context 'when the Leaf is the child of a root' do
      let(:parent) { Compo::HashBranch.new }
      before(:each) { subject.move_to(parent, :id) }

      it 'returns /ID, where ID is the ID of the Leaf' do
        expect(subject.url).to eq('/id')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
compo-0.1.5 spec/leaf_spec.rb
compo-0.1.4 spec/leaf_spec.rb