<?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; Mike Gehard</title>
	<atom:link href="http://pivotallabs.com/author/mgehard/feed/" rel="self" type="application/rss+xml" />
	<link>http://pivotallabs.com</link>
	<description>Agility Developed</description>
	<lastBuildDate>Wed, 22 May 2013 22:49:44 +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>Using Jasmine to test CoffeeScript in a Rails 3.1 App</title>
		<link>http://pivotallabs.com/using-jasmine-to-test-coffeescript-in-a-rails-3-1-app/</link>
		<comments>http://pivotallabs.com/using-jasmine-to-test-coffeescript-in-a-rails-3-1-app/#comments</comments>
		<pubDate>Thu, 12 May 2011 02:54:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[coffeescript]]></category>
		<category><![CDATA[rails3]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/using-jasmine-to-test-coffeescript-in-a-rails-3-1-app/</guid>
		<description><![CDATA[<p><p>Lately I've had the opportunity to use <a href="https://github.com/pivotal/jasmine">Jasmine</a> to test drive a whole bunch of Javascript and am loving it.  If you haven't had a chance to take Jasmine for a spin, I recommend you take some time to do so.</p>

<p>When I heard that Rails 3.1 was going to include <a href="https://github.com/jashkenas/coffee-script">CoffeeScript</a> I decided to work to figure out how I could write both my production code as well as my specs in Coffeescript.</p> <a href="http://pivotallabs.com/using-jasmine-to-test-coffeescript-in-a-rails-3-1-app/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/using-jasmine-to-test-coffeescript-in-a-rails-3-1-app/">Using Jasmine to test CoffeeScript in a Rails 3.1 App</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Lately I&#8217;ve had the opportunity to use <a href="https://github.com/pivotal/jasmine">Jasmine</a> to test drive a whole bunch of Javascript and am loving it.  If you haven&#8217;t had a chance to take Jasmine for a spin, I recommend you take some time to do so.</p>
<p>When I heard that Rails 3.1 was going to include <a href="https://github.com/jashkenas/coffee-script">CoffeeScript</a> I decided to work to figure out how I could write both my production code as well as my specs in Coffeescript.</p>
<p>Using <a href="https://gist.github.com/956438">this gist</a> as a guide, I came up with these detailed instructions:</p>
<p>Add <a href="https://github.com/guard/guard">Guard</a> and <a href="https://github.com/netzpirat/guard-coffeescript">Guard-Coffeescript</a> to your Gemfile and run <code>bundle</code>.</p>
<p>Run <code>guard init</code> to create a Guardfile and edit it to contain the following:</p>
<pre><code>guard 'coffeescript', :output =&gt; 'public/javascripts/compiled' do
  watch&#40;/^app/assets/javascripts/&#40;.*&#41;.coffee/&#41;
end

guard 'coffeescript', :output =&gt; 'spec/javascripts/compiled' do
  watch&#40;/^spec/javascripts/&#40;.*&#41;.coffee/&#41;
end
</code></pre>
<p>Edit your spec/javascripts/support/jasmine.yml to have at least the following entries:</p>
<pre><code>src_dir: public/javascripts/compiled
src_files:
  - **/*.js

spec_dir: spec/javascripts/compiled
spec_files:
  - **/*_spec.js
</code></pre>
<p>Start up the Jasmine server using <code>rake jasmine</code> and point your browser to http://localhost:8888.  You should see 0 specs, 0 failures.  Since you have changed the location that Jasmine looks for spec files, you aren&#8217;t picking up the example Jasmine specs any longer.</p>
<p>Create a new spec file in spec/javascripts/math_spec.coffee with the following contents:</p>
<pre><code>describe 'Math:', -&gt;
  describe 'fib&#40;&#41;', -&gt;
    it 'should calculate the numbers correctly up to fib&#40;16&#41;', -&gt;
      fib = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987]
      expect&#40;Math.fib&#40;i&#41;&#41;.toEqual fib[i] for i in [0..16]
</code></pre>
<p>Refresh your browser, you should see one failing spec.  Guard has compiled your .coffee file into a .js file that Jasmine will use.</p>
<p>Create a new implementation file in app/assets/javascripts/math.coffee with the following contents:</p>
<pre><code>Math.fib = &#40;n&#41; -&gt;
    s = 0
    return s if n == 0
    if n == 1
      s += 1
    else
      Math.fib&#40;n - 1&#41; + Math.fib&#40;n - 2&#41;
</code></pre>
<p>Refresh your Jasmine browser window and you should see 1 passing spec.  Again, Guard has compiled your implementation file and Jasmine uses it to satisfy the spec.</p>
<p>At some point, it would be nice to figure out a way to run Jasmine specs directly from the .coffee files and against the implementation .coffee files without having to use Guard to compile them.  With the above steps, you still have to check in the compiled files into source control so your tests can be run in the CI environment.  If you miss one of the compiled specs or one of the compiled implementation files, your CI environment may report improper results.</p>
<p>If anyone has any ideas, I&#8217;d love to hear them.</p>
<p>The post <a href="http://pivotallabs.com/using-jasmine-to-test-coffeescript-in-a-rails-3-1-app/">Using Jasmine to test CoffeeScript in a Rails 3.1 App</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/using-jasmine-to-test-coffeescript-in-a-rails-3-1-app/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Waiting for jQuery Ajax calls to finish in Cucumber</title>
		<link>http://pivotallabs.com/waiting-for-jquery-ajax-calls-to-finish-in-cucumber/</link>
		<comments>http://pivotallabs.com/waiting-for-jquery-ajax-calls-to-finish-in-cucumber/#comments</comments>
		<pubDate>Wed, 04 May 2011 01:16:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[capybara]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[webdriver]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/waiting-for-jquery-ajax-calls-to-finish-in-cucumber/</guid>
		<description><![CDATA[<p><p>You may be asking yourself why you'd want to do this in the first place. Well here's why I would want to do it.</p>

<p>We had some Webdriver based Cucumber tests that passed fine locally but kept failing on our CI box.  Our CI box is a bit underpowered at the moment so I thought what might be happening is that our tests weren't waiting long enough for the Ajaxy stuff to happen because the Ajax responses were taking a long time.</p>

<p>After some poking around in the source code of jQuery, I found the $.active property.  This property keeps track of the number of active Ajax requests that are going on and I thought this might help us out.  </p>

<p>What I came up with was this gist:
<script src="http://gist.github.com/954537.js"> </script></p>

<p>I added this step right after my Cucumber step that caused the Ajax call so that Cucumber would wait to move on until I knew that everything was done.</p>

<p>This step solved our CI failures and all was good in our test suite again.</p> <a href="http://pivotallabs.com/waiting-for-jquery-ajax-calls-to-finish-in-cucumber/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/waiting-for-jquery-ajax-calls-to-finish-in-cucumber/">Waiting for jQuery Ajax calls to finish in Cucumber</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>You may be asking yourself why you&#8217;d want to do this in the first place. Well here&#8217;s why I would want to do it.</p>
<p>We had some Webdriver based Cucumber tests that passed fine locally but kept failing on our CI box.  Our CI box is a bit underpowered at the moment so I thought what might be happening is that our tests weren&#8217;t waiting long enough for the Ajaxy stuff to happen because the Ajax responses were taking a long time.</p>
<p>After some poking around in the source code of jQuery, I found the $.active property.  This property keeps track of the number of active Ajax requests that are going on and I thought this might help us out.  </p>
<p>What I came up with was this gist:<br />
<script src="http://gist.github.com/954537.js"> </script></p>
<p>I added this step right after my Cucumber step that caused the Ajax call so that Cucumber would wait to move on until I knew that everything was done.</p>
<p>This step solved our CI failures and all was good in our test suite again.</p>
<p>The post <a href="http://pivotallabs.com/waiting-for-jquery-ajax-calls-to-finish-in-cucumber/">Waiting for jQuery Ajax calls to finish in Cucumber</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/waiting-for-jquery-ajax-calls-to-finish-in-cucumber/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mocking Fog when using it with Carrierwave</title>
		<link>http://pivotallabs.com/mocking-fog-when-using-it-with-carrierwave/</link>
		<comments>http://pivotallabs.com/mocking-fog-when-using-it-with-carrierwave/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 01:17:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[carrierwave]]></category>
		<category><![CDATA[fog]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/mocking-fog-when-using-it-with-carrierwave/</guid>
		<description><![CDATA[<p><p>There is a new kid on the block when it comes to file attachments for Rails and it is called <a href="https://github.com/jnicklas/carrierwave">Carrierwave</a>.</p>

<p>Carrierwave gives you the ability to easily store attachments on S3 using another great gem called <a href="https://github.com/geemus/fog">Fog</a>.</p>

<p>Uploading files to S3 is great for many reasons but it can slow down your testing environment because it takes a while to send stuff up to S3.  The Carrierwave documentation tells you how to switch the storage location over to file storage during testing but that wasn't enough for me.  I wanted to use the same storage mechanism for dev, test and production so I sought out a way to do so.</p>

<p>I had heard about Fog's ability to mock itself to pretend that it was interacting with S3 so I decided to see if I could get it working with Carrierwave.  This allowed me to use the same storage mechanism in test mode without slowing my tests down waiting for images to go to S3.</p>

<p>After a bunch of tinkering and a message on the Fog mailing list&#40;thanks for the quick response <a href="http://twitter.com/#!/geemus">Wesley</a>&#41;, this is what I came up with:</p>

<p><script src="http://gist.github.com/935825.js"> </script></p>

<p>The key is that you have to tell the mocked Fog that an S3 bucket exists before it will let Carrierwave put an image there.  I wasn't doing this at first and Carrierwave kept showing me a 404 error from Fog.</p>

<p>Drop this in a file in your spec/support and/or features/support
directories and you will have your tests thinking they are sending things to S3 without actually sending them to S3.</p>

<p>Now I don't have to mess around with having a bunch of test images laying around my hard drive and I can make sure I'm using the same storage mechanism across all environments without slowing my tests down.</p>

<p>Your mileage may vary but I'd love to hear how this works for people and if there are any limitations.  I haven't found any yet.</p>

<p>UPDATE:
Check out my guest post on the Engine Yard Blog for updated details:
<a href="http://www.engineyard.com/blog/2011/mocking-fog-when-using-it-with-carrierwave/">http://www.engineyard.com/blog/2011/mocking-fog-when-using-it-with-carrierwave/</a></p> <a href="http://pivotallabs.com/mocking-fog-when-using-it-with-carrierwave/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/mocking-fog-when-using-it-with-carrierwave/">Mocking Fog when using it with Carrierwave</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>There is a new kid on the block when it comes to file attachments for Rails and it is called <a href="https://github.com/jnicklas/carrierwave">Carrierwave</a>.</p>
<p>Carrierwave gives you the ability to easily store attachments on S3 using another great gem called <a href="https://github.com/geemus/fog">Fog</a>.</p>
<p>Uploading files to S3 is great for many reasons but it can slow down your testing environment because it takes a while to send stuff up to S3.  The Carrierwave documentation tells you how to switch the storage location over to file storage during testing but that wasn&#8217;t enough for me.  I wanted to use the same storage mechanism for dev, test and production so I sought out a way to do so.</p>
<p>I had heard about Fog&#8217;s ability to mock itself to pretend that it was interacting with S3 so I decided to see if I could get it working with Carrierwave.  This allowed me to use the same storage mechanism in test mode without slowing my tests down waiting for images to go to S3.</p>
<p>After a bunch of tinkering and a message on the Fog mailing list&#40;thanks for the quick response <a href="http://twitter.com/#!/geemus">Wesley</a>&#41;, this is what I came up with:</p>
<p><script src="http://gist.github.com/935825.js"> </script></p>
<p>The key is that you have to tell the mocked Fog that an S3 bucket exists before it will let Carrierwave put an image there.  I wasn&#8217;t doing this at first and Carrierwave kept showing me a 404 error from Fog.</p>
<p>Drop this in a file in your spec/support and/or features/support<br />
directories and you will have your tests thinking they are sending things to S3 without actually sending them to S3.</p>
<p>Now I don&#8217;t have to mess around with having a bunch of test images laying around my hard drive and I can make sure I&#8217;m using the same storage mechanism across all environments without slowing my tests down.</p>
<p>Your mileage may vary but I&#8217;d love to hear how this works for people and if there are any limitations.  I haven&#8217;t found any yet.</p>
<p>UPDATE:<br />
Check out my guest post on the Engine Yard Blog for updated details:<br />
<a href="http://www.engineyard.com/blog/2011/mocking-fog-when-using-it-with-carrierwave/">http://www.engineyard.com/blog/2011/mocking-fog-when-using-it-with-carrierwave/</a></p>
<p>The post <a href="http://pivotallabs.com/mocking-fog-when-using-it-with-carrierwave/">Mocking Fog when using it with Carrierwave</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/mocking-fog-when-using-it-with-carrierwave/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Making sure you implement the ActiveModel interface fully</title>
		<link>http://pivotallabs.com/making-sure-you-implement-the-activemodel-interface-fully/</link>
		<comments>http://pivotallabs.com/making-sure-you-implement-the-activemodel-interface-fully/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 23:01:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[rspec2]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/making-sure-you-implement-the-activemodel-interface-fully/</guid>
		<description><![CDATA[<p><p>Rails 3 brings with it <a href="https://github.com/rails/rails/tree/master/activemodel">ActiveModel</a>.</p>

<p>ActiveModel give you a way to make non-db backed models look like db backed models to your views and controllers. See <a href="http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/">this post</a> for a good explanation of what using ActiveModel buys you.</p>

<p>ActiveModel gives you a great way to test that your class implements the minimum ActiveModel interface: ActiveModel::Lint::Tests</p>

<p>Check out this gist for the details for using these tests in RSpec:
<script src="http://gist.github.com/910773.js"> </script></p> <a href="http://pivotallabs.com/making-sure-you-implement-the-activemodel-interface-fully/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/making-sure-you-implement-the-activemodel-interface-fully/">Making sure you implement the ActiveModel interface fully</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Rails 3 brings with it <a href="https://github.com/rails/rails/tree/master/activemodel">ActiveModel</a>.</p>
<p>ActiveModel give you a way to make non-db backed models look like db backed models to your views and controllers. See <a href="http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/">this post</a> for a good explanation of what using ActiveModel buys you.</p>
<p>ActiveModel gives you a great way to test that your class implements the minimum ActiveModel interface: ActiveModel::Lint::Tests</p>
<p>Check out this gist for the details for using these tests in RSpec:<br />
<script src="http://gist.github.com/910773.js"> </script></p>
<p>The post <a href="http://pivotallabs.com/making-sure-you-implement-the-activemodel-interface-fully/">Making sure you implement the ActiveModel interface fully</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/making-sure-you-implement-the-activemodel-interface-fully/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Firebug with WebDriver in Capybara/Cucumber &#8211; New and Improved</title>
		<link>http://pivotallabs.com/using-firebug-with-webdriver-in-capybara-cucumber-new-and-improved/</link>
		<comments>http://pivotallabs.com/using-firebug-with-webdriver-in-capybara-cucumber-new-and-improved/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 21:57:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[capybara]]></category>
		<category><![CDATA[webdriver]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/using-firebug-with-webdriver-in-capybara-cucumber-new-and-improved/</guid>
		<description><![CDATA[<p><p>Forget the steps I published <a href="http://pivotallabs.com/users/mgehard/blog/articles/1421">earlier</a>...just install the <a href="https://github.com/jfirebaugh/capybara-firebug">capybara-firebug</a> gem and away you go.</p>

<p>Thanks <a href="https://github.com/jfirebaugh">jfirebaugh</a>!</p> <a href="http://pivotallabs.com/using-firebug-with-webdriver-in-capybara-cucumber-new-and-improved/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/using-firebug-with-webdriver-in-capybara-cucumber-new-and-improved/">Using Firebug with WebDriver in Capybara/Cucumber &#8211; New and Improved</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Forget the steps I published <a href="http://pivotallabs.com/users/mgehard/blog/articles/1421">earlier</a>&#8230;just install the <a href="https://github.com/jfirebaugh/capybara-firebug">capybara-firebug</a> gem and away you go.</p>
<p>Thanks <a href="https://github.com/jfirebaugh">jfirebaugh</a>!</p>
<p>The post <a href="http://pivotallabs.com/using-firebug-with-webdriver-in-capybara-cucumber-new-and-improved/">Using Firebug with WebDriver in Capybara/Cucumber &#8211; New and Improved</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/using-firebug-with-webdriver-in-capybara-cucumber-new-and-improved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing OmniAuth based login via Cucumber</title>
		<link>http://pivotallabs.com/testing-omniauth-based-login-via-cucumber/</link>
		<comments>http://pivotallabs.com/testing-omniauth-based-login-via-cucumber/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 18:44:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[omniauth]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/testing-omniauth-based-login-via-cucumber/</guid>
		<description><![CDATA[<p><p>If you haven't looked at <a href="https://github.com/intridea/omniauth">OmniAuth</a> for authentication with sites like Google, Github and Facebook, then you should take a look.  It is pretty killer.</p>

<p>This morning we needed to write a <a href="https://github.com/aslakhellesoy/cucumber">Cucumber</a> scenario to test that a user could log into the system using Google Apps.</p>

<p>We did a quick spike on getting OminAuth integrated, which was a super simple process, and poked around in the browser to make sure it was working OK.</p>

<p>Thanks to <a href="https://github.com/josevalim">Jose Valim</a> for providing some guidance, via the Devise test suite, on how to get this all up and running.</p>

<p>The basics can be found in this Gist:
<script src="http://gist.github.com/853253.js"> </script></p>

<p>I put that code in /features/support/omniauth.rb and then all I need to do is label any scenarios that need to deal with login with an @omniauth_test tag and we are all set.</p>

<p>As our features count grows, I could see us doing this before/after all Cucumber scenarios.</p>

<p>Note: You need to be using 0.2.0.beta5 of OmniAuth to get this to work.  Earlier versions don't have the testing functionality built in.  </p>

<p>Also Note: This same functionality can be used in good, old RSpec integration tests or <a href="https://github.com/cavalle/steak">Steak</a> tests as well.</p> <a href="http://pivotallabs.com/testing-omniauth-based-login-via-cucumber/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/testing-omniauth-based-login-via-cucumber/">Testing OmniAuth based login via Cucumber</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>If you haven&#8217;t looked at <a href="https://github.com/intridea/omniauth">OmniAuth</a> for authentication with sites like Google, Github and Facebook, then you should take a look.  It is pretty killer.</p>
<p>This morning we needed to write a <a href="https://github.com/aslakhellesoy/cucumber">Cucumber</a> scenario to test that a user could log into the system using Google Apps.</p>
<p>We did a quick spike on getting OminAuth integrated, which was a super simple process, and poked around in the browser to make sure it was working OK.</p>
<p>Thanks to <a href="https://github.com/josevalim">Jose Valim</a> for providing some guidance, via the Devise test suite, on how to get this all up and running.</p>
<p>The basics can be found in this Gist:<br />
<script src="http://gist.github.com/853253.js"> </script></p>
<p>I put that code in /features/support/omniauth.rb and then all I need to do is label any scenarios that need to deal with login with an @omniauth_test tag and we are all set.</p>
<p>As our features count grows, I could see us doing this before/after all Cucumber scenarios.</p>
<p>Note: You need to be using 0.2.0.beta5 of OmniAuth to get this to work.  Earlier versions don&#8217;t have the testing functionality built in.  </p>
<p>Also Note: This same functionality can be used in good, old RSpec integration tests or <a href="https://github.com/cavalle/steak">Steak</a> tests as well.</p>
<p>The post <a href="http://pivotallabs.com/testing-omniauth-based-login-via-cucumber/">Testing OmniAuth based login via Cucumber</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/testing-omniauth-based-login-via-cucumber/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Cucumber/Capybara with SauceLabs SauceOnDemand</title>
		<link>http://pivotallabs.com/using-cucumber-capybara-with-saucelabs-sauceondemand/</link>
		<comments>http://pivotallabs.com/using-cucumber-capybara-with-saucelabs-sauceondemand/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 03:38:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[capybara]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[webdriver]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/using-cucumber-capybara-with-saucelabs-sauceondemand/</guid>
		<description><![CDATA[<p><p><a href="http://saucelabs.com">SauceLabs</a> is a cloud based way to test your site against different browsers.</p>

<p>Up until now, they only supported the older Selenium RC based tests.</p>

<p>For those of us using <a href="https://github.com/jnicklas/capybara">Capybara</a>, we were out of luck because Capybara uses Webdriver.</p>

<p>Well that just changed, they now support Webdriver.  Check out the instructions on how to get is set up <a href="http://saucelabs.com/forums/viewtopic.php?pid=1206">here</a>.</p>

<p>The one thing that I disagree with in that post is setting the default Capybara driver to :sauce &#40;Capybara.default_driver = :sauce&#41;.  This seems a little heavy handed to me since I may not want to run all of my scenarios through the Sauce driver.</p>

<p>Upon further review of the source code, it looks like after installing the sauce gem, they redirect any scenarios tagged with @selenium to the Sauce driver.  I like this better so if you don't want to switch over all of your scenarios over to Sauce, you can just ignore the line mentioned above and simply tag the scenarios you want to run on Sauce with @selenium.</p>

<p>I haven't had a lot of time to play with this but at least it is a start in getting Capybara based Cucumber scenarios to run against Sauce Labs.</p>

<p>My next step is to figure out how to run one Cucumber scenario to run against multiple browsers on Sauce.</p>

<p>Another thing I'd like to figure out how to do is only run Selenium based tests on demand so they don't run on Sauce every time I run my Cucumber suite.  That could run up a decent Sauce bill, especially if you had multiple developers running Cucumber scenarios multiple times a day.</p> <a href="http://pivotallabs.com/using-cucumber-capybara-with-saucelabs-sauceondemand/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/using-cucumber-capybara-with-saucelabs-sauceondemand/">Using Cucumber/Capybara with SauceLabs SauceOnDemand</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://saucelabs.com">SauceLabs</a> is a cloud based way to test your site against different browsers.</p>
<p>Up until now, they only supported the older Selenium RC based tests.</p>
<p>For those of us using <a href="https://github.com/jnicklas/capybara">Capybara</a>, we were out of luck because Capybara uses Webdriver.</p>
<p>Well that just changed, they now support Webdriver.  Check out the instructions on how to get is set up <a href="http://saucelabs.com/forums/viewtopic.php?pid=1206">here</a>.</p>
<p>The one thing that I disagree with in that post is setting the default Capybara driver to :sauce &#40;Capybara.default_driver = :sauce&#41;.  This seems a little heavy handed to me since I may not want to run all of my scenarios through the Sauce driver.</p>
<p>Upon further review of the source code, it looks like after installing the sauce gem, they redirect any scenarios tagged with @selenium to the Sauce driver.  I like this better so if you don&#8217;t want to switch over all of your scenarios over to Sauce, you can just ignore the line mentioned above and simply tag the scenarios you want to run on Sauce with @selenium.</p>
<p>I haven&#8217;t had a lot of time to play with this but at least it is a start in getting Capybara based Cucumber scenarios to run against Sauce Labs.</p>
<p>My next step is to figure out how to run one Cucumber scenario to run against multiple browsers on Sauce.</p>
<p>Another thing I&#8217;d like to figure out how to do is only run Selenium based tests on demand so they don&#8217;t run on Sauce every time I run my Cucumber suite.  That could run up a decent Sauce bill, especially if you had multiple developers running Cucumber scenarios multiple times a day.</p>
<p>The post <a href="http://pivotallabs.com/using-cucumber-capybara-with-saucelabs-sauceondemand/">Using Cucumber/Capybara with SauceLabs SauceOnDemand</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/using-cucumber-capybara-with-saucelabs-sauceondemand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Riak Overview and Schema design posted</title>
		<link>http://pivotallabs.com/riak-overview-and-schema-design-posted/</link>
		<comments>http://pivotallabs.com/riak-overview-and-schema-design-posted/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 00:58:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/riak-overview-and-schema-design-posted/</guid>
		<description><![CDATA[<p><p>Our first tech talk from our Boulder office is now up.  You can check it out here:
<a href="http://pivotallabs.com/talks/121-riak-overview-and-schema-design">http://pivotallabs.com/talks/121-riak-overview-and-schema-design</a></p> <a href="http://pivotallabs.com/riak-overview-and-schema-design-posted/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/riak-overview-and-schema-design-posted/">Riak Overview and Schema design posted</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Our first tech talk from our Boulder office is now up.  You can check it out here:<br />
<a href="http://pivotallabs.com/talks/121-riak-overview-and-schema-design">http://pivotallabs.com/talks/121-riak-overview-and-schema-design</a></p>
<p>The post <a href="http://pivotallabs.com/riak-overview-and-schema-design-posted/">Riak Overview and Schema design posted</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/riak-overview-and-schema-design-posted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Are Rails plugins still necessary?</title>
		<link>http://pivotallabs.com/should-the-rails-plugin-architecture-die-in-rails-3-x/</link>
		<comments>http://pivotallabs.com/should-the-rails-plugin-architecture-die-in-rails-3-x/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 17:29:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[rails3]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/should-the-rails-plugin-architecture-die-in-rails-3-x/</guid>
		<description><![CDATA[<p><p>Back in the day, plugins were an acceptable way to extend Rails because gems were hard to create and publish.  It was easier to just put up a public repo and have people pull a plugin from there.</p>

<p>In Rails 3, I think that we've got a good solution to these problems.  Bundler allows us to type bundle gem and quickly get the skeleton of a gem.  Bundler also also allows us to easily pull in unpublished gems via the :git option from any public git repo.  The new rubygems.org allows us to easily publish gems that are ready for prime time.</p>

<p>Yes plugin maintainers will need to take a little time to update their plugins to be gems but I think that time is outweighed by the benefits of less code in Rails &#40;because the plugin architecture code will be removed&#41;, possibly increased startup time because less code is running and adhernace to a standard way of loading Ruby extensions via the gem mechanism.</p>

<p>What do people think?  </p>

<p>A lot of hard work has gone into modularizing the Rails3 codebase to make it easier to work with and faster. </p>

<p>Do we continue the spring cleaning and get rid of other remnants from the past?</p> <a href="http://pivotallabs.com/should-the-rails-plugin-architecture-die-in-rails-3-x/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/should-the-rails-plugin-architecture-die-in-rails-3-x/">Are Rails plugins still necessary?</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Back in the day, plugins were an acceptable way to extend Rails because gems were hard to create and publish.  It was easier to just put up a public repo and have people pull a plugin from there.</p>
<p>In Rails 3, I think that we&#8217;ve got a good solution to these problems.  Bundler allows us to type bundle gem and quickly get the skeleton of a gem.  Bundler also also allows us to easily pull in unpublished gems via the :git option from any public git repo.  The new rubygems.org allows us to easily publish gems that are ready for prime time.</p>
<p>Yes plugin maintainers will need to take a little time to update their plugins to be gems but I think that time is outweighed by the benefits of less code in Rails &#40;because the plugin architecture code will be removed&#41;, possibly increased startup time because less code is running and adhernace to a standard way of loading Ruby extensions via the gem mechanism.</p>
<p>What do people think?  </p>
<p>A lot of hard work has gone into modularizing the Rails3 codebase to make it easier to work with and faster. </p>
<p>Do we continue the spring cleaning and get rid of other remnants from the past?</p>
<p>The post <a href="http://pivotallabs.com/should-the-rails-plugin-architecture-die-in-rails-3-x/">Are Rails plugins still necessary?</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/should-the-rails-plugin-architecture-die-in-rails-3-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Devise 1.1.3 gotcha&#8230;</title>
		<link>http://pivotallabs.com/devise-1-1-3-gotcha/</link>
		<comments>http://pivotallabs.com/devise-1-1-3-gotcha/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 23:23:00 +0000</pubDate>
		<dc:creator>Mike Gehard</dc:creator>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[devise]]></category>
		<category><![CDATA[rails3]]></category>

		<guid isPermaLink="false">http://pivotallabs.com/devise-1-1-3-gotcha/</guid>
		<description><![CDATA[<p><p>In the continued saga that is the Rails 2.3.10 to Rails 3.0.1 upgrade, I found this little nugget today...you want to add a custom action to a controller that inherits from a <a href="https://github.com/plataformatec/devise">Devise</a> controller.  Here are the steps that you need to follow:</p>

<p>1&#41; Create a custom controller that overrides some out of the box <a href="https://github.com/plataformatec/devise">Devise</a> actions as well as adds a new method.</p>

<pre><code>class RegistrationsController &#60; Devise::RegistrationsController
  def update
     # do something different here
  end

  def deactivate_owner
    # deactivate code here
  end
end
</code></pre>

<p>2&#41; You have to tell Devise to use the new controller in routes.rb as well as add the new route to the new action.</p>

<pre><code>devise_for :owners, :controllers =&#62; { :registrations =&#62; "registrations" } do
  post "deactivate_owner", :to =&#62; "registrations#deactivate_owner", :as =&#62; "deactivate_owner_registration"
end
</code></pre>

<p>When we initially implemented this, our route definition looked like this:</p>

<pre><code>post "deactivate_owner", :to =&#62; "registrations#deactivate_owner", :as =&#62; "deactivate_owner_registration"
devise_for :owners, :controllers =&#62; { :registrations =&#62; "registrations" }
</code></pre>

<p>When it was implemented this way, we kept getting a  <code>AbstractController::ActionNotFound</code> exception.  Once we passed the block to <code>devise_for</code> seen in #2, everything worked fine.</p> <a href="http://pivotallabs.com/devise-1-1-3-gotcha/">Continue reading <span class="meta-nav">&#8594;</span></a></p><p>The post <a href="http://pivotallabs.com/devise-1-1-3-gotcha/">Devise 1.1.3 gotcha&#8230;</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>In the continued saga that is the Rails 2.3.10 to Rails 3.0.1 upgrade, I found this little nugget today&#8230;you want to add a custom action to a controller that inherits from a <a href="https://github.com/plataformatec/devise">Devise</a> controller.  Here are the steps that you need to follow:</p>
<p>1&#41; Create a custom controller that overrides some out of the box <a href="https://github.com/plataformatec/devise">Devise</a> actions as well as adds a new method.</p>
<pre><code>class RegistrationsController &lt; Devise::RegistrationsController
  def update
     # do something different here
  end

  def deactivate_owner
    # deactivate code here
  end
end
</code></pre>
<p>2&#41; You have to tell Devise to use the new controller in routes.rb as well as add the new route to the new action.</p>
<pre><code>devise_for :owners, :controllers =&gt; { :registrations =&gt; "registrations" } do
  post "deactivate_owner", :to =&gt; "registrations#deactivate_owner", :as =&gt; "deactivate_owner_registration"
end
</code></pre>
<p>When we initially implemented this, our route definition looked like this:</p>
<pre><code>post "deactivate_owner", :to =&gt; "registrations#deactivate_owner", :as =&gt; "deactivate_owner_registration"
devise_for :owners, :controllers =&gt; { :registrations =&gt; "registrations" }
</code></pre>
<p>When it was implemented this way, we kept getting a  <code>AbstractController::ActionNotFound</code> exception.  Once we passed the block to <code>devise_for</code> seen in #2, everything worked fine.</p>
<p>The post <a href="http://pivotallabs.com/devise-1-1-3-gotcha/">Devise 1.1.3 gotcha&#8230;</a> appeared first on <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://pivotallabs.com/devise-1-1-3-gotcha/feed/</wfw:commentRss>
		<slash:comments>8</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 1174/1226 objects using apc

 Served from: pivotallabs.com @ 2013-05-23 12:01:38 by W3 Total Cache -->