Sha256: b779585b7324994fe8a84e961740c127880ea7a72161e79c3bc699f85ecfb2b7

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe OData4::EntityContainer do
  let(:subject) { OData4::EntityContainer.new(service) }
  let(:service) do
    OData4::Service.open('http://services.odata.org/V4/OData/OData.svc', metadata_file: metadata_file)
  end
  let(:metadata_file) { 'spec/fixtures/files/metadata.xml' }

  describe '#entity_sets' do
    it { expect(subject).to respond_to(:entity_sets) }
    it { expect(subject.entity_sets.size).to eq(7) }
    it { expect(subject.entity_sets.keys).to eq(%w[
      Products
      ProductDetails
      Categories
      Suppliers
      Persons
      PersonDetails
      Advertisements
    ]) }
    it { expect(subject.entity_sets.values).to eq(%w[
      ODataDemo.Product
      ODataDemo.ProductDetail
      ODataDemo.Category
      ODataDemo.Supplier
      ODataDemo.Person
      ODataDemo.PersonDetail
      ODataDemo.Advertisement
    ]) }
  end

  describe '#[]' do
    let(:entity_sets) { subject.entity_sets.keys.map { |name| subject[name] } }
    it { expect(entity_sets).to all(be_a(OData4::EntitySet)) }
    it { expect {subject['Nonexistant']}.to raise_error(ArgumentError) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
odata4-0.8.2 spec/odata4/entity_container_spec.rb
odata4-0.8.1 spec/odata4/entity_container_spec.rb
odata4-0.8.0 spec/odata4/entity_container_spec.rb