<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using macros to create custom example groups in RSpec</title>
	<atom:link href="http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/feed/" rel="self" type="application/rss+xml" />
	<link>http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/</link>
	<description>Personal Page</description>
	<lastBuildDate>Thu, 12 Apr 2012 09:59:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Matt Green</title>
		<link>http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/comment-page-1/#comment-571</link>
		<dc:creator>Matt Green</dc:creator>
		<pubDate>Wed, 11 Apr 2012 19:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/#comment-571</guid>
		<description>&lt;p&gt;Incredible. Thank you!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Incredible. Thank you!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Jorge Manrubia</title>
		<link>http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/comment-page-1/#comment-454</link>
		<dc:creator>Jorge Manrubia</dc:creator>
		<pubDate>Tue, 21 Sep 2010 20:16:29 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/#comment-454</guid>
		<description>&lt;p&gt;I am glad it helped. Thanks for the feedback&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I am glad it helped. Thanks for the feedback</p>]]></content:encoded>
	</item>
	<item>
		<title>By: JW</title>
		<link>http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/comment-page-1/#comment-453</link>
		<dc:creator>JW</dc:creator>
		<pubDate>Tue, 21 Sep 2010 02:04:24 +0000</pubDate>
		<guid isPermaLink="false">http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/#comment-453</guid>
		<description>&lt;p&gt;Very nice. This is exactly the explanation I needed. You have brought my headache to a pleasantly abrupt end! I&#039;m now using this technique to define a set a examples that get run twice against my API which supports both XML and JSON output, toggling the &quot;format=&quot; parameter on the query for each run:&lt;/p&gt;

&lt;p&gt;&lt;code lang=&quot;ruby&quot;&gt;
def for_both_xml_and_json(&amp;block)
  [:xml, :json].each do &#124;format&#124;
    new_class = context &quot;(format=#{format})&quot; do
      before do
        @params[&#039;format&#039;] = &quot;#{format}&quot;
      end
    end
    new_class.class_eval &amp;block
  end
end
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;for_both_xml_and_json do
  it &quot;responds ok&quot; do
    get @url, @params
    last_response.should be_ok
  end
end&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Very nice. This is exactly the explanation I needed. You have brought my headache to a pleasantly abrupt end! I&#8217;m now using this technique to define a set a examples that get run twice against my <acronym title="Application Programming Interface">API</acronym> which supports both <acronym title="eXtensible Markup Language">XML</acronym> and JSON output, toggling the &#8220;format=&#8221; parameter on the query for each run:</p>

<p>

<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">def</span> for_both_xml_and_json<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&amp;</span>amp;block<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:xml</span>, <span style="color:#ff3333; font-weight:bold;">:json</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span><span style="color:#CC0066; font-weight:bold;">format</span><span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; &nbsp; new_class = context <span style="color:#996600;">&quot;(format=#{format})&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; before <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'format'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;#{format}&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; new_class.<span style="color:#9900CC;">class_eval</span> <span style="color:#006600; font-weight:bold;">&amp;</span>amp;block<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>

</p>

<p>for_both_xml_and_json do
  it &#8220;responds ok&#8221; do
    get @url, @params
    last_response.should be_ok
  end
end</p>]]></content:encoded>
	</item>
</channel>
</rss>

