Skip to content

Instantly share code, notes, and snippets.

@iamvery
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamvery/10763416 to your computer and use it in GitHub Desktop.
Save iamvery/10763416 to your computer and use it in GitHub Desktop.
Illustrate bug between Savon 2 and YARD

READ ME

Illustrate a bug between Savon 2.0's "hacky" block format and YARD's globals.

bundle install
bundle exec rspec exercise_bug_spec.rb

Background

This happens because the log call in the Savon block format is not actually a method call. It's an instance_eval hack (according to the author). This fact combined with YARD's polution of the global namespace causes breakage when they're both loaded and used as such.

Recommendation

The "fix" falls to YARD IMO. They need to stop poluting the global namespace. Additionally, I say "convenienced be darned" and Savon should discourage and deprecate the use of the block syntax until it becomes less "hacky".

describe 'bug between savon 2.0 and yard' do
describe 'when yard is NOT loaded' do
specify 'savon block format does invoke yard global log method' do
Process.fork do
require 'savon'
Savon.client do
wsdl 'url'
log false
end
end
end
end
describe 'when yard is loaded' do
specify 'savon block format invokes yard global log method which errors' do
Process.fork do
require 'savon'
require 'yard'
expect{
Savon.client do
wsdl 'url'
log false
end
}.to raise_error(ArgumentError)
end
end
end
end
Process.waitall
source 'https://rubygems.org'
gem 'savon', '~> 2.0'
gem 'yard', '~> 0.8.7'
gem 'rspec'
GEM
remote: https://rubygems.org/
specs:
akami (1.2.1)
gyoku (>= 0.4.0)
nokogiri
builder (3.2.2)
diff-lcs (1.2.5)
gyoku (1.1.1)
builder (>= 2.1.2)
httpi (2.1.0)
rack
rubyntlm (~> 0.3.2)
mime-types (1.25.1)
mini_portile (0.5.3)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
nori (2.3.0)
rack (1.5.2)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
rubyntlm (0.3.4)
savon (2.4.0)
akami (~> 1.2.0)
builder (>= 2.1.2)
gyoku (~> 1.1.0)
httpi (~> 2.1.0)
nokogiri (>= 1.4.0)
nori (~> 2.3.0)
wasabi (~> 3.2.2)
wasabi (3.2.3)
httpi (~> 2.0)
mime-types (< 2.0.0)
nokogiri (>= 1.4.0)
yard (0.8.7.4)
PLATFORMS
ruby
DEPENDENCIES
rspec
savon (~> 2.0)
yard (~> 0.8.7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment