Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeremy Burks
committed
Dec 18, 2009
1 parent
fcc87c8
commit 7e2f5ad
Showing
4 changed files
with
57 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module EWS | ||
|
||
class Builder | ||
def base_shape!(shape, opts = {}) | ||
opts[:base_shape] ||= :Default | ||
shape.add 't:BaseShape', opts[:base_shape] | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require File.join(File.dirname(__FILE__), '..', 'spec_helper') | ||
|
||
describe EWS::Builder do | ||
before(:each) do | ||
@builder = EWS::Builder.new | ||
@doc = Handsoap::XmlMason::Document.new | ||
@doc.xml_header = nil | ||
EWS::Service.register_aliases! @doc | ||
end | ||
|
||
context "#build_base_shape!" do | ||
it "should build a BaseShape node with 'Default'" do | ||
@builder.base_shape!(@doc) | ||
@doc.to_s.should == expected_base_shape('Default') | ||
end | ||
|
||
it "should build a BaseShape node with 'AllProperties'" do | ||
@builder.base_shape!(@doc, :base_shape => 'AllProperties') | ||
@doc.to_s.should == expected_base_shape('AllProperties') | ||
end | ||
|
||
it "should build a BaseShape node with 'IdOnly'" do | ||
@builder.base_shape!(@doc, :base_shape => 'IdOnly') | ||
@doc.to_s.should == expected_base_shape('IdOnly') | ||
end | ||
end | ||
|
||
def expected_base_shape(shape) | ||
%Q|<t:BaseShape xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">#{shape}</t:BaseShape>| | ||
end | ||
end |