<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pivotal Labs &#187; Danny Burkes</title>
	<atom:link href="http://pivotallabs.com/author/danny/feed/" rel="self" type="application/rss+xml" />
	<link>http://pivotallabs.com</link>
	<description>Agility Developed</description>
	<lastBuildDate>Fri, 24 May 2013 21:58:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Big Data</title>
		<link>http://pivotallabs.com/big-data/</link>
		<comments>http://pivotallabs.com/big-data/#comments</comments>
		<pubDate>Wed, 20 Jun 2012 17:30:40 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Tech Talks]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/?p=11583</guid>
		<description><![CDATA[<p>A talk by Jacob Maine about collecting, analyzing and presenting very large amounts of data.  Introduces the problems of big data, mentions some of the relevant technologies and gives a bit of advice about designing solutions.</p><p>The post <a href="http://pivotallabs.com/big-data/">Big Data</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>A talk by Jacob Maine about collecting, analyzing and presenting very large amounts of data.  Introduces the problems of big data, mentions some of the relevant technologies and gives a bit of advice about designing solutions.</p>
<p>The post <a href="http://pivotallabs.com/big-data/">Big Data</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/big-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Urban Dictionary: Recent Infrastructure Changes for Rails at Scale</title>
		<link>http://pivotallabs.com/urban-dictionary-recent-infrastructure-changes-for-rails-at-scale/</link>
		<comments>http://pivotallabs.com/urban-dictionary-recent-infrastructure-changes-for-rails-at-scale/#comments</comments>
		<pubDate>Wed, 30 May 2012 16:54:18 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Tech Talks]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/?p=11370</guid>
		<description><![CDATA[<p>Urban Dictionary is a Ruby on Rails application and the 109th most visited site in the country according to Quantcast. Today it runs entirely in the cloud &#8212; on Heroku, AWS and Akamai &#8212; and per-user costs are lower than ever. Founder Aaron Peckham discusses recent infrastructure changes to the site, the costs and benefits of each change, and tricks to minimize risk while making changes to a large site.</p><p>The post <a href="http://pivotallabs.com/urban-dictionary-recent-infrastructure-changes-for-rails-at-scale/">Urban Dictionary: Recent Infrastructure Changes for Rails at Scale</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.urbandictionary.com/">Urban Dictionary</a> is a Ruby on Rails application and the 109th most visited site in the country according to Quantcast. Today it runs entirely in the cloud &#8212; on Heroku, AWS and Akamai &#8212; and per-user costs are lower than ever. Founder Aaron Peckham discusses recent infrastructure changes to the site, the costs and benefits of each change, and tricks to minimize risk while making changes to a large site.</p>
<p>The post <a href="http://pivotallabs.com/urban-dictionary-recent-infrastructure-changes-for-rails-at-scale/">Urban Dictionary: Recent Infrastructure Changes for Rails at Scale</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/urban-dictionary-recent-infrastructure-changes-for-rails-at-scale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scaling Web Applications with MemCachier</title>
		<link>http://pivotallabs.com/scaling-web-applications-with-memcachier/</link>
		<comments>http://pivotallabs.com/scaling-web-applications-with-memcachier/#comments</comments>
		<pubDate>Wed, 23 May 2012 17:00:54 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Tech Talks]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/?p=11375</guid>
		<description><![CDATA[<p>Amit Levy introduces MemCachier, a scalable cache service for cloud hosted applications available now on Heroku. MemCachier seeks to relieve developers from worrying about provisioning and managing servers, allowing applications to scale up and down seamlessly. MemCachier also provides insights that help developers understand their cache behavior and how to cache more efficiently.</p><p>The post <a href="http://pivotallabs.com/scaling-web-applications-with-memcachier/">Scaling Web Applications with MemCachier</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<div><a href="http://www.scs.stanford.edu/~alevy/">Amit Levy</a> introduces <a href="http://www.memcachier.com/">MemCachier</a>, a scalable cache service for cloud hosted applications available now on Heroku. MemCachier seeks to relieve developers from worrying about provisioning and managing servers, allowing applications to scale up and down seamlessly. MemCachier also provides insights that help developers understand their</div>
<div>cache behavior and how to cache more efficiently.</div>
<p>The post <a href="http://pivotallabs.com/scaling-web-applications-with-memcachier/">Scaling Web Applications with MemCachier</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/scaling-web-applications-with-memcachier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Dart</title>
		<link>http://pivotallabs.com/introduction-to-dart/</link>
		<comments>http://pivotallabs.com/introduction-to-dart/#comments</comments>
		<pubDate>Wed, 16 May 2012 17:05:04 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Tech Talks]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/?p=11378</guid>
		<description><![CDATA[<p>Dart is more than a new structured web programming language. Google&#8217;s Dart Developer Advocate, Seth Ladd, talks about the philosophy and motivation for this new open source developer platform. There&#8217;s an overview of the language, libraries, and tools that help developers from all platforms build apps for the modern web.</p><p>The post <a href="http://pivotallabs.com/introduction-to-dart/">Introduction to Dart</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Dart is more than a new structured web programming language. Google&#8217;s Dart Developer Advocate, Seth Ladd, talks about the philosophy and motivation for this new open source developer platform. There&#8217;s an overview of the language, libraries, and tools that help developers from all platforms build apps for the modern web.</p>
<p>The post <a href="http://pivotallabs.com/introduction-to-dart/">Introduction to Dart</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/introduction-to-dart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Responsive Web Design From The Future</title>
		<link>http://pivotallabs.com/responsive-web-design-from-the-future/</link>
		<comments>http://pivotallabs.com/responsive-web-design-from-the-future/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 17:14:05 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Tech Talks]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/?p=11384</guid>
		<description><![CDATA[<p>Responsive web design is about a lot more than the size of your screen. Kyle Neath, Director of Design for GitHub, talks about about how GitHub handles links, the url bar, partial page updates, and explains why he thinks the HTML5 history API is the most important thing to happen to front end development since Firebug.</p><p>The post <a href="http://pivotallabs.com/responsive-web-design-from-the-future/">Responsive Web Design From The Future</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Responsive web design is about a lot more than the size of your screen. Kyle Neath, Director of Design for GitHub, talks about about how GitHub handles links, the url bar, partial page updates, and explains why he thinks the HTML5 history API is the most important thing to happen to front end development since Firebug.</p>
<p>The post <a href="http://pivotallabs.com/responsive-web-design-from-the-future/">Responsive Web Design From The Future</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/responsive-web-design-from-the-future/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DevOps for Developers: When the site goes down I should know what to do</title>
		<link>http://pivotallabs.com/devops-for-developers-when-the-site-goes-down-i-should-know-what-to-do/</link>
		<comments>http://pivotallabs.com/devops-for-developers-when-the-site-goes-down-i-should-know-what-to-do/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 18:33:33 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Tech Talks]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/?p=11392</guid>
		<description><![CDATA[<p>Agile brings the idea that when designing a product, collaboration produces better results than conflict, but all too often a familiar us-vs-them war breaks out between developers and operations. Devops is a buzzword, but in reduction it means putting the people in charge of writing the code in charge of keeping it running. Pivot Matthew Kocher attempts to convince you that you want to run your own site, and teaches you a little bit about how to do it.</p><p>The post <a href="http://pivotallabs.com/devops-for-developers-when-the-site-goes-down-i-should-know-what-to-do/">DevOps for Developers: When the site goes down I should know what to do</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Agile brings the idea that when designing a product, collaboration produces better results than conflict, but all too often a familiar us-vs-them war breaks out between developers and operations. Devops is a buzzword, but in reduction it means putting the people in charge of writing the code in charge of keeping it running. Pivot Matthew Kocher attempts to convince you that you want to run your own site, and teaches you a little bit about how to do it.</p>
<p>The post <a href="http://pivotallabs.com/devops-for-developers-when-the-site-goes-down-i-should-know-what-to-do/">DevOps for Developers: When the site goes down I should know what to do</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/devops-for-developers-when-the-site-goes-down-i-should-know-what-to-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby + Salesforce = Happy Developers</title>
		<link>http://pivotallabs.com/ruby-salesforce-happy-developers/</link>
		<comments>http://pivotallabs.com/ruby-salesforce-happy-developers/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 00:44:00 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Labs]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/ruby-salesforce-happy-developers/</guid>
		<description><![CDATA[<p><p>Pivotal is proud to announce the release of the <a href="http://github.com/heroku/databasedotcom">databasedotcom gem</a>.  Developed in partnership with <a href="http://heroku.com">Heroku</a> and <a href="http://salesforce.com">Salesforce</a>, this gem wraps the <a href="http://www.salesforce.com/us/developer/docs/api_rest/index.htm">Force.com REST API</a> in familiar Ruby idioms, making it a snap to create web applications that integrate with your existing Salesforce instance, or even straight Ruby apps that do offline analysis of your Salesforce data.</p>

<p>I will be giving a session at <a href="http://dreamforce.salesforce.com">Dreamforce</a> on Tuesday, August 30, introducing the gem and demonstrating how easy it is to integrate into a Rails application.  The session is entitled <em>Building and Deploying Great Applications with Salesforce, Ruby, and Heroku</em>, and takes place in Moscone West Room 2008 from 5:00 pm - 6:00 pm.  </p>

<p><a href="https://github.com/dburkes/dreamforce-demo">Source code from the session</a> will be available soon, as will <a href="http://dreamforce-demo.heroku.com/slides">the session slides</a>.</p>

<p>Hope to see you there!</p> <a href="http://pivotallabs.com/ruby-salesforce-happy-developers/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/ruby-salesforce-happy-developers/">Ruby + Salesforce = Happy Developers</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Pivotal is proud to announce the release of the <a href="http://github.com/heroku/databasedotcom">databasedotcom gem</a>.  Developed in partnership with <a href="http://heroku.com">Heroku</a> and <a href="http://salesforce.com">Salesforce</a>, this gem wraps the <a href="http://www.salesforce.com/us/developer/docs/api_rest/index.htm">Force.com REST API</a> in familiar Ruby idioms, making it a snap to create web applications that integrate with your existing Salesforce instance, or even straight Ruby apps that do offline analysis of your Salesforce data.</p>
<p>I will be giving a session at <a href="http://dreamforce.salesforce.com">Dreamforce</a> on Tuesday, August 30, introducing the gem and demonstrating how easy it is to integrate into a Rails application.  The session is entitled <em>Building and Deploying Great Applications with Salesforce, Ruby, and Heroku</em>, and takes place in Moscone West Room 2008 from 5:00 pm &#8211; 6:00 pm.  </p>
<p><a href="https://github.com/dburkes/dreamforce-demo">Source code from the session</a> will be available soon, as will <a href="http://dreamforce-demo.heroku.com/slides">the session slides</a>.</p>
<p>Hope to see you there!</p>
<p>The post <a href="http://pivotallabs.com/ruby-salesforce-happy-developers/">Ruby + Salesforce = Happy Developers</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/ruby-salesforce-happy-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActiveRecord callbacks, autosave, before this and that, etc.</title>
		<link>http://pivotallabs.com/activerecord-callbacks-autosave-before-this-and-that-etc/</link>
		<comments>http://pivotallabs.com/activerecord-callbacks-autosave-before-this-and-that-etc/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 04:33:00 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[activerecord]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/activerecord-callbacks-autosave-before-this-and-that-etc/</guid>
		<description><![CDATA[<p><h1>The Ugly Truth</h1>

<p>On a recent project, we had an ActiveRecord model that declared some relationships and callbacks like so:</p>

<pre><code>belongs_to :credit_card
before_create :build_credit_card
</code></pre>

<p>The intent was that <code>build_credit_card</code> would build the associated <code>CreditCard</code> instance, and ActiveRecord's default <code>:autosave</code> feature on the <code>belongs_to</code> would save it.</p>

<p>What we discovered was that no <code>CreditCard</code> object was being persisted.  We confirmed that <code>:autosave</code> is on by default for <code>belongs_to</code> relationships, so we couldn't immediately understand why the new <code>CreditCard</code> wasn't being created.</p>

<p>Googling proved futile, so we dove right in to the ActiveRecord source- and boy did we have a good laugh about 10 minutes later.</p>

<p>What we found was that the <code>:autosave</code> option works by simply declaring a <code>before_save</code> callback- that makes perfect sense.  </p>

<p>In our case, however, we were building the object to be autosaved in a <code>before_create</code> callback, which ActiveRecords runs <em>after</em> the <code>before_save</code> callbacks &#40;cf. <a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html">the callback ordering docs</a>&#41;.  </p>

<p>So our first problem was that we needed to move the call to <code>build_credit_card</code> from a <code>before_create</code> callback to a <code>before_save :on =&#62; :create</code> callback.  </p>

<p>Did you catch that?  <em>There is a difference between <code>before_create</code> and <code>before_save :on =&#62; :create</code></em>.  A big difference.  </p>

<p>While I understand the how and why of this, the semantics don't make it obvious.  So beware!</p>

<p>Now with our declarations changed to</p>

<pre><code>belongs_to :credit_card
before_save :build_credit_card, :on =&#62; :create
</code></pre>

<p>We ran our tests again, and, still, no love.  Ahhh, we've still got an ordering problem.  In addition to the ordering semantics detailed in <a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html">the docs</a>, ActiveRecord also runs callbacks within a single group <em>in the order in which they are declared</em>.  So, even though we changed the call to <code>build_credit_card</code> to occur in a <code>before_save</code>, it was <em>still</em> occurring <em>after</em> the <code>:autosave</code> <code>before_save</code> callback, because of the declaration order.</p>

<p>Finally, we changed our declarations to</p>

<pre><code>before_save :build_credit_card, :on =&#62; :create
belongs_to :credit_card
</code></pre>

<p>and our tests were happy.</p>

<h1>Takeaways</h1>

<ul>
<li><p>When using <code>autosave</code> with any ActiveRecord association, be <em>very</em> careful of callback ordering if you are building or modifying the inverse objects using ActiveRecord callbacks.</p></li>
<li><p><code>before_create</code> isn't ever the same thing as <code>before_save :on =&#62; :create</code>, even if it sounds like it should be.</p></li>
</ul> <a href="http://pivotallabs.com/activerecord-callbacks-autosave-before-this-and-that-etc/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/activerecord-callbacks-autosave-before-this-and-that-etc/">ActiveRecord callbacks, autosave, before this and that, etc.</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<h1>The Ugly Truth</h1>
<p>On a recent project, we had an ActiveRecord model that declared some relationships and callbacks like so:</p>
<pre><code>belongs_to :credit_card
before_create :build_credit_card
</code></pre>
<p>The intent was that <code>build_credit_card</code> would build the associated <code>CreditCard</code> instance, and ActiveRecord&#8217;s default <code>:autosave</code> feature on the <code>belongs_to</code> would save it.</p>
<p>What we discovered was that no <code>CreditCard</code> object was being persisted.  We confirmed that <code>:autosave</code> is on by default for <code>belongs_to</code> relationships, so we couldn&#8217;t immediately understand why the new <code>CreditCard</code> wasn&#8217;t being created.</p>
<p>Googling proved futile, so we dove right in to the ActiveRecord source- and boy did we have a good laugh about 10 minutes later.</p>
<p>What we found was that the <code>:autosave</code> option works by simply declaring a <code>before_save</code> callback- that makes perfect sense.  </p>
<p>In our case, however, we were building the object to be autosaved in a <code>before_create</code> callback, which ActiveRecords runs <em>after</em> the <code>before_save</code> callbacks &#40;cf. <a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html">the callback ordering docs</a>&#41;.  </p>
<p>So our first problem was that we needed to move the call to <code>build_credit_card</code> from a <code>before_create</code> callback to a <code>before_save :on =&gt; :create</code> callback.  </p>
<p>Did you catch that?  <em>There is a difference between <code>before_create</code> and <code>before_save :on =&gt; :create</code></em>.  A big difference.  </p>
<p>While I understand the how and why of this, the semantics don&#8217;t make it obvious.  So beware!</p>
<p>Now with our declarations changed to</p>
<pre><code>belongs_to :credit_card
before_save :build_credit_card, :on =&gt; :create
</code></pre>
<p>We ran our tests again, and, still, no love.  Ahhh, we&#8217;ve still got an ordering problem.  In addition to the ordering semantics detailed in <a href="http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html">the docs</a>, ActiveRecord also runs callbacks within a single group <em>in the order in which they are declared</em>.  So, even though we changed the call to <code>build_credit_card</code> to occur in a <code>before_save</code>, it was <em>still</em> occurring <em>after</em> the <code>:autosave</code> <code>before_save</code> callback, because of the declaration order.</p>
<p>Finally, we changed our declarations to</p>
<pre><code>before_save :build_credit_card, :on =&gt; :create
belongs_to :credit_card
</code></pre>
<p>and our tests were happy.</p>
<h1>Takeaways</h1>
<ul>
<li>
<p>When using <code>autosave</code> with any ActiveRecord association, be <em>very</em> careful of callback ordering if you are building or modifying the inverse objects using ActiveRecord callbacks.</p>
</li>
<li>
<p><code>before_create</code> isn&#8217;t ever the same thing as <code>before_save :on =&gt; :create</code>, even if it sounds like it should be.</p>
</li>
</ul>
<p>The post <a href="http://pivotallabs.com/activerecord-callbacks-autosave-before-this-and-that-etc/">ActiveRecord callbacks, autosave, before this and that, etc.</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/activerecord-callbacks-autosave-before-this-and-that-etc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making WebMock, Selenium, and WebDriver Play Nicely</title>
		<link>http://pivotallabs.com/introducing-webmock-disabler/</link>
		<comments>http://pivotallabs.com/introducing-webmock-disabler/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 06:53:00 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[webmock]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/introducing-webmock-disabler/</guid>
		<description><![CDATA[<p><h2><strong>Update</strong></h2>

<p><strong>Since this article was written, version 1.7.0 of WebMock has been released, which includes WebMock.disable! functionality, as well as fixes the problem with selenium-webdriver.  So please use that, instead of webmock-disabler.</strong></p>

<h1>The Problem</h1>

<p>Recently, one of my projects ran into a problem where our integration tests would intermittently fail with weird timeout errors and complaints about page elements that couldn't be found.</p>

<p>A little googling revealed that we <a href="http://groups.google.com/group/ruby-capybara/browse_thread/thread/1ffe422c96d94837/6303c01611d8af3f?show_docid=6303c01611d8af3f&#38;pli=1">weren't the only ones having this problem</a>. </p>

<p>Apparently, WebMock, Selenium, and WebDriver don't play nicely together, even if you tell WebMock to allow the outgoing connections necessary to drive the browser.  </p>

<p>Some Gemfile hacking revealed that it was the mere presence of WebMock that caused the error.  If we removed WebMock from our Gemfile, our integration tests ran fine, but then of course all of our  tests that actually needed WebMock failed.</p>

<p>At that point, we could have decided to run our integration tests separately from the rest of the tests, but we really liked the idea of having all the tests run in the same VM, to avoid the duplicate VM startup time.</p>

<p>What we really needed was a way to turn WebMock on and off selectively for different types of tests.</p>

<h1>The Solution</h1>

<p>With some gnarly monkey patching and offensive use of <code>alias_method</code>, I have created <a href="https://github.com/dburkes/webmock-disabler">webmock-disabler</a>, a gem which provides new <code>WebMock.disable!</code> and <code>WebMock.enable!</code> methods.  You can use these methods in individual tests, or on classes of tests as shown in <a href="https://github.com/dburkes/webmock-disabler/blob/master/README.markdown">the README</a>.</p>

<h1>The Result</h1>

<p>We're now able to run our tests that need WebMock in the same VM as those that would otherwise break if we didn't do <code>WebMock.disable!</code>.</p>

<p>Celebration time!</p> <a href="http://pivotallabs.com/introducing-webmock-disabler/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/introducing-webmock-disabler/">Making WebMock, Selenium, and WebDriver Play Nicely</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<h2><strong>Update</strong></h2>
<p><strong>Since this article was written, version 1.7.0 of WebMock has been released, which includes WebMock.disable! functionality, as well as fixes the problem with selenium-webdriver.  So please use that, instead of webmock-disabler.</strong></p>
<h1>The Problem</h1>
<p>Recently, one of my projects ran into a problem where our integration tests would intermittently fail with weird timeout errors and complaints about page elements that couldn&#8217;t be found.</p>
<p>A little googling revealed that we <a href="http://groups.google.com/group/ruby-capybara/browse_thread/thread/1ffe422c96d94837/6303c01611d8af3f?show_docid=6303c01611d8af3f&amp;pli=1">weren&#8217;t the only ones having this problem</a>. </p>
<p>Apparently, WebMock, Selenium, and WebDriver don&#8217;t play nicely together, even if you tell WebMock to allow the outgoing connections necessary to drive the browser.  </p>
<p>Some Gemfile hacking revealed that it was the mere presence of WebMock that caused the error.  If we removed WebMock from our Gemfile, our integration tests ran fine, but then of course all of our  tests that actually needed WebMock failed.</p>
<p>At that point, we could have decided to run our integration tests separately from the rest of the tests, but we really liked the idea of having all the tests run in the same VM, to avoid the duplicate VM startup time.</p>
<p>What we really needed was a way to turn WebMock on and off selectively for different types of tests.</p>
<h1>The Solution</h1>
<p>With some gnarly monkey patching and offensive use of <code>alias_method</code>, I have created <a href="https://github.com/dburkes/webmock-disabler">webmock-disabler</a>, a gem which provides new <code>WebMock.disable!</code> and <code>WebMock.enable!</code> methods.  You can use these methods in individual tests, or on classes of tests as shown in <a href="https://github.com/dburkes/webmock-disabler/blob/master/README.markdown">the README</a>.</p>
<h1>The Result</h1>
<p>We&#8217;re now able to run our tests that need WebMock in the same VM as those that would otherwise break if we didn&#8217;t do <code>WebMock.disable!</code>.</p>
<p>Celebration time!</p>
<p>The post <a href="http://pivotallabs.com/introducing-webmock-disabler/">Making WebMock, Selenium, and WebDriver Play Nicely</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/introducing-webmock-disabler/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Standup 3/10/2011</title>
		<link>http://pivotallabs.com/standup-3-10-2011/</link>
		<comments>http://pivotallabs.com/standup-3-10-2011/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 15:43:00 +0000</pubDate>
		<dc:creator>Danny Burkes</dc:creator>
				<category><![CDATA[Standup]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/standup-3-10-2011/</guid>
		<description><![CDATA[<p><h2>Interesting</h2>

<h3>RSpec 2.5, Capybara, and Selenium</h3>

<p>Capybara, Selenium, and RSpec's request specs play nicely together, and you can even run tests that require javascript, using the <code>:js =&#62; true</code> option.  </p>

<p>However, doing do requires the very latest Capybara, so be sure to specify the <code>:git</code> option in your Gemfile.</p>

<p>Ryan Bates has done an excellent <a href="http://railscasts.com/episodes/257-request-specs-and-capybara">RailsCasts episode</a> on just this.</p> <a href="http://pivotallabs.com/standup-3-10-2011/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/standup-3-10-2011/">Standup 3/10/2011</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<h2>Interesting</h2>
<h3>RSpec 2.5, Capybara, and Selenium</h3>
<p>Capybara, Selenium, and RSpec&#8217;s request specs play nicely together, and you can even run tests that require javascript, using the <code>:js =&gt; true</code> option.  </p>
<p>However, doing do requires the very latest Capybara, so be sure to specify the <code>:git</code> option in your Gemfile.</p>
<p>Ryan Bates has done an excellent <a href="http://railscasts.com/episodes/257-request-specs-and-capybara">RailsCasts episode</a> on just this.</p>
<p>The post <a href="http://pivotallabs.com/standup-3-10-2011/">Standup 3/10/2011</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/standup-3-10-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using apc
Database Caching using apc
Object Caching 1107/1197 objects using apc

 Served from: pivotallabs.com @ 2013-05-24 20:59:59 by W3 Total Cache -->