Sha256: bbfb0ebded0ceed98c9187c8e420c7a0ad8d32508e2fb0e9d9f83395cb7798c0

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe FlashHash do
  it 'lets you access hash keys with methods' do
    h = {:foo => :bar}
    class << h; include FlashHash; end

    h.foo.should == :bar
    h.nonexistent.should be_nil
  end
end

describe 'expand' do
  it 'turns Ruby into XML' do
    xmlns = 'urn:partner.soap.sforce.com'

#     'sObject {"xsi:type" => "Opportunity"}'
    
    expanded = ''
    builder = Builder::XmlMarkup.new(:target => expanded)

    data =
      ['partner:create',
        ['partner:sObjects',
          ['spartner:type', 'Contact',
           'AccountId', '01234567890ABCD',
           'FirstName', 'Jane',
           'LastName', 'Doe'],
         'partner:sObjects',
           ['spartner:type', 'Account',
            'Name', 'Acme Rockets, Inc.']]]
       
    expand(builder, data)

    expanded.should == CreateXml
  end
end

CreateXml = <<HERE.gsub(/\n\s*/, '')
<partner:create>
  <partner:sObjects>
    <spartner:type>Contact</spartner:type>
    <AccountId>01234567890ABCD</AccountId>
    <FirstName>Jane</FirstName>
    <LastName>Doe</LastName>
  </partner:sObjects>
  <partner:sObjects>
    <spartner:type>Account</spartner:type>
    <Name>Acme Rockets, Inc.</Name>
  </partner:sObjects>
</partner:create>
HERE

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rforce-0.2.1 spec/rforce_spec.rb