examples/accepts_and_methods.rb in mudbug-0.4.7.1 vs examples/accepts_and_methods.rb in mudbug-0.4.7.2
- old
+ new
@@ -1,9 +1,8 @@
-# normally, just require 'mudbug', but this will use your local version
+require 'mudbug'
# useful for development purposes
-#
-require_relative '../lib/mudbug'
+#require_relative '../lib/mudbug'
sites = %w{google.com yahoo.com microsoft.com amazon.com ibm.com reddit.com}
accepts = [:json, :html, :text, :xml]
http_methods = [:get, :post, :put, :delete]
@@ -12,18 +11,18 @@
unless ARGV.shift == 'skip'
puts
puts "Checking Accepts across sites"
puts "============================="
sites.each { |site|
- b = Mudbug.new(site)
+ mb = Mudbug.new(site)
url = "http://#{site}#{path}"
accepts.each { |acp|
- b.accept(acp)
+ mb.accept(acp)
puts "GET #{url} [#{acp}]"
- b.get path
+ mb.get path
}
puts
}
puts
@@ -36,19 +35,19 @@
puts "Checking HTTP methods across sites"
puts "=================================="
puts "POST/PUT payload = #{payload.to_json}"
puts
sites.each { |site|
- b = Mudbug.new(site)
+ mb = Mudbug.new(site)
url = "http://#{site}#{path}"
http_methods.each { |meth|
args = [meth, path]
args << payload if [:post, :put].include?(meth)
print "#{meth.to_s.upcase} #{url} "
begin
- b.send(*args)
+ mb.send(*args)
puts
rescue RuntimeError => e
puts "#{e} (#{e.class})"
end
}