Sha256: 928d1dee49b250e1426007ae9af64545a5e7dd1d770a86000d7d6e1d80e6cc0d

Contents?: true

Size: 1.56 KB

Versions: 17

Compression:

Stored size: 1.56 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

module Rews
  describe "SortOrder" do
    it "should write a single sort order" do
      xml = SortOrder.new([["item:DateTimeReceived", "Ascending"]]).to_xml

      doc = Nokogiri::XML(xml)
      doc.children.size.should == 1

      so = doc.children.first
      so.name.should == "SortOrder"
      so.children.size.should == 1

      fo = so.children.first
      fo.name.should == "FieldOrder"
      fo[:Order].should == "Ascending"
      fo.children.size.should == 1
      
      furi = fo.children.first
      furi.name.should == "FieldURI"
      furi[:FieldURI].should == "item:DateTimeReceived"
    end

    it "should write multiple sort orders" do
      xml = SortOrder.new([["item:DateTimeReceived", "Ascending"],
                          ["message:InternetMessageId", "Descending"]]).to_xml

      doc = Nokogiri::XML(xml)
      doc.children.size.should == 1
      
      so = doc.children.first
      so.name.should == "SortOrder"
      so.children.size.should == 2

      fo = so.children.first
      fo.name.should == "FieldOrder"
      fo[:Order].should == "Ascending"
      fo.children.size.should == 1

      furi = fo.children.first
      furi.name.should == "FieldURI"
      furi[:FieldURI].should == "item:DateTimeReceived"

      fo2 = so.children.last
      fo2.name.should == "FieldOrder"
      fo2[:Order].should == "Descending"
      fo2.children.size.should == 1

      furi2 = fo2.children.first
      furi2.name.should == "FieldURI"
      furi2[:FieldURI].should == "message:InternetMessageId"

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rews-0.5.5 spec/rews/sort_order_spec.rb
rews-0.5.4 spec/rews/sort_order_spec.rb
rews-0.5.3 spec/rews/sort_order_spec.rb
rews-0.5.1 spec/rews/sort_order_spec.rb
rews-0.5.0 spec/rews/sort_order_spec.rb
rews-0.2.12 spec/rews/sort_order_spec.rb
rews-0.2.11 spec/rews/sort_order_spec.rb
rews-0.2.10 spec/rews/sort_order_spec.rb
rews-0.2.9 spec/rews/sort_order_spec.rb
rews-0.2.7 spec/rews/sort_order_spec.rb
rews-0.2.6 spec/rews/sort_order_spec.rb
rews-0.2.5 spec/rews/sort_order_spec.rb
rews-0.2.4 spec/rews/sort_order_spec.rb
rews-0.2.3 spec/rews/sort_order_spec.rb
rews-0.2.2 spec/rews/sort_order_spec.rb
rews-0.2.1 spec/rews/sort_order_spec.rb
rews-0.2.0 spec/rews/sort_order_spec.rb