Sha256: dd2340d422e3d2e03d2d4b3fcf2faf8a6e912e624a18d4caebaaa68078a33c00
Contents?: true
Size: 1.66 KB
Versions: 18
Compression:
Stored size: 1.66 KB
Contents
require 'spec_helper' describe Frodo::NavigationProperty do let(:options) { { name: 'Categories', type: 'Collection(ODataDemo.Category)', partner: 'Products', } } let(:subject) do Frodo::NavigationProperty.new(options) end it { expect(subject).to respond_to(:name) } it { expect(subject.name).to eq('Categories') } it { expect(subject).to respond_to(:type) } it { expect(subject.type).to eq('Collection(ODataDemo.Category)') } it { expect(subject).to respond_to(:nav_type) } it { expect(subject.nav_type).to eq(:collection) } it { expect(subject).to respond_to(:nullable) } it { expect(subject).to respond_to(:partner) } it { expect(subject.partner).to eq('Products') } describe '.new' do it 'requires name' do expect { Frodo::NavigationProperty.new(type: 'Collection(ODataDemo.Category)') }.to raise_error(ArgumentError) end it 'requires type' do expect { Frodo::NavigationProperty.new(name: 'Categories') }.to raise_error(ArgumentError) end end describe '#build' do let(:metadata_file) { File.read 'spec/fixtures/files/metadata.xml' } let(:metadata_xml) { Nokogiri::XML(metadata_file).remove_namespaces! } let(:navigation_properties) { metadata_xml.xpath('//NavigationProperty') } let(:subject) { Frodo::NavigationProperty.build(navigation_properties.first) } it { expect(subject.name).to eq('Categories') } it { expect(subject.type).to eq('Collection(ODataDemo.Category)') } it { expect(subject.partner).to eq('Products') } it { expect(subject.nullable).to eq(true) } it { expect(subject.nav_type).to eq(:collection) } end end
Version data entries
18 entries across 18 versions & 1 rubygems