Sha256: 31e7a54153e8199a7929a99e77edbac7404eb78046cd2fe138297d25cac466f8

Contents?: true

Size: 783 Bytes

Versions: 5

Compression:

Stored size: 783 Bytes

Contents

require 'spec_helper'
require 'moblues/reader/relationship'

describe Moblues::Reader::Relationship do
  describe '#relationship' do
    context 'when XML is valid' do
      let(:xml) { REXML::Document.new('<relationship name="testName" toMany="YES" destinationEntity="TestEntity" ordered="YES"/>').elements.first }

      it 'returns a Relationship' do
        expect(subject.relationship(xml)).to eq(Moblues::DataModel::Relationship.new(name: 'testName', destination_entity: 'TestEntity', to_many: true, ordered: true))
      end
    end

    context 'when XML is invalid' do
      let(:xml) { REXML::Document.new('<notARelationship/>').elements.first }

      it 'raises an exception' do
        expect { subject.relationship(xml) }.to raise_exception
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
moblues-0.4.0 spec/lib/moblues/reader/relationship_spec.rb
moblues-0.3.0 spec/lib/moblues/reader/relationship_spec.rb
moblues-0.2.0 spec/lib/moblues/reader/relationship_spec.rb
moblues-0.1.0 spec/lib/moblues/reader/relationship_spec.rb
moblues-0.0.1 spec/moblues/reader/relationship_spec.rb