<?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>rob aldred &#187; ruby</title>
	<atom:link href="http://robaldred.co.uk/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://robaldred.co.uk</link>
	<description>cars, f1, bikes, tech tips &#38; what ever i&#039;m interested in this week</description>
	<lastBuildDate>Thu, 15 Apr 2010 13:54:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>generate list of files for gem spec</title>
		<link>http://robaldred.co.uk/2010/04/generate-list-of-files-for-gem-spec/</link>
		<comments>http://robaldred.co.uk/2010/04/generate-list-of-files-for-gem-spec/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 13:50:31 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[gemspec]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygems]]></category>
		<category><![CDATA[spec]]></category>

		<guid isPermaLink="false">http://robaldred.co.uk/2010/04/generate-list-of-files-for-gem-spec/</guid>
		<description><![CDATA[Gemspec files require the list of files to include in the gem build, here&#8217;s simple command you can run to add all files descending from the current directory, it ignores the .git directory and sorts the list for you. 1find . -type file &#124; grep -v .git/ &#124; sort You just to add the ruby [...]]]></description>
			<content:encoded><![CDATA[<p>Gemspec files require the list of files to include in the gem build, here&#8217;s simple command you can run to add all files descending from the current directory, it ignores the .git directory and sorts the list for you.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">find . -type file | grep -v .git/ | sort</div></td></tr></tbody></table></div>
<p>You just to add the ruby array syntax.<br />
replace ./ with &#8221;<br />
replace \n with &#8220;,\n</p>
]]></content:encoded>
			<wfw:commentRss>http://robaldred.co.uk/2010/04/generate-list-of-files-for-gem-spec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding additional configuration args to selenium rc using cucumber and webrat</title>
		<link>http://robaldred.co.uk/2010/02/adding-additional-configuration-args-to-selenium-rc-using-cucumber-and-webrat/</link>
		<comments>http://robaldred.co.uk/2010/02/adding-additional-configuration-args-to-selenium-rc-using-cucumber-and-webrat/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 14:30:50 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[webrat]]></category>

		<guid isPermaLink="false">http://robaldred.co.uk/?p=183</guid>
		<description><![CDATA[I use cucumber, webrat and selenium RC a lot day to day, all are great pieces of kit, which make my life so much easier, but I&#8217;m always trying to find ways to make these ever easier. Selenium RC has alot of options which are settable when booting the selenium-server java application. Many of these [...]]]></description>
			<content:encoded><![CDATA[<p>I use cucumber, webrat and selenium RC a lot day to day, all are great pieces of kit, which make my life so much easier, but I&#8217;m always trying to find ways to make these ever easier.<br />
Selenium RC has alot of options which are settable when booting the selenium-server java application.<br />
Many of these options are not available when using selenium with cucumber and webrat.</p>
<p>I have <a href="https://webrat.lighthouseapp.com/projects/10503/tickets/307-ability-to-pass-additional-args-to-the-selenium-rc-server">raised an issue for webrat</a> and produced a patch that enables you to pass additional arguments during the setup of your webrat instance, these are then passed on to the Selenium RC startup command. </p>
<p>Until this is prioritised and added to the webrat core, I have an on-the-fly solution that enables the additional args, the following code should be added to your `env.rb`</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#9966CC; font-weight:bold;">module</span> Webrat<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">class</span> Configuration<br />
&nbsp; &nbsp; attr_accessor <span style="color:#ff3333; font-weight:bold;">:selenium_additional_args</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
<span style="color:#9966CC; font-weight:bold;">module</span> AdditionalArgs &nbsp;<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">included</span><span style="color:#006600; font-weight:bold;">&#40;</span>base<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; base.<span style="color:#9900CC;">alias_method_chain</span> <span style="color:#ff3333; font-weight:bold;">:start</span>, <span style="color:#ff3333; font-weight:bold;">:additional_args</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp;<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> start_with_additional_args<br />
&nbsp; &nbsp; remote_control.<span style="color:#9900CC;">additional_args</span> = Webrat.<span style="color:#9900CC;">configuration</span>.<span style="color:#9900CC;">selenium_additional_args</span><br />
&nbsp; &nbsp; start_without_additional_args<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
Webrat.<span style="color:#9900CC;">configure</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>config<span style="color:#006600; font-weight:bold;">|</span> &nbsp;<br />
&nbsp; ... &nbsp;<br />
&nbsp; <span style="color:#9900CC;">config</span>.<span style="color:#9900CC;">selenium_additional_args</span> = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;-firefoxProfileTemplate '../../Library/Application Support/Firefox/Profiles/selenium'&quot;</span>, <span style="color:#996600;">&quot;-singleWindow&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span><br />
&nbsp; ...<br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
<span style="color:#6666ff; font-weight:bold;">Webrat::Selenium::SeleniumRCServer</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span>:<span style="color:#9966CC; font-weight:bold;">include</span>, AdditionalArgs<span style="color:#006600; font-weight:bold;">&#41;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://robaldred.co.uk/2010/02/adding-additional-configuration-args-to-selenium-rc-using-cucumber-and-webrat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing ActionMailer models with Rspec</title>
		<link>http://robaldred.co.uk/2009/12/testing-actionmailer-models-with-rspec/</link>
		<comments>http://robaldred.co.uk/2009/12/testing-actionmailer-models-with-rspec/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 11:41:05 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[actionmailer]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://robaldred.co.uk/?p=163</guid>
		<description><![CDATA[You might think testing ActionMailer sounds like a challenge, actually it&#8217;s just as easy as testing other classes, you just have to know the methods to use to change the state/content of the deliveries. Here we have a simple example of how you might test a mailer for your order receipt 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475require File.dirname&#40;__FILE__&#41; + '/../spec_helper' [...]]]></description>
			<content:encoded><![CDATA[<p>You might think testing ActionMailer sounds like a challenge, actually it&#8217;s just as easy as testing other classes, you just have to know the methods to use to change the state/content of the deliveries.</p>
<p>Here we have a simple example of how you might test a mailer for your order receipt</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">'/../spec_helper'</span><br />
<br />
describe OrderMailer <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; <br />
&nbsp; describe <span style="color:#996600;">&quot;receipt&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; <br />
&nbsp; &nbsp; before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@order</span> = mock_model<span style="color:#006600; font-weight:bold;">&#40;</span>Order<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@order</span>.<span style="color:#9900CC;">customer</span> = mock_model<span style="color:#006600; font-weight:bold;">&#40;</span>Customer<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <br />
&nbsp; &nbsp; it <span style="color:#996600;">&quot;should render successfully&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span> OrderMailer.<span style="color:#9900CC;">create_receipt</span><span style="color:#006600; font-weight:bold;">&#40;</span>@order<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">should_not</span> raise_error<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <br />
&nbsp; &nbsp; describe <span style="color:#996600;">&quot;rendered without error&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; before<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:each</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@mailer</span> = OrderMailer.<span style="color:#9900CC;">create_receipt</span><span style="color:#006600; font-weight:bold;">&#40;</span>@order<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should have an order number&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@mailer</span>.<span style="color:#9900CC;">body</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.order_number'</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@order</span>.<span style="color:#9900CC;">id</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should have order details&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@mailer</span>.<span style="color:#9900CC;">body</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;.order_details&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should have a billing address&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@mailer</span>.<span style="color:#9900CC;">body</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;.billing.address&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should have a delivery address&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@mailer</span>.<span style="color:#9900CC;">body</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;.delivery.address&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should have customer contact details&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@mailer</span>.<span style="color:#9900CC;">body</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#contact_details&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.landline'</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@order</span>.<span style="color:#9900CC;">customer</span>.<span style="color:#9900CC;">landline</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.mobile'</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@order</span>.<span style="color:#9900CC;">customer</span>.<span style="color:#9900CC;">mobile</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.email'</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0066ff; font-weight:bold;">@order</span>.<span style="color:#9900CC;">customer</span>.<span style="color:#9900CC;">email</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should have a list of items&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@mailer</span>.<span style="color:#9900CC;">body</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;.line_items&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should have totals&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@mailer</span>.<span style="color:#9900CC;">body</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;.totals&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.sub_total'</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> format_price<span style="color:#006600; font-weight:bold;">&#40;</span>@order.<span style="color:#9900CC;">sub_total</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.vat'</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> format_price<span style="color:#006600; font-weight:bold;">&#40;</span>@order.<span style="color:#9900CC;">vat</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.postage'</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> format_price<span style="color:#006600; font-weight:bold;">&#40;</span>@order.<span style="color:#9900CC;">postage</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.total'</span>, <span style="color:#ff3333; font-weight:bold;">:text</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> format_price<span style="color:#006600; font-weight:bold;">&#40;</span>@order.<span style="color:#9900CC;">total</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should deliver successfully&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span> OrderMailer.<span style="color:#9900CC;">deliver</span><span style="color:#006600; font-weight:bold;">&#40;</span>@mailer<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">should_not</span> raise_error<br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; describe <span style="color:#996600;">&quot;and delivered&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; it <span style="color:#996600;">&quot;should be added to the delivery queue&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span> OrderMailer.<span style="color:#9900CC;">deliver</span><span style="color:#006600; font-weight:bold;">&#40;</span>@mailer<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">should</span> change<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">ActionMailer::Base</span>.<span style="color:#9900CC;">deliveries</span>,:size<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">by</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>
<p>rendering the following output:</p>
<div id="attachment_176" class="wp-caption alignnone" style="width: 310px"><a href="http://robaldred.co.uk/wp-content/uploads/2009/12/Screen-shot-2009-12-14-at-11.37.58.png"><img src="http://robaldred.co.uk/wp-content/uploads/2009/12/Screen-shot-2009-12-14-at-11.37.58-300x262.png" alt="ActionMailer test output from textmate rspec bundle" title="ActionMailer test output from textmate rspec bundle" width="300" height="262" class="size-medium wp-image-176" /></a><p class="wp-caption-text">ActionMailer test output from textmate rspec bundle</p></div>
]]></content:encoded>
			<wfw:commentRss>http://robaldred.co.uk/2009/12/testing-actionmailer-models-with-rspec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cucumber pretty html formatter for textmate</title>
		<link>http://robaldred.co.uk/2009/08/cucumber-pretty-html-formatter-for-textmate/</link>
		<comments>http://robaldred.co.uk/2009/08/cucumber-pretty-html-formatter-for-textmate/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 11:23:48 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Mac Tips]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://robaldred.co.uk/?p=105</guid>
		<description><![CDATA[I&#8217;ve been using cucumber a lot recently along with the textmate bundle for it. The HTML output cucumber creates is fine, but not all that pretty. I&#8217;ve created a new formatter for cucumber to generate HTML enhanced with some javascript. My inspiration came from the textmate bundle for rspec. You can grap it off my [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://cukes.info" target="_blank">cucumber</a> a lot recently along with the textmate bundle for it.<br />
The HTML output cucumber creates is fine, but not all that pretty.</p>
<p>I&#8217;ve created a new formatter for cucumber to generate HTML enhanced with some javascript.<br />
My inspiration came from the textmate bundle for <a href="http://rspec.info" target="_blank">rspec</a>.</p>
<p>You can grap it off my <a href="http://github.com/raldred/cucumber_textmate/tree/master" target="_blank">github</a>.<br />
Here&#8217;s some screenshots:</p>

<a href='http://robaldred.co.uk/2009/08/cucumber-pretty-html-formatter-for-textmate/cucumber_failure-2/' title='cucumber_failure'><img width="150" height="150" src="http://robaldred.co.uk/wp-content/uploads/2009/08/cucumber_failure-150x150.jpg" class="attachment-thumbnail" alt="cucumber_failure" title="cucumber_failure" /></a>
<a href='http://robaldred.co.uk/2009/08/cucumber-pretty-html-formatter-for-textmate/cucumber_full-2/' title='cucumber_full'><img width="150" height="150" src="http://robaldred.co.uk/wp-content/uploads/2009/08/cucumber_full-150x150.jpg" class="attachment-thumbnail" alt="cucumber_full" title="cucumber_full" /></a>

<p><strong>UPDATE:</strong> I replaced the original html formatter in cucumber; as of 19th November my fork has been merged into Aslak&#8217;s cucumber/master upgrade to the cucumber 0.4.5 release.<br />
<a href="http://bit.ly/6beSgO">View the commit history</a></p>
]]></content:encoded>
			<wfw:commentRss>http://robaldred.co.uk/2009/08/cucumber-pretty-html-formatter-for-textmate/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Custom log files for your ruby on rails applications</title>
		<link>http://robaldred.co.uk/2009/01/custom-log-files-for-your-ruby-on-rails-applications/</link>
		<comments>http://robaldred.co.uk/2009/01/custom-log-files-for-your-ruby-on-rails-applications/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 15:38:47 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://robaldred.co.uk/?p=27</guid>
		<description><![CDATA[Sometimes logging is required but putting the messages in the Rails log isn’t the answer.For example you need to see the progress of customers through your order placement cycle, you ideally need this seperate to any other in a custom log file? There is a solution and it&#8217;s easy&#8230; To create an order progress log, [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes logging is required but putting the messages in the Rails log isn’t the answer.For example you need to see the progress of customers through your order placement cycle, you ideally need this seperate to any other in a custom log file?</p>
<p>There is a solution and it&#8217;s easy&#8230; To create an order progress log, simply create a new instance of <em>Logger</em> and pass it a <em>File</em> instance for your own logfile.<br />
Create a new model which inherits from <em>Logger</em></p>
<pre lang="ruby">class OrderProgressLogger &lt; Logger
  def format_message(severity, timestamp, progname, msg)
  "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
  end
end</pre>
<p>Create initializer called logs.rb in RAILS_ROOT/config/initializers with the following content:</p>
<pre lang="ruby">order_progress_logfile = File.open("#{RAILS_ROOT}/log/order_progress.log", 'a')
order_progress_logfile.sync = true
ORDER_PROGRESS_LOG = OrderProcessLogger.new(order_progress_logfile)</pre>
<p>After a restart of your mongrel or passenger <em>ORDER_PROGRESS_LOG</em> will be available through out your application.<br />
You log to it just as you would <em>DEFAULT_RAILS_LOGGER</em> like so&#8230;</p>
<pre lang="ruby">ORDER_PROGRESS_LOG.debug "Starting order placement method"
ORDER_PROGRESS_LOG.error "Could not create order record"</pre>
]]></content:encoded>
			<wfw:commentRss>http://robaldred.co.uk/2009/01/custom-log-files-for-your-ruby-on-rails-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
