Sha256: 55bfaefe1de749b1b795c55371d2aed3c653f8f3f8c36beccf5f01a0494f583e

Contents?: true

Size: 769 Bytes

Versions: 2

Compression:

Stored size: 769 Bytes

Contents

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

describe Megingiard::BoldNode do
  subject { Megingiard::BoldNode.new(child) }
  let(:child) { double(String, to_s: child_string) }
  let(:child_string) { double }
  let(:reset_sequence_string) { double }
  let(:bold_sequence_string) { double }
  let(:expected_sequence) { "#{Megingiard::BOLD_SEQUENCE}#{child}#{Megingiard::RESET_SEQUENCE}" }

  before do
    allow(Megingiard::RESET_SEQUENCE).to receive(:to_s)
      .and_return(reset_sequence_string)
    allow(Megingiard::BOLD_SEQUENCE).to receive(:to_s)
      .and_return(bold_sequence_string)
  end

  describe 'to_s' do
    it 'should wrap the child in a bold and a reset sequence' do
      expect(subject.to_s).to eq expected_sequence
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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