<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Random Hacks: Tag Rails</title>
    <link>http://www.randomhacks.net/articles/tag/Rails?tag=Rails</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Technology and Other Fun Stuff</description>
    <item>
      <title>Selenium on Rails, Reloaded: Client-Side Tests in Ruby</title>
      <description>&lt;p&gt;Like most &lt;a href="http://www.rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt; developers, I write lots of test cases for
my models and controllers.  This lets me add new features quickly, without
worrying about breakage: My test cases act as a safety net, warning me
whenever existing code fails.&lt;/p&gt;

&lt;p&gt;Sadly, it&amp;#8217;s much harder to test client-side behavior.  Sure, you know your
controllers work, but what actually &lt;em&gt;happens&lt;/em&gt; if a user clicks the Submit
button?  We need a better way to test the system end-to-end, including the actual JavaScript and
web browsers.&lt;/p&gt;

&lt;p&gt;This article shows how to combine &lt;a href="http://www.openqa.org/selenium/"&gt;Selenium&lt;/a&gt;, &lt;a href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails"&gt;Selenium on Rails&lt;/a&gt;, and a
&lt;a href="/files/rselenese.diff"&gt;custom patch&lt;/a&gt; to write client-side test cases in Ruby:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;test&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;setup&lt;/span&gt; &lt;span class="comment"&gt;# Load fixtures&lt;/span&gt;
&lt;span class="ident"&gt;test&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;open&lt;/span&gt; &lt;span class="symbol"&gt;:controller&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;customer&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt;
          &lt;span class="symbol"&gt;:action&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;list&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;test&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;assert_title&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Customers&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;test&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;click&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;myLink&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:wait&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="constant"&gt;true&lt;/span&gt;
&lt;span class="ident"&gt;test&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;assert_title&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Customer: *&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;These test cases actually run in your browser, loading pages and clicking links just as a user would.  As the above example shows, you have full access to the Rails environment, including URL routing and configuration data.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.randomhacks.net/articles/2006/02/15/selenium-on-rails-reloaded"&gt;Read More&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 15 Feb 2006 08:06:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:55cb00a4-1da9-4bc4-9273-ca919579c458</guid>
      <author>Eric Kidd</author>
      <link>http://www.randomhacks.net/articles/2006/02/15/selenium-on-rails-reloaded</link>
      <category>Rails</category>
      <category>Hacks</category>
      <category>Selenium</category>
      <category>testing</category>
      <trackback:ping>http://www.randomhacks.net/articles/trackback/171</trackback:ping>
    </item>
    <item>
      <title>Moving a blog to Typo</title>
      <description>&lt;p&gt;This weekend, I moved Random Hacks to &lt;a href="http://typo.leetsoft.com/trac/"&gt;Typo&lt;/a&gt;, a nifty Rails-based blogging system. Here&amp;#8217;s what I did:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set up my Mac for Rails development&lt;/li&gt;
&lt;li&gt;Pointed Typo at MySQL&lt;/li&gt;
&lt;li&gt;Created a custom theme&lt;/li&gt;
&lt;li&gt;Wrote an article importer&lt;/li&gt;
&lt;li&gt;Routed my old URLs to new locations&lt;/li&gt;
&lt;li&gt;&lt;a href="http://randomhacks.net/articles/2005/11/13/typo-sidebars-recent-comments-and-tagged-articles"&gt;Wrote some custom sidebars&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Configured Debian&amp;#8217;s mod_fcgid&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now for the gruesome details.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.randomhacks.net/articles/2005/11/15/moving-a-blog-to-typo"&gt;Read More&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 15 Nov 2005 22:13:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:e3f3c54b-6034-48f2-8949-d5e37a76558d</guid>
      <author>Eric Kidd</author>
      <link>http://www.randomhacks.net/articles/2005/11/15/moving-a-blog-to-typo</link>
      <category>Rails</category>
      <category>Typo</category>
      <category>Ruby</category>
      <trackback:ping>http://www.randomhacks.net/articles/trackback/76</trackback:ping>
    </item>
    <item>
      <title>Typo sidebars: Recent Comments and Tagged Articles</title>
      <description>&lt;p&gt;Here's two new plugins for &lt;a href="http://typo.leetsoft.com/trac/"&gt;Typo&lt;/a&gt;, the cool Rails-based blogging software. The first shows a &lt;a href="/files/recent_comments_sidebar.zip" title="Recent Comments Plugin"&gt;list of recent comments&lt;/a&gt;. The second shows &lt;a href="/files/tagged_articles_sidebar.zip" title="Tagged Articles Plugin"&gt;articles with a specific tag&lt;/a&gt;. (I use it to implement the "Recommended Reading" list in my sidebar.)&lt;/p&gt;

&lt;p&gt;To install the plugins, simply unzip them in your Typo root directory, restart Typo, and take a look at the "Sidebar" tab in the admin screen.&lt;/p&gt;

&lt;p&gt;These plugins were unbelievably simple to write. If you'd like to see how they work, keep reading.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.randomhacks.net/articles/2005/11/13/typo-sidebars-recent-comments-and-tagged-articles"&gt;Read More&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 13 Nov 2005 21:04:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:67f6b627-8a35-4c65-a1e2-1a0350e347aa</guid>
      <author>Eric Kidd</author>
      <link>http://www.randomhacks.net/articles/2005/11/13/typo-sidebars-recent-comments-and-tagged-articles</link>
      <category>Typo</category>
      <category>Rails</category>
      <category>Hacks</category>
      <trackback:ping>http://www.randomhacks.net/articles/trackback/74</trackback:ping>
    </item>
    <item>
      <title>Random Hacks is back online</title>
      <description>    &lt;p&gt;I just recovered the contents of this site after a two-year hiatus.
    I'm going to try to dig up some other old stuff, too.&lt;/p&gt;

    &lt;p&gt;I should really rebuild this whole site using Ruby on Rails and some
    Ajax goodness.  But that's going to have to wait until I ship some
    software at work and take care of other personal projects.&lt;/p&gt;</description>
      <pubDate>Tue, 11 Oct 2005 00:00:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:cf79983a-dc3f-43d8-9522-b840329faef7</guid>
      <author>Eric</author>
      <link>http://www.randomhacks.net/articles/2005/10/11/back-online</link>
      <category>Ruby</category>
      <category>Rails</category>
      <trackback:ping>http://www.randomhacks.net/articles/trackback/71</trackback:ping>
    </item>
  </channel>
</rss>
