Sha256: f927d4487bcf3a1c2ec51e08dfec8e99c75c5ebfe33e1509a1a5ce71499137d9
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
require 'spec_helper' module OData describe Association do before(:all) do stub_request(:get, /http:\/\/test\.com\/test\.svc\/\$metadata(?:\?.+)?/). with(:headers => DEFAULT_HEADERS). to_return(:status => 200, :body => File.new(File.expand_path("../fixtures/sample_service/edmx_categories_products.xml", __FILE__)), :headers => {}) @svc = OData::Service.new "http://test.com/test.svc/$metadata" @product_category = RSpecSupport::ElementHelpers.string_to_element('<NavigationProperty Name="Category" Relationship="RubyODataService.Category_Products" ToRole="Category_Products_Source" FromRole="Category_Products_Target"/>') end describe "#initialize singlular navigation property" do before { @association = Association.new @product_category, @svc.edmx } subject { @association } it "sets the association name" do subject.name.should eq 'Category_Products' end it "sets the association namespace" do subject.namespace.should eq 'RubyODataService' end it "sets the relationship name" do subject.relationship.should eq 'RubyODataService.Category_Products' end context "from_role method" do subject { @association.from_role } it { should have_key 'Category_Products_Target'} it "sets the edmx type" do subject['Category_Products_Target'][:edmx_type].should eq 'RubyODataService.Product' end it "sets the multiplicity" do subject['Category_Products_Target'][:multiplicity].should eq '*' end end context "to_role method" do subject { @association.to_role } it { should have_key 'Category_Products_Source'} it "sets the edmx type" do subject['Category_Products_Source'][:edmx_type].should eq 'RubyODataService.Category' end it "sets the multiplicity" do subject['Category_Products_Source'][:multiplicity].should eq '1' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby_odata-0.2.0.beta1 | spec/association_spec.rb |