Sha256: 0941db453c9a1bf634b6a06e78fccf602f34ed04069112d9b06e93445892d336

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require_relative '../spec_helper' # Use the RSpec framework

# Load the class under test
require_relative '../../lib/loxxy/datatype/lx_string'

module Loxxy
  module Datatype
    describe LXString do
      let(:sample_text) { 'some_text' }
      subject { LXString.new(sample_text) }

      context 'Initialization:' do
        it 'should accept a String value at initialization' do
          expect { LXString.new(sample_text) }.not_to raise_error
        end

        it 'should know its value' do
          expect(subject.value).to eq(sample_text)
        end
      end

      context 'Provided services:' do
        it 'should give its display representation' do
          expect(subject.to_str).to eq(sample_text)
        end

        it 'compares with another string' do
          expect(subject).to eq(sample_text)
          expect(subject).to eq(LXString.new(sample_text.dup))

          expect(subject).not_to eq('')
          expect(subject).not_to eq('other-text')
        end
      end
    end # describe
  end # module
end # module

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loxxy-0.0.13 spec/datatype/lx_string_spec.rb
loxxy-0.0.12 spec/datatype/lx_string_spec.rb