Skip to content

Commit

Permalink
fixing spec when using ruby 1.9.3, also some upgrades for testing w/ ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jstraitiff-wk committed Apr 9, 2013
1 parent 4ca0751 commit 68fed27
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ doc
.yardoc
test.rb
spec/reports
/nbproject
/nbproject/private/
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
source :rubygems
source 'http://rubygems.org'

gem 'rake'
gem 'savon'
gem 'builder'
gem 'activemodel'
gem 'activesupport'
gem 'activemodel', '~> 3.0.20'
gem 'activesupport', '~> 3.0.20'

gem 'savon_spec', :groups => [:test, :development]
gem 'rspec', "> 2.0", :groups => [:test, :development]
gem 'rspec', "2.12", :groups => [:test, :development]
gem 'flexmock', :group => [:test, :development]
gem 'timecop', :groups => [:test, :development]
gem 'ci_reporter', :group => :test
Expand Down
38 changes: 20 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
GEM
remote: http://rubygems.org/
specs:
activemodel (3.0.6)
activesupport (= 3.0.6)
activemodel (3.0.20)
activesupport (= 3.0.20)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activesupport (3.0.6)
activesupport (3.0.20)
builder (2.1.2)
ci_reporter (1.6.4)
ci_reporter (1.8.4)
builder (>= 2.1.2)
crack (0.1.8)
diff-lcs (1.1.2)
flexmock (0.9.0)
diff-lcs (1.1.3)
flexmock (1.3.1)
gyoku (0.4.2)
builder (>= 2.1.2)
httpi (0.9.2)
Expand All @@ -21,14 +21,15 @@ GEM
mocha (0.9.12)
ntlm-http (0.1.1)
rack (1.2.2)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
rake (10.0.3)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.2)
ruby-fsevent (0.2.1)
savon (0.8.6)
builder (>= 2.1.2)
Expand All @@ -39,19 +40,20 @@ GEM
mocha (>= 0.9.8)
rspec (>= 2.0.0)
savon (~> 0.8.0)
timecop (0.3.5)
timecop (0.6.1)
watchr (0.7)

PLATFORMS
ruby

DEPENDENCIES
activemodel
activesupport
activemodel (~> 3.0.20)
activesupport (~> 3.0.20)
builder
ci_reporter
flexmock
rspec (> 2.0)
rake
rspec (= 2.12)
ruby-fsevent
savon
savon_spec
Expand Down
64 changes: 31 additions & 33 deletions spec/lib/eloqua/builder/xml_spec.rb
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
require 'spec_helper'

describe Eloqua::Builder::Xml do

def xml!(&block)
subject.create(&block)
end

subject { Eloqua::Builder::Xml }

# We might reveal methods on builder so create blank subclass
subject {
Class.new(Eloqua::Builder::Xml) do
reveal(:class)
reveal(:is_a?)
end
}

let(:xml) do
subject.new(:namespace => 'wsdl')
end
end

it "should include Eloqua::Builder::Templates" do
subject.should include(Eloqua::Builder::Templates)
end

it 'should allow a block during new providing self' do
subject.new do |xml|
xml.is_a?(subject)
end
end

context "when default namespace options is set" do

let(:xml) do
subject.new(:namespace => 'wsdl')
end
Expand All @@ -45,70 +43,70 @@ def xml!(&block)
output = xml.arr(:int) {}
output.strip.should == '<arr:int></arr:int>'
end

end

# Entity/Asset Helpers

context '#dynamic_object!' do

let(:expected) { '<DynamicAsset>content</DynamicAsset>' }

it 'should return expected xml' do
xml! {|xml| xml.dynamic_object!(:asset, 'content') }.should == expected
end

end

context '#object_type!' do
let(:expected) { '<AssetType>content</AssetType>' }

it 'should return expected xml' do
xml! {|xml| xml.object_type!(:asset, 'content') }.should == expected
end

end

context '#object_type_lower!' do
let(:expected) { '<assetType>content</assetType>' }

it 'should return expected xml' do
xml! {|xml| xml.object_type_lower!(:asset, 'content') }.should == expected
end
end

end

context '#object_collection!' do
let(:expected) { "<entities><one>1</one></entities>" }
it 'should return expected xml' do
xml! {|xml| xml.object_collection!(:entity) { xml.one('1') } }.should == expected
end
end

context "#self.create" do

let(:klass) do
Class.new(subject) do
define_builder_template(:zomg) do |xml|
xml.wow('zomg')
end
end
end

let(:xml_body) do
'<big>1</big><wow>zomg</wow>'
end

it 'should produce expected output' do
out = klass.create do |xml|
xml.big('1')
xml.template!(:zomg)
end
out.should == xml_body
end

end

context 'xml templates' do

share_examples_for "expected template output" do |template|
Expand All @@ -132,12 +130,12 @@ def xml!(&block)
let(:entity) do
Eloqua::Api.remote_type('Contact')
end

context ':object' do
let(:args) do
['random', Eloqua::Api.remote_type('Contact'), 1]
end

let(:expected) do
xml! do |xml|
xml.random do
Expand All @@ -148,9 +146,9 @@ def xml!(&block)
end
end
end

it_behaves_like 'expected template output', :object

end

context ':dynamic' do
Expand Down Expand Up @@ -256,7 +254,7 @@ def xml!(&block)

end

end
end


end

0 comments on commit 68fed27

Please sign in to comment.