Sha256: 0ac5af820b5a0b8951f3878a2caffb07496e63e72c10cc9d892cb968821dc26b

Contents?: true

Size: 681 Bytes

Versions: 5

Compression:

Stored size: 681 Bytes

Contents

require 'spec_helper'
require 'moblues/reader/attribute'

describe Moblues::Reader::Attribute do
  describe '#attribute' do
    context 'when XML is valid' do
      let(:xml) { REXML::Document.new('<attribute name="testName" attributeType="String"/>').elements.first }

      it 'returns an Attribute object' do
        expect(subject.attribute(xml)).to eq(Moblues::DataModel::Attribute.new(name: 'testName', type: :string))
      end
    end

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

      it 'raises an assertion' do
        expect { subject.attribute(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/attribute_spec.rb
moblues-0.3.0 spec/lib/moblues/reader/attribute_spec.rb
moblues-0.2.0 spec/lib/moblues/reader/attribute_spec.rb
moblues-0.1.0 spec/lib/moblues/reader/attribute_spec.rb
moblues-0.0.1 spec/moblues/reader/attribute_spec.rb