Sha256: 317e92cdbc7e6c65a74ff0538152b251ef871b8a383e18a843ea1b707754a933

Contents?: true

Size: 1001 Bytes

Versions: 4

Compression:

Stored size: 1001 Bytes

Contents

require 'spec_helper'

describe HL7::Message::Segment do
  describe 'length' do

    it "should return the length of the elements" do
      segment = HL7::Message::Segment.new "MSA|AR|ZZ9380 ERR"
      expect(segment.length).to eq 3
    end
  end

  describe 'enumerable' do
    it 'enumerates over elements' do
      seg = HL7::Message::Segment::Default.new
      segment_count = 0
      seg.each do |s|
        segment_count = segment_count + 1
      end
      expect(segment_count).to eq(seg.length)
    end
  end

  describe 'is_child_segment?' do
    let(:segment){ HL7::Message::Segment.new "MSA|AR|ZZ9380 ERR" }
    it "return false when is not set" do
      expect(segment.is_child_segment?).to be false
    end
  end

  describe 'convert_to_ts' do
    let(:time_now){ DateTime.now }
    let(:formated_time){ time_now.strftime('%Y%m%d%H%M%S') }

    it "should conver to the hl7 time format" do
      expect(HL7::Message::Segment.convert_to_ts(time_now)).to eq formated_time
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-hl7-1.3.3 spec/segment_spec.rb
ruby-hl7-1.3.2 spec/segment_spec.rb
ruby-hl7-1.3.1 spec/segment_spec.rb
ruby-hl7-1.3.0 spec/segment_spec.rb