Sha256: a2eb563c5384804cb52efd357f0d0c7b4999cb1778abc9f7d3452109a83dc361

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'megingiard/node'

describe Megingiard::Node do
  subject { Megingiard::Node.new(first_child, second_child) }

  let(:first_child) { double(String, to_s: first_child_string) }
  let(:second_child) { double(String, to_s: second_child_string) }
  let(:first_child_string) { double }
  let(:second_child_string) { double }
  let(:concatenation) { double }

  describe 'to_s' do

    it 'should concatenate the children as strings' do
      expect(first_child_string).to receive(:+)
        .with(second_child_string)

      subject.to_s
    end

    it 'should return the result' do
      allow(first_child_string).to receive(:+)
        .and_return(concatenation)

      expect(subject.to_s).to eq concatenation
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
megingiard-0.1.0 spec/unit/node/to_s_spec.rb
megingiard-0.0.1 spec/unit/node/to_s_spec.rb