<?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>Transcending Frontiers &#187; Agile Development Sprints &#8211; This is how we do it</title>
	<atom:link href="http://blog.thefrontiergroup.com.au/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thefrontiergroup.com.au</link>
	<description>Your peek inside the collective mind of The Frontier Group</description>
	<lastBuildDate>Tue, 03 Jan 2012 06:53:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Agile Development Sprints &#8211; This is how we do it</title>
		<link>http://blog.thefrontiergroup.com.au/2011/12/agile-development-sprints-this-is-how-we-do-it/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/12/agile-development-sprints-this-is-how-we-do-it/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 19:40:24 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[agile development]]></category>
		<category><![CDATA[sprint]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1853</guid>
		<description><![CDATA[In any given week our company is typically developing five projects at once, with teams of one to three. We run one-week sprints with a half day planning session on Monday morning, and a review session on Friday afternoon. A sprint is the basic unit of development in Agile. Sprints tend to last between one [...]]]></description>
			<content:encoded><![CDATA[<p>In any given week our company is typically developing five projects at once, with teams of one to three. We run one-week sprints with a half day planning session on Monday morning, and a review session on Friday afternoon.</p>
<p><em>A sprint is the basic unit of development in Agile. Sprints tend to last between one week and one month and are a &#8220;timeboxed&#8221; development effort of a constant length.</em></p>
<p><strong>Our sprint planning session is broken down as follows:</strong></p>
<ul>
<li>Product owner &#8211; prioritise and explain highest priority items in the product backlog (we use <a title="Pivotal Tracker" href="http://pivotaltracker.com">Pivotal Tracker</a>). The team can ask questions at this point.</li>
<li>Product owner &#8211; set a sprint goal (what are we achieving this sprint).</li>
<li>Team &#8211; select Pivotal Tracker stories you can commit to, to attain that goal.</li>
<li>Team &#8211; demonstrate a solution to each story in the sprint and ensure no outstanding questions.</li>
</ul>
<p><strong>Our Friday afternoon review session:</strong></p>
<ul>
<li>Product Owner and Team  - demo all completed stories.</li>
<li>Team &#8211; Review estimates from the sprint and note down how you went and how you can improve (if target not met).</li>
<li>Team &#8211; Review points missed from the sprint and why, and how you can improve on that for next sprint.</li>
</ul>
<p>If you&#8217;re running sprints in your organisation do you do things a little differently? Drop us a line in the comments.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/12/agile-development-sprints-this-is-how-we-do-it/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/12/agile-development-sprints-this-is-how-we-do-it/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Learn Ruby with the Ruby Koans</title>
		<link>http://blog.thefrontiergroup.com.au/2011/10/learn-ruby-with-the-ruby-koans/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/10/learn-ruby-with-the-ruby-koans/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 06:42:59 +0000</pubDate>
		<dc:creator>mlambie</dc:creator>
				<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Websites or Tools]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1837</guid>
		<description><![CDATA[If you&#8217;re looking for an engaging and interactive way to learn Ruby, I&#8217;d recommend Ruby Koans by EdgeCase. I think that the koans are especially interesting if you&#8217;re coming from another programming language like PHP or Java, because they rely on some basic programming knowledge, but don&#8217;t presume any Ruby-specific abilities. The Koans walk you [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re looking for an engaging and interactive way to learn Ruby, I&#8217;d recommend <a title="Ruby Koans" href="http://rubykoans.com/">Ruby Koans</a> by <a title="EdgeCase" href="http://edgecase.com/">EdgeCase</a>. I think that the koans are especially interesting if you&#8217;re coming from another programming language like PHP or Java, because they rely on some basic programming knowledge, but don&#8217;t presume any Ruby-specific abilities.</p>
<blockquote><p>The Koans walk you along the path to enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries.</p></blockquote>
<p>By manipulating and building upon Ruby&#8217;s TestUnit framework, the EdgeCase developers have created a step-by-step process for teaching Ruby through the practice of &#8220;<a title="Red, Green, Refactor" href="http://jamesshore.com/Blog/Red-Green-Refactor.html">Red, Green, Refactor.</a>&#8221; They&#8217;ve added some simple game mechanics too, by showing your systematic progression through the 270+ challenges (puzzles). Reaching enlightenment results in a pretty ASCII graphic, and a legitimate sense of achievement.</p>
<p>Before you start with the koans though you&#8217;ll need a working Ruby installation. I recommend you take a look at the excellent <a title="rvm" href="http://beginrescueend.com/">rvm</a> project, which will allow you to install multiple rubies (1.8.7 and 1.9.2 for example, alongside each other) and multiple gemsets in your home directory. Former Frontiersmen and 2011 Ruby Hero Award winner <a href="http://twitter.com/#!/sutto">Darcy Laycock</a> was heavily involved in this project as part of the 2010 Ruby Summer of Code, so we really like rvm at TFG.</p>
<p>The <a href="https://github.com/edgecase/ruby_koans">GitHub repository</a> even includes a handy Keynote presentation, which I used as the basis for my talk about Ruby Koans at last week&#8217;s <a title="Ruby on Rails Perth Meetup" href="http://www.perthrubyonrails.com.au/">Ruby on Rails Oceania Perth meetup</a>.</p>
<p>Lastly, if you&#8217;d like to have a play with the koans before diving in too deep, they&#8217;re available online through your web browser at <a title="Ruby Koans Online" href="http://koans.heroku.com/">Ruby Koans Online</a>. This is a no-risk way of trying out Ruby (hint: team them up with why&#8217;s <a title="Try Ruby" href="http://tryruby.org/">Try Ruby</a> project) in your browser.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/10/learn-ruby-with-the-ruby-koans/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/10/learn-ruby-with-the-ruby-koans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Guest Series: Peter Cooper &#8211; Capybara-WebKit: Bringing WebKit to your integration tests</title>
		<link>http://blog.thefrontiergroup.com.au/2011/08/guest-series-peter-cooper-capybara-webkit-bringing-webkit-to-your-integration-tests/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/08/guest-series-peter-cooper-capybara-webkit-bringing-webkit-to-your-integration-tests/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 13:48:03 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Websites or Tools]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1776</guid>
		<description><![CDATA[Today we bring you the first in a series of guest posts on our TFG blog. This post is written by Peter Cooper, editor of Ruby Inside and Ruby Weekly. You&#8217;re using Capybara, right? It&#8217;s an acceptance / integration test framework for Ruby that superseded Webrat and makes it easy to automatically interact with Web [...]]]></description>
			<content:encoded><![CDATA[<p>Today we bring you the first in a series of guest posts on our TFG blog. This post is written by <a href="http://twitter.com/peterc">Peter Cooper</a>, editor of <a href="http://www.rubyinside.com" rel="nofollow">Ruby Inside</a> and <a href="http://rubyweekly.com" rel="nofollow">Ruby Weekly</a>.</p>
<hr />
<p>You&#8217;re using <a href="https://github.com/jnicklas/capybara">Capybara</a>, right?</p>
<p>It&#8217;s an acceptance / integration test framework for Ruby that superseded Webrat and makes it easy to automatically interact with Web applications but at the user level. It&#8217;s now the de facto way to do request / integration / acceptance testing (seriously, it gets called any or all of these) in Rails 3.</p>
<p>Capybara supports using different &#8216;drivers&#8217; to run the scenarios you specify and by default it&#8217;ll use Rack::Test or Selenium (which uses Firefox&#8217;s Gecko engine). <a href="https://github.com/thoughtbot/capybara-webkit">capybara-webkit</a> is a library by the guys at <a href="http://thoughtbot.com/">Thoughtbot</a> that gives Capybara a WebKit-powered driver using the WebKit implementation in Qt, a popular cross-platform development toolkit.</p>
<h3>Why?</h3>
<p>Why get WebKit involved with your integration tests at all? Perhaps your userbase is primarily made up of Safari and Chrome users (both WebKit-powered browsers) and you want to focus on them. Or perhaps you&#8217;re thorough and want to ensure the JavaScript on your pages works fine with your tests in a WebKit scenario too.</p>
<h3>Installation</h3>
<p>Here&#8217;s the bad news. You need Qt installed in order to install capybara-webkit. If you&#8217;re on OS X, <a href="http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x">grab it from here</a> (pick the Cocoa: Mac binary package &#8211; the 206MB version). You can install via homebrew too (using <code>brew install qt</code>), but Thoughtbot says it takes <em>forever</em> (well, almost).</p>
<p>For other platforms, check out Qt&#8217;s <a href="http://qt.nokia.com/downloads">Downloads page</a>.<br />
If you&#8217;re on CentOS, in particular, <a href="http://opensourcetester.co.uk/2011/06/23/capybara-webkit-centos/">check this article.</a></p>
<p>Once you&#8217;ve installed the Qt toolkit, add this to your app&#8217;s Gemfile:</p>
<p><code>gem 'capybara-webkit'</code></p>
<p>Then run <code>bundle</code> and you&#8217;re off to the races.</p>
<h3>Usage</h3>
<p>Once everything&#8217;s installed, you can set Capybara&#8217;s JavaScript driver to use Webkit by default, by adding this to your normal Capybara config options (or if you have none, in <code>spec/spec_helper.rb</code> in most Rails 3 cases):</p>
<p><code>Capybara.javascript_driver = :webkit</code></p>
<p>Then, if you&#8217;re using Cucumber you can add the following tag to the header of your scenario to trigger JavaScript usage specifically (it&#8217;s not done by default):</p>
<p><code>@javascript</code></p>
<p>In regular RSpec code, you can do something like this:</p>
<p><code>feature "The signup page" do<br />
scenario "should load", :js =&gt; true do<br />
visit new_user_registration_path<br />
page.should have_selector("form.user_new")<br />
end<br />
end</code></p>
<p>You could also use the <code>:driver</code> option to specify <code>:webkit</code> if you want to choose the driver on a per scenario / describe basis. The same applies to <code>@webkit</code> in Cucumber.</p>
<p>If you&#8217;re on OS X, when you first run tests using capybara-webkit the OS X firewall might go a little crazy since it works by connecting over a socket. Just approve it and you&#8217;re on your way.</p>
<p>You may also have issues if you&#8217;re using transaction fixtures. If so, read the &#8220;Transactional Fixtures&#8221; section of the <a href="https://github.com/cavalle/capybara">Capybara README.</a></p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/08/guest-series-peter-cooper-capybara-webkit-bringing-webkit-to-your-integration-tests/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/08/guest-series-peter-cooper-capybara-webkit-bringing-webkit-to-your-integration-tests/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ECU Open Day Planner 2011</title>
		<link>http://blog.thefrontiergroup.com.au/2011/07/ecu-open-day-planner-2011/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/07/ecu-open-day-planner-2011/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 00:22:44 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1769</guid>
		<description><![CDATA[Our latest web application has gone live, the ECU Open Day Planner for Edith Cowan University in Perth, Western Australia. If you&#8217;re thinking of visiting either the Mt Lawley or Joondalup campuses on the day, check it out!]]></description>
			<content:encoded><![CDATA[<p>Our latest web application has gone live, the <a href="http://thefrontiergroup.com.au/case-studies/ecu_openday_planner">ECU Open Day Planner</a> for <a href="http://www.ecu.edu.au">Edith Cowan University</a> in Perth, Western Australia. </p>
<p>If you&#8217;re thinking of visiting either the Mt Lawley or Joondalup campuses on the day, check it out!</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/07/ecu-open-day-planner-2011/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/07/ecu-open-day-planner-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Has Face for Rails</title>
		<link>http://blog.thefrontiergroup.com.au/2011/07/introducing-has-face-for-rails/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/07/introducing-has-face-for-rails/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 01:49:17 +0000</pubDate>
		<dc:creator>Mario Visic</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygems]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1742</guid>
		<description><![CDATA[Have you ever created an application where users are trusted to upload their own avatars? Wouldn&#8217;t it be great if there was an easy way to ensure the avatar contains a person&#8217;s face? Has Face is a neat little gem that uses the face.com API to ensure that an image contains a persons face. It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever created an application where users are trusted to upload their own avatars? Wouldn&#8217;t it be great if there was an easy way to ensure the avatar contains a person&#8217;s face?</p>
<p><a href="https://github.com/mariovisic/has_face">Has Face</a> is a neat little gem that uses the <a href="http://face.com">face.com API</a> to ensure that an image contains a persons face. It&#8217;s very simple to use and can be easily integrated into an existing rails application.</p>
<p>To get started add the has_face gem to your Gemfile and run a bundle install
<p class="gist-block" data-gist-id="1103591" data-gist-file="Gemfile" id="gist-1103591">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/1103591">View it on Github!</a></p>
<p>Run the generator to copy over an initializer: </p>
<p class="gist-block" data-gist-id="1103591" data-gist-file="install" id="gist-1103591">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/1103591">View it on Github!</a></p>
<p>The initializer should look something like this:</p>
<p class="gist-block" data-gist-id="1103591" data-gist-file="initializer.rb" id="gist-1103591">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/1103591">View it on Github!</a></p>
<p>Now we&#8217;ll need to make a face.com developer account. You can <a href="http://developers.face.com/signup/?g">signup for a free account over at face.com</a>. Once you have signed up, place your API key and API secret in the initializer config.</p>
<p>The last option in the initializer (skip_validation_on_error) will change the behavior of has_face when an error occurs. If set to true, when an error occurs a warning will be logged to the logfile with detailed information about the failure and face validation will be skipped. This can be useful if you want your application to function if the API service is not reachable. If the value is false then an exception will be raised when an API call fails, this will allow you to manually handle the exception yourself, please check the documentation for details on the errors raised.</p>
<p>Once the initializer settings are setup then we can add face validation to a model. In the example below I&#8217;m using carrierwave to attach the image to the model but other image attachment gems should also work fine (anything that correctly responds to `path` should be OK).</p>
<p class="gist-block" data-gist-id="1103591" data-gist-file="user.rb" id="gist-1103591">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/1103591">View it on Github!</a></p>
<p>That&#8217;s it, that&#8217;s all we need to have a functioning face validator. There are a few other options that I haven&#8217;t covered here in this short guide, please <a href="https://github.com/mariovisic/has_face">consult the readme</a> for more detailed information.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/07/introducing-has-face-for-rails/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/07/introducing-has-face-for-rails/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Building Structured API Clients with API Smith</title>
		<link>http://blog.thefrontiergroup.com.au/2011/07/building-structured-api-clients-with-api-smith/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/07/building-structured-api-clients-with-api-smith/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 08:55:46 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1713</guid>
		<description><![CDATA[A guest post on Engine Yard&#8217;s blog by Darcy: &#8220;Whilst prototyping the early stages of a new app with Filter Squad, we found ourselves prototyping a lot of API clients for new versions of APIs that were lacking up to date clients or in the case of other APIs, were missing functionality we required.&#8221; Read [...]]]></description>
			<content:encoded><![CDATA[<p>A guest post on <a href="http://www.engineyard.com/blog/2011/building-structured-api-clients-with-api-smith/">Engine Yard&#8217;s blog</a> by <a href="http://twitter.com/sutto">Darcy</a>:</p>
<p><em>&#8220;Whilst prototyping the early stages of a new app with <a href="http://filtersquad.com/">Filter Squad</a>, we found ourselves prototyping a lot of API clients for new versions of APIs that were lacking up to date clients or in the case of other APIs, were missing functionality we required.&#8221;</em></p>
<p>Read the full post over at Engine Yard: <a href="http://www.engineyard.com/blog/2011/building-structured-api-clients-with-api-smith/">Building Structured API Clients with API Smith</a></p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/07/building-structured-api-clients-with-api-smith/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/07/building-structured-api-clients-with-api-smith/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Frontier Group &#8211; Busy Times Ahead</title>
		<link>http://blog.thefrontiergroup.com.au/2011/06/the-frontier-group-busy-times-ahead/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/06/the-frontier-group-busy-times-ahead/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 22:10:08 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1598</guid>
		<description><![CDATA[It&#8217;s been a busy few months at The Frontier Group. Firstly, a congratulations to our very own Darcy Laycock for winning a Ruby Hero award. The Ruby Hero awards are put in place to recognise people that have gone above and beyond in the Ruby community. We&#8217;ve rolled out our new Frontier Group blog design, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a busy few months at The Frontier Group. </p>
<p>Firstly, a congratulations to our very own <a href="http://twitter.com/sutto">Darcy Laycock</a> for winning a <a href="http://rubyheroes.com">Ruby Hero</a> award. The Ruby Hero awards are put in place to recognise people that have gone above and beyond in the Ruby community.</p>
<p>We&#8217;ve rolled out our new Frontier Group blog design, and would love to hear what you think of it in the comments below. We&#8217;ve also added a <strong>Featured Posts</strong> section in the sidebar, so you can see what other visitors (and hopefully you) are interested in too.</p>
<p>We&#8217;ve been heavily featured in a range of Podcasts recently, such as <a href="http://ruby5.envylabs.com">Ruby5</a> and <a href="http://www.rubyshow.com">The Ruby Show</a>. Also we&#8217;ve been featured in prominent Ruby and Rails websites such as <a href="http://rubyweekly.com">Ruby Weekly</a> and <a href="http://rubyrogues.com">Ruby Rogues</a>.</p>
<p>We&#8217;d love you to keep visiting. Sign up to receive our newsletter using the form to the right, or stop back here from time to time. Don&#8217;t forget to check out the rest of our site and see <a href="http://thefrontiergroup.com.au/pages/case-studies">what we&#8217;ve been working on</a>.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/06/the-frontier-group-busy-times-ahead/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/06/the-frontier-group-busy-times-ahead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stubbing out Rails.env</title>
		<link>http://blog.thefrontiergroup.com.au/2011/06/stubbing-out-rails-env/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/06/stubbing-out-rails-env/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 08:10:46 +0000</pubDate>
		<dc:creator>Jordan Maguire</dc:creator>
				<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1656</guid>
		<description><![CDATA[The problem I had some conditional logic I needed to test that was based on the current Rails environment. Basically something like: if Rails.env.production? # Do something Elsif Rails.env.staging? # Do something else End I needed to stub out the Rails.env call. I had a quick Google around but I couldn’t really find a way [...]]]></description>
			<content:encoded><![CDATA[<h4>The problem</h4>
<p>I had some conditional logic I needed to test that was based on the current Rails environment. Basically something like:</p>
<p><code>if Rails.env.production?<br />
# Do something<br />
Elsif Rails.env.staging?<br />
# Do something else<br />
End</code></p>
<p>I needed to stub out the <code>Rails.env</code> call. I had a quick Google around but I couldn’t really find a way of doing this I was happy with.</p>
<h4>The solution</h4>
<p>I whipped up this function that allows you to set the Rails environment to whatever you want:</p>
<p class="gist-block" data-gist-id="1018290" data-gist-file="stub_env.rb" id="gist-1018290">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/1018290">View it on Github!</a></p>
<p>Put the above function in your spec file or your spec_helper.rb. The function can be called as such:</p>
<p class="gist-block" data-gist-id="1018294" data-gist-file="stub_env_spec.rb" id="gist-1018294">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/1018294">View it on Github!</a></p>
<h4>How does this work?</h4>
<p>The <code>Rails.env</code> function looks like this:</p>
<p class="gist-block" data-gist-id="1018293" data-gist-file="rails_env.rb" id="gist-1018293">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/1018293">View it on Github!</a></p>
<p>So all you&#8217;re doing is setting the cached instance variable to the environment you want.</p>
<h4>Follow Up (June 20, 2011)</h4>
<p>So two distinct issue have come up as a result of the above content.</p>
<p>Firstly, there was no ensure meaning that if an exception was raised in the middle of the stub then the environment would be changed for the remaining tests. This was a stupid mistake but, it happens, so I&#8217;ve updated the gist and my code.</p>
<p>Secondly, the issue of checking environment in code. The solution for this would be to have a constant in each env file that defines whatever it is you are using the env check for. So in the example I was working with each env file would have a EMAIL_TARGET constant.</p>
<p>You still need to test this, so the stub provided is still useful in this regard.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/06/stubbing-out-rails-env/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/06/stubbing-out-rails-env/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Simple Database Export and Import With Character Encoding Conversion</title>
		<link>http://blog.thefrontiergroup.com.au/2011/05/simple-db-export-and-import-with-character-encoding-conversion/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/05/simple-db-export-and-import-with-character-encoding-conversion/#comments</comments>
		<pubDate>Wed, 25 May 2011 12:31:56 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1575</guid>
		<description><![CDATA[There is a gem called ydd that offers really simple import and export of smallish databases. It exports to YAML and then imports to whatever database Rails can connect to. After using YDD a few times I&#8217;ve found it easier to pinpoint the cause of problems that occur using taps. It doesn&#8217;t handle character encodings [...]]]></description>
			<content:encoded><![CDATA[<p>There is a gem called <a href="https://github.com/YouthTree/ydd">ydd</a> that offers really simple import and export of smallish databases. It exports to YAML and then imports to whatever database Rails can connect to. After using YDD a few times I&#8217;ve found it easier to pinpoint the cause of problems that occur using <a href="https://github.com/ricardochimal/taps">taps</a>.</p>
<p>It doesn&#8217;t handle character encodings though so I went about adding that. With the handy rchardet gem and IConv, detecting the character encoding of the incoming string and converting it to UTF-8 was pretty simple. I&#8217;ve created a <a href="https://github.com/YouthTree/ydd/pull/3">pull request</a> for the gem that will hopefully be accepted.</p>
<p>The essential code is below, and revolves mainly around the detection and conversion. Using //TRANSLIT causes IConv to try and convert the incoming character code to something that exists in the UTF8 character set, and then //IGNORE will ignore any characters that don&#8217;t exist in the UTF8 character set. Chaining //TRANSLIT and then //IGNORE will make IConv try a conversion first and then ignore anything it cannot convert.</p>
<p><script src="https://gist.github.com/990410.js?file=changes.rb"> </script></p>
<p>I used this gem after the above changes to convert about 400,000 records of text data with ASCII, windows-1252, IBM866 and other character encodings from an old SQLite installation to a new postgres database without any issues.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/05/simple-db-export-and-import-with-character-encoding-conversion/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/05/simple-db-export-and-import-with-character-encoding-conversion/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RSpec 2.6.0 and RCov</title>
		<link>http://blog.thefrontiergroup.com.au/2011/05/rspec-2-6-0-and-rcov/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/05/rspec-2-6-0-and-rcov/#comments</comments>
		<pubDate>Thu, 19 May 2011 11:02:19 +0000</pubDate>
		<dc:creator>Mario Visic</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[rcov]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1510</guid>
		<description><![CDATA[Just upgraded to the newest RSpec (2.6.0) and found that RCov has stopped working completely? That&#8217;s what happened to me after running a bundle update. RCov refused to run, no error messages, just blank output. After looking around for a little while I found this: https://github.com/rspec/rspec-core/issues/370 In short: the new RSpec has been broken up [...]]]></description>
			<content:encoded><![CDATA[<p>Just upgraded to the newest RSpec (2.6.0) and found that RCov has stopped working completely? That&#8217;s what happened to me after running a bundle update. RCov refused to run, no error messages, just blank output.</p>
<p>After looking around for a little while I found this: <a href="https://github.com/rspec/rspec-core/issues/370">https://github.com/rspec/rspec-core/issues/370</a></p>
<p>In short: the new RSpec has been broken up into modules a tad more, the one that we require for rspec to run correctly <em>&#8216;autorun&#8217;</em> is not included by default, so to solve this simply add <em>require &#8216;rspec/autorun&#8217;</em> to the top of your spec_helper.</p>
<p class="gist-block" data-gist-id="978300" data-gist-file="spec_helper.rb" id="gist-978300">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/978300">View it on Github!</a></p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/05/rspec-2-6-0-and-rcov/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/05/rspec-2-6-0-and-rcov/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

