<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">RubyTester Blog</title>
  <subtitle>web applications testing in ruby</subtitle>
  <link href="http://rubytester.com/feed/atom.xml" rel="self" />
  <link href="http://rubytester.com/" />
  <updated>2010-08-30T22:49:56-05:00</updated>
  <author>
    <name>marekj</name>
    <email>rssfeeds@marekj.otherinbox.com</email>
  </author>
  <id>http://rubytester.com/</id>
  
  <entry>
    <title type="html">Research on Usecase and Userstories</title>
    <link href="http://rubytester.com//blog/2009/08/24/research-on-usecase-and-userstories.html" />
    <id>tag:rubytester.com,2009-08-24:1251128144</id>
    <published>2009-08-24T10:35:44-05:00</published>
    <updated>2009-08-24T10:35:44-05:00</updated>
    <content type="html">&lt;p&gt;DRAFT&lt;/p&gt;
&lt;h3&gt;To distinguish &amp;#8216;Simulation&amp;#8217; from &amp;#8216;Verification&amp;#8217; strategies in acceptance testing code.&lt;/h3&gt;
&lt;p&gt;I chanced upon a compendium of XP 2004 papers and there I&amp;#8217;ve found a paper by Johan Andersson and Geoff Bache &lt;a href=&quot;http://springerlink.metapress.com/content/nl1749aayqdfhlqy/?p=5d1e90c17c4b4e92ab301dc1106ce9c1&amp;amp;pi=0&quot;&gt;Adventures in GUI Acceptance Testing&lt;/a&gt;  I love the concept of &amp;#8216;simulation&amp;#8217; and &amp;#8216;verification&amp;#8217; as two different strategies. &amp;#8216;Simulation&amp;#8217; is all about driving the GUI and &amp;#8216;verification&amp;#8217; is all about assertions.&lt;/p&gt;
&lt;p&gt;This is how I have been structuring my GUI Acceptance Testing with Watir. I refactor all the code that &amp;#8216;simulates&amp;#8217; user&amp;#8217;s scenarios into code I call UseCase and then I write test code (Rspec or TestUnit) code that is responsible for &amp;#8216;verification&amp;#8217;. This separation allows me to drive GUI to setup context in which &amp;#8216;checking&amp;#8217; and &amp;#8216;verification&amp;#8217; occurs. Since my usecase is a model driven by examples (notetoself: find article on Model &amp;#8594; Example &amp;#8594; Model feedback cycle to refine model by examples).&lt;/p&gt;
&lt;p&gt;Unfortunately that XP 2004 paper is &amp;#8220;behind the moneywall&amp;#8221; on Springer but &lt;a href=&quot;http://texttest.carmen.se/index.php?page=publications&quot;&gt;you can find the docs here&lt;/a&gt; (and here is a &lt;a href=&quot;http://books.google.com/books?id=Zr4mJLaCIQAC&amp;amp;lpg=PA180&amp;amp;ots=Go1Y-DrL5k&amp;amp;dq=Johan%20Andersson%20%20Geoff%20Bache&amp;amp;pg=PA180#v=onepage&amp;amp;q=Johan%20Andersson%20%20Geoff%20Bache&amp;amp;f=false&quot;&gt;googlebook text&lt;/a&gt;) &lt;br /&gt;
In XP 2005 they continue with &lt;a href=&quot;http://www.springerlink.com/content/mef1w2bydp8mvuxj/&quot;&gt;Further Adventures in Acceptance Testing&lt;/a&gt; talking about xUseCase).&lt;/p&gt;
&lt;p&gt;The concepts from these guys are interesting. It seems I have been doing something similar in my acceptance testing approach and it is really great to read some feedback on such an approach.&lt;/p&gt;
&lt;p&gt;The main idea I see here is the distinction between Usage Simulation code and Test Verification code. The Usage Simulation code is written in a customer&amp;#8217;s language, a domain language customer operates to produce results in that domain.&lt;/p&gt;
&lt;h4&gt;Usage-First design strategy&lt;/h4&gt;
&lt;p&gt;There is this nice strategy for writing code from TDD. You &amp;#8220;write the code you wish you had&amp;#8221;, you pretend that it&amp;#8217;s there, you write how a client uses something, and then you write that something. This is how I write UseCase scenarios in code. It&amp;#8217;s in a style of Red, Green, Refactor.&lt;/p&gt;
&lt;p&gt;Very important point. UPDATE: Bret Pettichord mentioned at LSRC that we could call this &amp;#8220;Subject Oriented Development&amp;#8221;. I am not sure how that fits but again, important point becuase in BDD we are designing behaviour of objects but in Subject Oriented Development you design system behaving according to the Subject. (more on that at some point)&lt;/p&gt;
&lt;p&gt;OK, so a couple of quotes from the those guys&amp;#8217; papers.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Acceptance Tests are entirely independent of design, because they do not interact with it. This means they form a solid rock to lean on when doing refactoring (&lt;i&gt;of the design&lt;/i&gt;, emp. added)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Unit Test is a design statement. Acceptance Test is a statement of a correct behaviour of the system. Unit Tests act as design documentation, acceptance tests document system behaviour. (paraphrased)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Why UseCase and not a UserStory&lt;/h3&gt;
&lt;p&gt;Read Mike Cohn&amp;#8217;s paper on &lt;a href=&quot;http://www.mountaingoatsoftware.com/articles/27-advantages-of-user-stories-for-requirements&quot;&gt;Advantages of User Stories for Requirements October 2004 published in InformIT Network&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;He explains how UserStories differ from UseCases. My takeaway is UserStories are used in BDD but I would use UseCases in Subject Oriented Testing becuase it follows Example &amp;gt; Model &amp;gt; Example cycle and has persistence of End to End goal seeking.&lt;/p&gt;
&lt;p&gt;These are some good distinctions I think. Any feedback?&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title type="html">Moving to Vim on Windows and Ubuntu</title>
    <link href="http://rubytester.com//blog/2009/09/13/moving-to-vim-on-windows-and-ubuntu.html" />
    <id>tag:rubytester.com,2009-09-13:1252875815</id>
    <published>2009-09-13T16:03:35-05:00</published>
    <updated>2009-09-13T16:03:35-05:00</updated>
    <content type="html">&lt;h3&gt;Getting to know Vim. Nobody has ever told me how simple it is.&lt;/h3&gt;
&lt;p&gt;The first person I&amp;#8217;ve ever met who uses vim was Charley Baker. He actually showed me Vim running on his Mac at AWTA2009 in Austin.&lt;br /&gt;
It&amp;#8217;s funny that as a tester working with developers for many years I have never met anyone working with Vim and most of the &amp;#8216;reputation&amp;#8217; I hear about vim is that &amp;#8217;it&amp;#8217;s very hard&amp;#8217; to learn to &amp;#8216;understand&amp;#8217; it and to learn to &amp;#8216;operate&amp;#8217; it.&lt;/p&gt;
&lt;p&gt;So I asked some questions and poked around and found out it&amp;#8217;s not so hard. It is a great editor for a tester. It seems there is no &amp;#8216;magic&amp;#8217;. There is only &amp;#8216;practice&amp;#8217; just like everthing else. Well, easier said than done of course.&lt;/p&gt;
&lt;p&gt;I am writing this in &amp;#8216;Gvim&amp;#8217; on Ubuntu (vim-genome package, no sure what the diff is with gtk package). I set up &amp;#8216;Gvim&amp;#8217; also on my WinXP machine. The first thing conceptually I had to understand was the Vim is a &amp;#8216;tool for working with text&amp;#8217; environment, you &amp;#8216;operate&amp;#8217; on text in vim. It&amp;#8217;s kind of nice that vim is all about making &amp;#8216;you operate&amp;#8217; on text, I mean really &amp;#8216;you&amp;#8217;. I am just starting to learn. The two things to understand are config files _vimrc, _gvimrc and vimfiles on windows and for ubutntu the .vim dir and .vimrc, .gvimrc files. They are mostly the same. (FYI plenty of resources on github)&lt;/p&gt;
&lt;h4&gt;Gvim on Windows&lt;/h4&gt;
&lt;p&gt;I downloaded Gvim on Windows and installed it into c:\Programs\vim. In Windows the &amp;#8216;~&amp;#8217; home dir is &lt;span&gt;USERPROFILE&lt;/span&gt; so that&amp;#8217;s where I put my &amp;#8216;_vimrc&amp;#8217; and &amp;#8216;_gvimrc&amp;#8217;. The _gvimrc file is read by gvim only, not by vim (correct?). If I want to use vim in a commandline I would not need _gvimrc (still learnig on this one). The next thing was to create ~/vimfiles/colors/ and put in there a herald.vim file. Nice colorscheme. There are more. Many many more.&lt;/p&gt;
&lt;p&gt;On Ubuntu the similar thing was to create some settings in ~/.vimrc and ~/.gvimrc which are equivalent to _vimrc and _gvimrc on windows and ~/vim/ directory where you keep colors and plugins; equivalent to ~/vimfiles on windows.&lt;/p&gt;
&lt;p&gt;Gvim out of the box is ugly, maybe this is why most people give up on it in the first few minutes. I use Bitstream Vera Sans Mono font. (been using this font for ever it seems).&lt;/p&gt;
&lt;p&gt;I think I am on my way to give up notepad++, jedit, scite and stick with vim. I am glad I&amp;#8217;ve just decided to take a day and poke around to see if I can &amp;#8216;get vim&amp;#8217; on my own. But really I am quite surprised that nobody has showed me &amp;#8216;vim&amp;#8217; before.&lt;/p&gt;
&lt;p&gt;As to IDE I am sticking with Netbeans for now but for all text stuff I am looking forward to learning more &amp;#8216;vim&amp;#8217; hacks.&lt;/p&gt;
&lt;p&gt;P.S. Well, this post is a bit lame. I am just practicing on vim here.&lt;/p&gt;

&lt;p&gt;some para text&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title type="html">Watir Semantic Shortcuts to Elements</title>
    <link href="http://rubytester.com//blog/2009/07/29/watir-semantic-shortcuts-to-elements.html" />
    <id>tag:rubytester.com,2009-07-29:1248877709</id>
    <published>2009-07-29T09:28:29-05:00</published>
    <updated>2009-07-29T09:28:29-05:00</updated>
    <content type="html">&lt;h3&gt;Accessing Watir elements with semantic shortcuts&lt;/h3&gt;
&lt;p&gt;UPDATE: remove module_eval wrapper from self.face method in the last example. it was not needed.&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s say you have a text_field element named &amp;#8220;last_name&amp;#8221; you want to access on a page and the text_field is inside a div container with id &amp;#8216;person&amp;#8217;. You may write something like this in Watir API:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;browser.div(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;c&quot;&gt;# or something like this if you don't care about text_field contained by the div&lt;/span&gt;
browser.text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;c&quot;&gt;# but for our purpose we'll stick with the div containing text_field scenario&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And what if you want to decouple the GUI specific implementation and replace it with a shortcut that refers to that text_field element? After all when user is visiting a page she does not fill the text_field with a :name, &amp;#8216;last_name&amp;#8217; or &amp;#8216;lst_nme&amp;#8217; or &amp;#8216;lnm&amp;#8217; . She enters her &amp;#8216;last name&amp;#8217; on the &amp;#8216;page&amp;#8217;. So you can call that page object &lt;code&gt;last_name&lt;/code&gt; (in Ruby speak). Then you would need to provide some kind of translation between the page object name and the DOM name. But why even bother with that? There are at least 2 payoffs; 1) you write tests that in a language users speak which brings clarity and intention revealing behavior and 2) over time maintanance is minimized; contained to the methods that define page elements and not to our tests.&lt;/p&gt;
&lt;h3&gt;How to build the accessors to dom elements&lt;/h3&gt;
&lt;p&gt;The simplest way to decouple GUI from your tests is to wrap the code that accesses the DOM element with a friendly domain specific name.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;last_name&lt;/span&gt;
  browser.div(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# and call it with last_name method&lt;/span&gt;
last_name.set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Johnson&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;But if you have 10 or 20 or 100 of those elements there has to be a better way. You can define a dynamic method that creates the wrapper methods for you. Maybe like this.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;access_to &lt;span class=&quot;sy&quot;&gt;:last_name&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
  browser.div(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;access_to&lt;/code&gt; method defines &lt;code&gt;last_name&lt;/code&gt; method or any other method for you. (on that later). As you can see there is not much difference between the def wrapper method and the dynamic generator. However in a dynamic generator you can set the receiver of the block, maybe access logging and provide call back methods or some other special code. The dynamic generator is your factory of shortcuts to elements.&lt;/p&gt;
&lt;p&gt;For example one of the things you can take care of in dynamic method creation is to provide the &lt;code&gt;browser&lt;/code&gt; as the receiver of the block, then you shorten your definition:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# browser as receiver will be provided for you&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# notice the browser method is not referenced here&lt;/span&gt;
access_to(&lt;span class=&quot;sy&quot;&gt;:last_name&lt;/span&gt;) { text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;) }
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This dynamic method generation mechanism is used by many Watir libraries (see &lt;a href=&quot;http://github.com/scudco/taza&quot;&gt;Taza&lt;/a&gt; element and &lt;a href=&quot;http://github.com/bret/watircraft&quot;&gt;Watircraft&lt;/a&gt; field and &lt;a href=&quot;http://github.com/marekj/watirloo&quot;&gt;Watirloo&lt;/a&gt; face methods, or &lt;a href=&quot;http://github.com/hmcgowan/rasta&quot;&gt;Rasta&lt;/a&gt; keyword). It allows you to create a semantic page object name, keyword, simply a friendly name to access an element on a page. The semantic names conform to the way a user would talk about objects on the page so their names are customer facing and are used to describe tests. The method definitions are developer facing and they wire the semantic name to an element in the DOM. This is a kind of a facade or adapter mechanism (Look up Design Patterns Facade and Adapter) And again the benefits are test clarity and minimized maintenance.&lt;/p&gt;
&lt;p&gt;If you still wonder how this may work here is a scenario example: imagine you have many tests that use the call to &lt;code&gt;last_name&lt;/code&gt; but at some point the text_field definition changes, maybe a :name attribute is changed or it&amp;#8217;s not a text_field any more, maybe a select_list of last names. Now you don&amp;#8217;t have to go and find all the instances of a text_field(:name, &amp;#8220;last_name&amp;#8221;). All you have to do is update the definition stored by the facade method rather than in all the places the text_field is used as implementation. In this case the &lt;code&gt;last_name&lt;/code&gt; method is used as a &amp;#8216;stand in&amp;#8217; for that text_field or select_list or whatever elemtn. The &lt;code&gt;last_name&lt;/code&gt; is a facade method, a face to interact with.&lt;/p&gt;
&lt;h3&gt;Page Object as a shortcut to a collection of elements.&lt;/h3&gt;
&lt;p&gt;What if you have two text_fields on a page like this.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;
text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Now the page is asking to fill the last name for two people. Are you going to have to define the &lt;code&gt;last_name0&lt;/code&gt; and &lt;code&gt;last_name1&lt;/code&gt; access_to method? No, we can treat the text_fields sharing similar naming pattern as a collection.&lt;/p&gt;
&lt;p&gt;We can maybe do something like this&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;access_to &lt;span class=&quot;sy&quot;&gt;:last_name&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |nbr|
  text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;nbr&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#pass the counter to alter name attribute&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# and then you can access &lt;/span&gt;
last_name(&lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;).set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Johnson&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
last_name(&lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;).set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Kowalski&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
last_name(&lt;span class=&quot;i&quot;&gt;42&lt;/span&gt;).set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Adams&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This is an example of how an access_to type method can be made to accept attributes that then alter the pattern of access in a collection.&lt;/p&gt;
&lt;h3&gt;Watirloo with face method for making semantic page objects&lt;/h3&gt;
&lt;p&gt;In &lt;a href=&quot;http://github.com/marekj/watirloo&quot;&gt;Watirloo&lt;/a&gt; I call the method that creates semantic page objects the &lt;code&gt;face&lt;/code&gt; method because it helps to make an &lt;code&gt;interface&lt;/code&gt; to some element on the page and &lt;code&gt;face&lt;/code&gt; is a sort of a facade, and invokes some semantic personalization. It&amp;#8217;s fun to write tests where you define &lt;code&gt;faces&lt;/code&gt; you talk to in your tests.&lt;/p&gt;
&lt;p&gt;Here are some examples of how you create faces in watirloo that map to some cryptic DOM definitions for address form&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;face(&lt;span class=&quot;sy&quot;&gt;:zip&lt;/span&gt;) { text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;zipCd&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)}
face(&lt;span class=&quot;sy&quot;&gt;:street&lt;/span&gt;) { text_field(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;adrStr1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;}
face(&lt;span class=&quot;sy&quot;&gt;:state&lt;/span&gt;) { select_list(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;stCd&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;}
&lt;span class=&quot;c&quot;&gt;# now you can call them in your test&lt;/span&gt;
zip.set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;75230&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
street.set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Walnut Street&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
state.set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;TX&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;What I haven&amp;#8217;t mentioned is how the face method defines a receiver of the block given by a facename. When you call &lt;code&gt;zip&lt;/code&gt; or &lt;code&gt;street&lt;/code&gt; method who receives the call? Well the current &amp;#8216;self&amp;#8217; receives the call, it can be rspec group or TestCase class or any other object that contains the face definition. But who receives the call of the body of the method? Here is an example where &lt;code&gt;browser&lt;/code&gt; is the receiver of the block&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# defines access to element based on its facename&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;face&lt;/span&gt;(facename, *args, &amp;amp;block)
  define_method(facename) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |*args|
    browser.instance_exec(*args, &amp;amp;block)
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The main part is &lt;code&gt;browser.instance_exec&lt;/code&gt; It&amp;#8217;s just like instance_eval but accepts arguments passed to it (as seen in the &lt;code&gt;last_name(1)&lt;/code&gt; example).&lt;/p&gt;
&lt;p&gt;In the above face definition I assume that all interfaces talk to the browser directly as the page container. &lt;code&gt;browser&lt;/code&gt; is the receiver of the blocks defined by &lt;code&gt;face&lt;/code&gt; method and here implicitly provided by the face method. If it wasn&amp;#8217;t then we would need to provide it somehow in the definition.&lt;/p&gt;
&lt;p&gt;Here are two different examples:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# browser as receiver assumed implicitly and provided by face method&lt;/span&gt;
face(&lt;span class=&quot;sy&quot;&gt;:person&lt;/span&gt;) { div(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;) }

&lt;span class=&quot;c&quot;&gt;# browser provided explicitly. The face method assumes the browser method exists in the receiver&lt;/span&gt;
face(&lt;span class=&quot;sy&quot;&gt;:person&lt;/span&gt;) { browser.div(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;) }

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Which is better? Not sure, I think I&amp;#8217;ll go with the first choice for Watirloo face definition treating the browser (or the root document if frames are present) as implicit receiver for facename blocks.&lt;/p&gt;
&lt;h3&gt;Shifting receiver with chaining.&lt;/h3&gt;
&lt;p&gt;But what if you want to specify that the text_field is inside a form or a div and you want to provide a specific access to that particular location. Maybe you would like to write you tests with that containment in mind:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# instead of &lt;/span&gt;
browser.div(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)

&lt;span class=&quot;c&quot;&gt;# you wish you could write like this shortcut&lt;/span&gt;
browser.person.last_name(&lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;)

&lt;span class=&quot;c&quot;&gt;# and you imagine these definitions that would support it&lt;/span&gt;
face(&lt;span class=&quot;sy&quot;&gt;:person&lt;/span&gt;) {div(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)}
face(&lt;span class=&quot;sy&quot;&gt;:last&lt;/span&gt;) { |nbr| text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;nbr&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)}

&lt;span class=&quot;c&quot;&gt;# but that will NOT WORK out of the box&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Will not work! No! No! No! Well, maybe&amp;#8230; but it requires some manipulation of &amp;#8216;self&amp;#8217; of the returning objects as you chain them.&lt;/p&gt;
&lt;p&gt;The Watir API is beautiful in this regard. The &amp;#8216;div&amp;#8217; method returns the reference to DOM where the &amp;#8216;div&amp;#8217; is located and you can call the text_field on it so the locator will find that element contained in the &amp;#8216;div&amp;#8217;.&lt;/p&gt;
&lt;p&gt;The secret in Watir code is something like the factory methods used.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;text_field&lt;/span&gt;(how, what)
  &lt;span class=&quot;co&quot;&gt;TextField&lt;/span&gt;.new(&lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;, how, what)
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This really is the genius of Watir API design IMHO because text_field method instantiates TextField class and passes it the context of a container. Then the TextField calls set_container to narrow the scope. Very nice indeed.&lt;/p&gt;
&lt;p&gt;The problem with page objects chaining is that we need to manage the scope of containment. Simply doing the chaining because it looks nice and convenient &lt;code&gt;browser.person.last_name(0)&lt;/code&gt; will not work unless the call to &amp;#8216;person&amp;#8217; method returns the receiver that also has last() method defined. If you are lost at this point don&amp;#8217;t worry and read on.&lt;/p&gt;
&lt;p&gt;In Watir API &lt;code&gt;browser&lt;/code&gt; returns an object that responds to methods like &amp;#8216;div&amp;#8217; or &amp;#8216;text_field&amp;#8217; and in turn the &amp;#8216;div&amp;#8217; method returns an object that responds to &amp;#8216;div&amp;#8217; or &amp;#8216;text_field&amp;#8217; methods as well. With each method you &amp;#8216;chain&amp;#8217; you narrow the scope of the DOM tree where a particular element is contained. Watir element methods take care of establishing the receiver implicitly. That&amp;#8217;s what makes Watir API so nice. Pleasing to use and hard working behind the scenes.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I may be exaggerating a bit but this is why I think Watir is underappreciated in Ruby community because it mainly targets Windows and Internet Explorer  but that is precisely the reason why Watir is still &amp;#8216;undiscovered&amp;#8217; in the Enterprise browser testing where high cost commercial solutions win because of marketing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Back to our topic: In building some kind of a abstraction layer that decouples implementation from page objects, known sometimes as GUI mapping, we would need to manage that scope in a &lt;code&gt;face&lt;/code&gt; definition.&lt;/p&gt;
&lt;h3&gt;Which Solution to Implement?&lt;/h3&gt;
&lt;p&gt;Solution (1) is to define faces with known receiver as &lt;code&gt;page&lt;/code&gt; the root element (either a browser or a frame) and forget the method chaining. Any facename like &lt;code&gt;last_name&lt;/code&gt; method would be made to call on &lt;code&gt;page&lt;/code&gt; but &lt;code&gt;person.last&lt;/code&gt; chaining would not work because &lt;code&gt;person&lt;/code&gt; returns Watir &amp;#8216;div&amp;#8217; object which does not respond_to? &lt;code&gt;last&lt;/code&gt;. So if you want fined grained control just drop to the Watir API and deal with DOM implementation that way. This is my preferred method (do not obscure Watir API, work with it, do not hide it).&lt;/p&gt;
&lt;p&gt;Solution (2) is to allow for method chaining that always has to start with browser or frame, a &lt;code&gt;page&lt;/code&gt; method that returns the root document to talk to. In this case we can have &lt;code&gt;page.person.last&lt;/code&gt; or &lt;code&gt;page.last&lt;/code&gt; where &lt;code&gt;page&lt;/code&gt; is the receiver of defined page objects. Then if you want to drop to Watir API you can use &lt;code&gt;browser.div(:id, 'person')&lt;/code&gt; as instead of &lt;code&gt;page.person&lt;/code&gt; (this has some potential)&lt;/p&gt;
&lt;p&gt;Here are some code acrobatics to accomplish this.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;
&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;face&lt;/span&gt;(facename, *args, &amp;amp;block)
  define_method(facename) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |*args|
    &lt;span class=&quot;iv&quot;&gt;@container&lt;/span&gt; = &lt;span class=&quot;iv&quot;&gt;@container&lt;/span&gt;.instance_exec(*args, &amp;amp;block)
    &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#return receiver to chain to next page_object&lt;/span&gt;
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;page&lt;/span&gt;
  &lt;span class=&quot;iv&quot;&gt;@container&lt;/span&gt; = browser
  &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#chain to next page_object&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# now having this you can define&lt;/span&gt;
face(&lt;span class=&quot;sy&quot;&gt;:last_name&lt;/span&gt;) {|nbr| text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;,&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;last_name&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;nbr&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)}
face(&lt;span class=&quot;sy&quot;&gt;:first_name&lt;/span&gt;) {|nbr| text_field(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;,&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;first_name&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;nbr&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)}
face(&lt;span class=&quot;sy&quot;&gt;:person&lt;/span&gt;) { div(&lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;personPanel&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) }

&lt;span class=&quot;c&quot;&gt;# and use in your client&lt;/span&gt;
page.person.first_name(&lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;).set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Kurt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
page.person.last_name(&lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;).set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Vonnegut&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# or&lt;/span&gt;

page.first_name(&lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;).set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Kurt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
page.last_name(&lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;).set &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Vonnegut&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Now you can access &lt;code&gt;last_name()&lt;/code&gt; explicitly contained by &lt;code&gt;person&lt;/code&gt; or just contained by &lt;code&gt;page&lt;/code&gt; which is equivalent to &lt;code&gt;browser&lt;/code&gt; unless you want to redefine it to point to a frame.&lt;/p&gt;
&lt;p&gt;The new issue with this is that every time you call a &lt;code&gt;facename&lt;/code&gt; method it returns &amp;#8216;self&amp;#8217; in order for chaining to work. So if you want to call .set &amp;#8220;value&amp;#8221; method you either have to provide an adapter or handle it with method_missing like this;&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# adapter to call Watir Element set.&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;set&lt;/span&gt;
  &lt;span class=&quot;iv&quot;&gt;@container&lt;/span&gt;.set
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;method_missing&lt;/span&gt;(method, *args)
  &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;iv&quot;&gt;@container&lt;/span&gt;.respond_to?(method)
    &lt;span class=&quot;iv&quot;&gt;@container&lt;/span&gt;.send method, *args
  &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;
    raise &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Something went wrong&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Another solution (3) would be to have a factory method that returns Face.new(container, facename, *args, &amp;amp;block)) and encapuslate this setting of container in the similary way Watir works. (or maybe just add Face class subclassed from Watir::Element to get that management for free?)&lt;/p&gt;
&lt;p&gt;Either solution depends on your page objects need. I can see that chaining solution can give me more flexibility in situation where there is a text_field with the same name in two or more different forms but it adds some mental acrobatics to build this.&lt;/p&gt;
&lt;p&gt;On the other hand the &lt;code&gt;page.instance_exec&lt;/code&gt; makes sure every element is anchored to the receiver the page defines and be happy with that. Well, we&amp;#8217;ll see. If you have any ideas let me know. For now Watirloo defines the Solution 1 in gem 0.0.6. In gem 0.0.5 you had to provide the receiver yourself in face definitions.&lt;/p&gt;
&lt;p&gt;Another wild idea is to provide plain hash with array for definitions &lt;code&gt;face :facename =&amp;gt; [watir_method, how , what]&lt;/code&gt; so you can store the definitions as data in some files and use module_eval on heredoc maybe another post for that.&lt;/p&gt;
&lt;p&gt;Any feedback on which solution makes sense to you? Thanks.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title type="html">My First Fake Post With Webby</title>
    <link href="http://rubytester.com//blog/2009/04/13/my-first-fake-post-with-webby.html" />
    <id>tag:rubytester.com,2009-04-13:1239639994</id>
    <published>2009-04-13T11:26:34-05:00</published>
    <updated>2009-04-13T11:26:34-05:00</updated>
    <content type="html">&lt;p&gt;Welcome to Webby installation. This first post is in textile.&lt;/p&gt;
&lt;p&gt;Running command &lt;code&gt;webby-gen blog rubytester_blog&lt;/code&gt; creates a rubytester_blog directory with all the scaffolding necessary for the webby site. The &lt;code&gt;content&lt;/code&gt; directory has only &lt;code&gt;css/blueprint&lt;/code&gt; and there is no &lt;code&gt;blog&lt;/code&gt; directory. At this point run webby with -T switch to see what tasks are available to move forward.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; webby -&lt;span class=&quot;co&quot;&gt;T&lt;/span&gt;
webby autobuild          &lt;span class=&quot;c&quot;&gt;# Continuously build the website&lt;/span&gt;
webby blog&lt;span class=&quot;sy&quot;&gt;:post&lt;/span&gt;          &lt;span class=&quot;c&quot;&gt;# Create a new blog post&lt;/span&gt;
webby build              &lt;span class=&quot;c&quot;&gt;# Build the website&lt;/span&gt;
webby clobber            &lt;span class=&quot;c&quot;&gt;# Delete the website&lt;/span&gt;
webby create&lt;span class=&quot;sy&quot;&gt;:atom_feed&lt;/span&gt;   &lt;span class=&quot;c&quot;&gt;# Create a new atom_feed&lt;/span&gt;
webby deploy             &lt;span class=&quot;c&quot;&gt;# deploy the site to the webserver&lt;/span&gt;
webby deploy&lt;span class=&quot;sy&quot;&gt;:rsync&lt;/span&gt;       &lt;span class=&quot;c&quot;&gt;# Deploy to the server using rsync&lt;/span&gt;
webby deploy&lt;span class=&quot;sy&quot;&gt;:ssh&lt;/span&gt;         &lt;span class=&quot;c&quot;&gt;# Deploy to the server using ssh&lt;/span&gt;
webby rebuild            &lt;span class=&quot;c&quot;&gt;# Rebuild the website&lt;/span&gt;
webby validate           &lt;span class=&quot;c&quot;&gt;# Alias to validate:internal&lt;/span&gt;
webby validate&lt;span class=&quot;sy&quot;&gt;:external&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;# Validate hyperlinks (include external sites)&lt;/span&gt;
webby validate&lt;span class=&quot;sy&quot;&gt;:internal&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;# Validate hyperlinks (exclude external sites)&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;h2&gt;Let&amp;#8217;s make this blog post.&lt;/h2&gt;
&lt;p&gt;Running the following command creates 3 files.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt; webby blog&lt;span class=&quot;sy&quot;&gt;:post&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;my first fake post with webby&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
content/blog/&lt;span class=&quot;i&quot;&gt;2009&lt;/span&gt;/&lt;span class=&quot;i&quot;&gt;04&lt;/span&gt;/&lt;span class=&quot;i&quot;&gt;13&lt;/span&gt;/my-first-fake-post-with-webby.txt
content/blog/&lt;span class=&quot;i&quot;&gt;2009&lt;/span&gt;/&lt;span class=&quot;i&quot;&gt;04&lt;/span&gt;/index.txt
content/blog/&lt;span class=&quot;i&quot;&gt;2009&lt;/span&gt;/index.txt
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This blog post file. this month index.txt file and this year index file. OK, so far so good. I understand the basic pattern (I think)&lt;/p&gt;
&lt;p&gt;The default content for this blog was taken from &lt;code&gt;/templates/blog/post.erb&lt;/code&gt; the month index from &lt;code&gt;month.erb&lt;/code&gt; and 2009/index.txt from &lt;code&gt;year.erb&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;so let&amp;#8217;s do &lt;code&gt;webby build&lt;/code&gt; task to generate a site&lt;/p&gt;
&lt;h2&gt;Generated SITE&lt;/h2&gt;
&lt;p&gt;I will refer to the webby site as SITE. I think webby itself refers to it as SITE anyway.&lt;/p&gt;
&lt;p&gt;So to view the new SITE statically I encounter a problem. All the css is broken because looking at &lt;code&gt;layout/default.txt&lt;/code&gt; all the href begins with &lt;code&gt;/css/bla/bla&lt;/code&gt;. I can fix it be changing it all to &lt;code&gt;../css/bla/bla&lt;/code&gt; or I can use the server provided by webby by running &lt;code&gt;webby autobuild&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s do &amp;#8216;autobuild&amp;#8217;. It uses &amp;#8216;directory_watcher&amp;#8217; to scan for changes and automatically builds your site for you when it encouters a fresh page. That is an awesome feature. I think I&amp;#8217;ll stick with that. My local site is now available at &lt;code&gt;http://localhost:4331/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Next problem to overcome is lack of site index file. I&amp;#8217;ll build it next and display a lis of posts.&lt;/p&gt;
&lt;h2&gt;page meta&lt;/h2&gt;
&lt;p&gt;Before building a home page let&amp;#8217;s take a look at the page meta. this page got created with the yaml section that holds metadata for the page. Now I wonder about options becuse I have seen keys like &lt;code&gt;layout: index&lt;/code&gt; and &lt;code&gt;dirty: true&lt;/code&gt; so I wonder where I can quickly find that info hm&amp;#8230; dubi dam dam dubi dam&amp;#8230; OK&amp;#8230; &lt;code&gt;Webby::Resources::MetaFile&lt;/code&gt; class has some mention of it. I see I can use &lt;code&gt;tags outlines slides&lt;/code&gt; and other things. This will be worth exploring later. First I got to make some sensible layout and a index home page file.&lt;/p&gt;
&lt;h2&gt;building a home page&lt;/h2&gt;
&lt;p&gt;I have two choices I think here. I can make a /content/blog/index page which will become a site home page or just make a blog/index for blog home page. Let&amp;#8217;s do a blog specific home page first to display the list of blog posts, all? just the latest few? Maybe have some summary with title link? ok&amp;#8230;&lt;/p&gt;
&lt;p&gt;This ruby incantation returns all the posts in blog direcotry sans all index.txt files that hold year and month indices.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;posts = &lt;span class=&quot;iv&quot;&gt;@pages&lt;/span&gt;.find(
  &lt;span class=&quot;sy&quot;&gt;:all&lt;/span&gt;, 
  &lt;span class=&quot;sy&quot;&gt;:in_directory&lt;/span&gt; =&amp;gt; &lt;span class=&quot;iv&quot;&gt;@page&lt;/span&gt;.dir, 
  &lt;span class=&quot;sy&quot;&gt;:recursive&lt;/span&gt; =&amp;gt; &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;, 
  &lt;span class=&quot;sy&quot;&gt;:sort_by&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, 
  &lt;span class=&quot;sy&quot;&gt;:reverse&lt;/span&gt; =&amp;gt; &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;){|p| p.path !~ &lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;txt$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt;}
  
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Now I need to print out each page. Let&amp;#8217;s use HAML for the index. It will force me to learn it.&lt;br /&gt;
&amp;#8230;do do do&amp;#8230; do some more&amp;#8230; ok, done for now. the index is done to display the list of posts. &lt;br /&gt;
Let&amp;#8217;s make another fake posts to see that the second post also gets created.&lt;/p&gt;
&lt;p&gt;&amp;#8230; let&amp;#8217;s move to the second post then.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title type="html">Radio and Checkbox Groups for Watir and Firewatir</title>
    <link href="http://rubytester.com//blog/2009/08/12/radio-and-checkbox-groups-for-watir-and-firewatir.html" />
    <id>tag:rubytester.com,2009-08-12:1250108311</id>
    <published>2009-08-12T15:18:31-05:00</published>
    <updated>2009-08-12T15:18:31-05:00</updated>
    <content type="html">&lt;h3&gt;Accessing Radios and Checkboxes in Watir&lt;/h3&gt;
&lt;p&gt;Radio and Checkbox access is sometimes difficult because to access a particular control in &amp;#8216;watir&amp;#8217; you need to know its &amp;#8216;value&amp;#8217; attribute, what if you could access a group of radios or checkboxes instead by the &amp;#8216;name&amp;#8217; attribute only no matter what the values are for each individual radios. So I wrote a radio_group and checkbox_group methods to simplify that access.&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s start with the typical &amp;#8216;watir&amp;#8217; code for accessing individual radios and checkboxes:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# 3 radios in a group. &lt;/span&gt;
browser.radio(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rvalue1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
browser.radio(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rvalue2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
browser.radio(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rvalue3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)

&lt;span class=&quot;c&quot;&gt;# 3 checkboxes in a group&lt;/span&gt;
browser.checkbox(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbvalue1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
browser.checkbox(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbvalue2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
browser.checkbox(&lt;span class=&quot;sy&quot;&gt;:name&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbvalue2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Each one of the radios or checkboxes you access individually. However if you look at radios as a group you can see that it behaves like a single select_list control; you select one and only one radio. Selection of one unselects the others. That makes sense to me. &lt;br /&gt;
Similar with checkboxes; as a group you can see that it behaves like multi select_list control; you select none, one or more items.&lt;/p&gt;
&lt;h3&gt;Watir radio_group and checkbox_group methods&lt;/h3&gt;
&lt;p&gt;Radios and Checkboxes form a control set, a group when they share the value of a &amp;#8216;name&amp;#8217; attribute (contained by a form) so instead of accessing them individually like items in a select_list we can access them as a &amp;#8216;radio_group&amp;#8217; using the &amp;#8216;name&amp;#8217; attribute and bypassing the &amp;#8216;value&amp;#8217; attribute. (&lt;a href=&quot;http://www.w3.org/TR/html401/interact/forms.html&quot;&gt;peruse the HTML401 spec for more info on form elements and name attribute usage for identification&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Here is an example:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# access all radios as a group&lt;/span&gt;
browser.radio_group(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)

&lt;span class=&quot;c&quot;&gt;#access all checkboxes as a group&lt;/span&gt;
browser.checkbox_group(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The client code is simplified. You access radios and checkboxes without knowing their individual &amp;#8216;values&amp;#8217;.&lt;/p&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;browser.radio_group(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).size &lt;span class=&quot;c&quot;&gt;# =&amp;gt; 3&lt;/span&gt;
browser.radio_group(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).values &lt;span class=&quot;c&quot;&gt;# =&amp;gt; ['rvalue1', 'rvalue2', 'rvalue3']&lt;/span&gt;


browser.checkbox_group(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).size &lt;span class=&quot;c&quot;&gt;# =&amp;gt; 3&lt;/span&gt;
browser.checkbox_group(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cbname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).values &lt;span class=&quot;c&quot;&gt;# =&amp;gt; ['cbvalue1', 'cbvalue2', 'cbvalue3']&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;To accompany the radio_group method I&amp;#8217;ve also added radio_groups method that returns collection of groups on a page; similar with checkbox_group and checkbox_groups. &lt;br /&gt;
Word of caution: If you have two forms on a page and each form has a group of radios and each group shares the same value for &amp;#8216;name&amp;#8217; attributes we&amp;#8217;ll run into a problem. Do you see which one? Yes, the radio_group will report both sets of radios in two separate forms as one group. First of all you shoud not do that in HTML but if you do you have to delimit containement and address radio_group from each form and not from the root document.&lt;br /&gt;
Anyway, have a look at all the code at in &lt;a href=&quot;http://github.com/marekj/watirloo/tree/master&quot;&gt;watirloo gem&lt;/a&gt;&lt;br /&gt;
Take a look at specs, they run for both IE and Firefox.&lt;/p&gt;
&lt;p&gt;This is a very helpful extension to &amp;#8216;watir&amp;#8217;. It has saved me many hours of work.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title type="html">Using Local Watir Code from Git With Local Gem</title>
    <link href="http://rubytester.com//blog/2009/08/12/using-local-watir-with-local-gem.html" />
    <id>tag:rubytester.com,2009-08-12:1250103891</id>
    <published>2009-08-12T14:04:51-05:00</published>
    <updated>2009-08-12T14:04:51-05:00</updated>
    <content type="html">&lt;h3&gt;Turning a path/to/some/dir into a gem with &amp;#8216;local_gem&amp;#8217; gem&lt;/h3&gt;
&lt;p&gt;&amp;#8220;The other day while actively developing a gem, I got tired of rake reinstalling it to test its effect in irb with some other gems. I wanted to use the edge version of my gem, version now.&amp;#8221; &amp;#8211; this is how &lt;a href=&quot;http://tagaholic.me/2009/02/05/local-gem-loads-your-current-code-now.html&quot;&gt;Tagaholic&lt;/a&gt; aka &lt;a href=&quot;http://twitter.com/cldwalker&quot;&gt;@cldwalker&lt;/a&gt; introduces his &lt;code&gt;local_gem&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I usually work with some stuff I have checked out from git like Watir or Watirloo but when I change some code and I want to use it in my client code I would normally need to create a gem and install it. (what I mean by client code is some code that uses the library and references it as a gem)&lt;/p&gt;
&lt;p&gt;This takes time. It&amp;#8217;s faster to treat the source code for a gem as a gem itsefl without modifing the client code that uses it. This is what &amp;#8216;local_gem&amp;#8217; gem provides. Here is a short writeup on how I use it with watir family libraries when I work on my client code and need to make some custom changes to the &amp;#8216;watir&amp;#8217; code.&lt;/p&gt;
&lt;h3&gt;Working with &amp;#8216;watir&amp;#8217; family gems.&lt;/h3&gt;
&lt;p&gt;I work with with &lt;code&gt;watir&lt;/code&gt; gem source mostly with the IE version and modify it with some custom extensions. I also work with &amp;#8216;watirloo&amp;#8217; gem for my development. These libs are my infrastructure for my client&amp;#8217;s test code base.&lt;/p&gt;
&lt;p&gt;Here is how my client code uses the gems (I hope this is similar to how you use it)&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;watir&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;watir/ie&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# for some IE specific code&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Pretty straighforward. This begs a question: What do you actually require? The &amp;#8216;watir&amp;#8217; project source code creates 3 separate gems &amp;#8216;commonwatir&amp;#8217;, &amp;#8216;watir&amp;#8217; and &amp;#8216;firewatir&amp;#8217;. The &amp;#8216;commonwatir&amp;#8217; gem orchestrates which other gem lib to load depending on your browser choice. So require &amp;#8216;watir&amp;#8217; actually requires &lt;code&gt;GEMPATH/commonwatir/lib/watir.rb&lt;/code&gt; file of &amp;#8216;commonwatir&amp;#8217; gem &amp;#8211; and when you say you want to work with the browser=&amp;#8216;ie&amp;#8217; then commonwatir requires &lt;code&gt;GEMPATH/watir/lib/watir/ie.rb&lt;/code&gt; file of the &amp;#8216;watir&amp;#8217; gem.&lt;/p&gt;
&lt;p&gt;To illustrate this &lt;a href=&quot;http://www.flickr.com/photos/marekj/3615299778&quot;&gt;I have made a crude drawing of require &amp;#8216;watir&amp;#8217; and &amp;#8216;watir/ie&amp;#8217; on flickr&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;so if you want to make changes to some &amp;#8216;watir&amp;#8217; gem or &amp;#8216;firewatir&amp;#8217; gem you can go to the GEMPATH place and mess with it there which is not recommended or you can work on the source code from git but then you would need to create gem and install it again to test in our client code the changes you may want or&amp;#8230;.. you can use &amp;#8216;local_gem&amp;#8217; gem&lt;/p&gt;
&lt;h3&gt;Working with &amp;#8216;watir&amp;#8217; code locally using &amp;#8216;local_gem&amp;#8217;&lt;/h3&gt;
&lt;p&gt;I use &amp;#8216;local_gem&amp;#8217; in its override mode to bypass the cycle of &amp;#8220;change code&amp;gt;make gem&amp;gt;install gem&amp;gt;try your client code&amp;#8221;. I shorten it to &amp;#8220;change code&amp;gt;try your client code&amp;#8221; like this&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;local_gem&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;local_gem/override&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;co&quot;&gt;LocalGem&lt;/span&gt;.setup_config(&lt;span class=&quot;pc&quot;&gt;nil&lt;/span&gt;) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |conf|
  conf.gems = {
    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;watir&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; [
      &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C:/code/github/watir/commonwatir/lib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,
      &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C:/code/github/watir/watir/lib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
    ]
  }
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;watir&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# loads the C:/code/github/watir/commonwatir/lib/watir.rb&lt;/span&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;watir/ie&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# loads C:/code/github/watir/watir/lib/watir/ie.rb &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Mystery solved. Now in my client code I don&amp;#8217;t have to make any changes to how I require &amp;#8216;watir&amp;#8217; and I can hack on the git repo of watir files checked out from github. (Try it yourself. Checkout &amp;#8216;watir&amp;#8217; and make some changes and see them reflected immediately in your client code that uses &amp;#8216;watir&amp;#8217; code)&lt;/p&gt;
&lt;p&gt;As a helper now we can invent an env var switch ENV[&amp;#8216;LOCAL_GEM&amp;#8217;] to turn on or off the overrides so I can run one test using the officially installed &amp;#8216;gem&amp;#8217; or my &amp;#8216;local_gem&amp;#8217; version.&lt;/p&gt;
&lt;p&gt;For good measure I will throw in my watirloo gem there too and some other stuff.&lt;/p&gt;
&lt;p&gt;Here is how my setup looks like&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;ENV&lt;/span&gt;[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;LOCAL_GEM&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]
  require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;local_gem&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
  require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;local_gem/override&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

  &lt;span class=&quot;co&quot;&gt;LocalGem&lt;/span&gt;.setup_config(&lt;span class=&quot;pc&quot;&gt;nil&lt;/span&gt;) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |conf|
    conf.gems = {
      &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;watir&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; [
        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C:/code/github/watir/commonwatir/lib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,
        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C:/code/github/watir/watir/lib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
      ],
      &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;firewatir&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;c:/code/github/watir/firewatir/lib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,
      &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;watirloo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C:/code/github/watirloo/lib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,
      &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;watircraft&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; =&amp;gt; [
        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C:/code/github/watircraft/lib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,
        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C:/code/github/watircraft/bin&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
      ]
    }
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# and in my client code I need to provide the env var&lt;/span&gt;
&lt;span class=&quot;co&quot;&gt;ENV&lt;/span&gt;[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;LOCAL_GEM&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;] = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;override&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;That&amp;#8217;s about it. Hope you find it useful and thanks to &lt;a href=&quot;http://twitter.com/cldwalker&quot;&gt;@cldwalker&lt;/a&gt; for hacking the &amp;#8216;local_gem&amp;#8217;&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title type="html">Second Webby Construction Post</title>
    <link href="http://rubytester.com//blog/2009/04/13/second-webby-construction-post.html" />
    <id>tag:rubytester.com,2009-04-13:1239659924</id>
    <published>2009-04-13T16:58:44-05:00</published>
    <updated>2009-04-13T16:58:44-05:00</updated>
    <content type="html">&lt;p&gt;Where I continue setting up webby o my o my&amp;#8230;&lt;/p&gt;
&lt;h2&gt;Layout&lt;/h2&gt;
&lt;p&gt;Got to change some layouts/default.txt text &amp;#8230; do &amp;#8230; do &amp;#8230;doing&lt;/p&gt;
&lt;p&gt;o my o my&amp;#8230; blueprint.css. What is all this: &lt;code&gt;column span-20 prepend-2 append-2 first last&lt;/code&gt; ?&lt;br /&gt;
Now I need to learn the layout shortucts and get the conceptual model what blueprint.css is and what it is for &amp;#8230; ok just &lt;a href=&quot;http://wiki.github.com/joshuaclayton/blueprint-css/tutorials&quot;&gt;read some articles&lt;/a&gt; got it.. &lt;br /&gt;
So now off to layout but I have only 10 more minutes to spend on this so forget layout. just make links work and that&amp;#8217;s it.&lt;/p&gt;
&lt;h2&gt;Purpose&lt;/h2&gt;
&lt;p&gt;I noticed that I have a hard time with writing in html tools and all the online places like blogger or wordpress. It makes sense to me to put something in txt files as source and work at it for few days and then publish some thoughts. So this is not really a blog but a scrapbook of analysis of things I work on so I will remember them in the future.&lt;/p&gt;
&lt;h2&gt;Rss Feed setup&lt;/h2&gt;
&lt;p&gt;got to make the feed. put the feed in blog/feed/atom.txt and on the layouts/default.txt add the line:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;link&lt;/span&gt; 
  &lt;span class=&quot;an&quot;&gt;rel&lt;/span&gt;=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;alternate&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
  &lt;span class=&quot;an&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;application/atom+xml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
  &lt;span class=&quot;an&quot;&gt;title&lt;/span&gt;=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Blog Rss Feed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;an&quot;&gt;href&lt;/span&gt;=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;http://rubytester.com/blog/feed/atom.xml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;ta&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;h2&gt;Deploy&lt;/h2&gt;
&lt;p&gt;how does webby handle the magic of deploy? webby provides 2 tasks &lt;code&gt;webby deploy:rsync&lt;/code&gt; and &lt;code&gt;webby deploy:ssh&lt;/code&gt;. and a general deploy task that first builds the site and then calls deploy:rsync.&lt;/p&gt;
&lt;p&gt;The tasks are defined in file &lt;code&gt;GEM_HOME\webby-*\lib\webby\tasks\deploy.rake&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The rsync tasks calls &lt;code&gt;sh &quot;rsync bla bla usual&quot;&lt;/code&gt; and ssh uses &lt;code&gt;SshDirPublisher.new(who what were bla bla).upload&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;So first in Sitefile I have to provide some of the options that will be used by the deploy like SITE.user, SITE.host, etc&amp;#8230;&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.user = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rubytester&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#your ssh name to login to the server&lt;/span&gt;
&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.host = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rubytester.com&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; 
&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.remote_dir = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;~/rubytester.com&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;ok, I think that should work.&lt;/p&gt;
&lt;p&gt;let&amp;#8217;s deploy&amp;#8230;. tupi dooo ba ddo dooo&amp;#8230; o crap!! Accessing the site gives me 403 Forbidden error.&lt;br /&gt;
What happened? .. ok, &amp;#8230;.all the files are 500 mode &lt;code&gt;-r-x------&lt;/code&gt; and they should be 644 no? and directories should be 755? yes? I think so. &lt;br /&gt;
Maybe since I am on windows and I deploy to linux I end up with some generic permission collision.&lt;br /&gt;
the rsync or ssh task on windows does not work? or is my server not setup correctly?&lt;/p&gt;
&lt;h3&gt;looking at why webby deploy fails for me&lt;/h3&gt;
&lt;p&gt;webby uses the following tasks for deploy&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rake/contrib/sshpublisher&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

namespace &lt;span class=&quot;sy&quot;&gt;:deploy&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;

  desc &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Deploy to the server using rsync&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
  task &lt;span class=&quot;sy&quot;&gt;:rsync&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
    cmd = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rsync &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.rsync_args.join(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
    cmd &amp;lt;&amp;lt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.output_dir&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/ &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.user&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.host&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.remote_dir&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
    sh cmd
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

  desc &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Deploy to the server using ssh&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
  task &lt;span class=&quot;sy&quot;&gt;:ssh&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;co&quot;&gt;Rake&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;SshDirPublisher&lt;/span&gt;.new(
        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.user&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;idl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.host&lt;span class=&quot;idl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.remote_dir, &lt;span class=&quot;co&quot;&gt;SITE&lt;/span&gt;.output_dir
    ).upload
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;# deploy&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# EOF&lt;/span&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Since I provided the user and host the deploy worked but the permissions for files sent to the server were incorrect. I write on Windows XP the files on the server were given mode 700. ok, let&amp;#8217;s delete all the files from the server and try again using ssh this time instead of rsync&lt;/p&gt;
&lt;p&gt;zippy duda do&amp;#8230; ok, all ssh got copied over and the mode of files and dirs is &lt;code&gt;rwx------&lt;/code&gt; so I get permission denied on serving those files. Damn. The problem must be on windows side or on my server.&lt;/p&gt;
&lt;p&gt;OK, let&amp;#8217;s try to copy files with WinSCP; guess what, all dirs get set to 755 and files to 644 as expected. So the problem seems to be cygwin rsycn or OpenSSH for win xp. What if I switched to Putty? hmm&amp;#8230; will need to investigate it. For now deploy is broken for me, I have to do it manually with winscp, (I wonder if Robocopy or RichCopy might work in this situation)&lt;/p&gt;
&lt;h2&gt;Next task add disqus to the posts&lt;/h2&gt;
&lt;p&gt;Next I think I should have some comments with disqus probably. But wait. I only want comments for articles and not for all pages but currently all pages are using one layout &amp;#8216;default.txt&amp;#8217; so I need to make articles use its own layout first and include the output back in the main default.txt (I think). So this article.txt should have a layout: article and layouts/article.txt should have a layout: default.txt or just none, I mean default is default yes?&lt;/p&gt;
&lt;p&gt;ok let&amp;#8217;s do layouts/article.txt and add a disqus code to it.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title type="html">Running Ruby Files on Windows</title>
    <link href="http://rubytester.com//blog/2009/07/24/running-ruby-files-on-windows.html" />
    <id>tag:rubytester.com,2009-07-24:1248462356</id>
    <published>2009-07-24T14:05:56-05:00</published>
    <updated>2009-07-24T14:05:56-05:00</updated>
    <content type="html">&lt;h3&gt;Invoking Ruby.exe on windows&lt;/h3&gt;
&lt;p&gt;If you look at c:\Ruby\bin you will find two sets of files. One with .bat extension and one without. &lt;br /&gt;
for example let&amp;#8217;s take a look at those two&lt;/p&gt;
&lt;p&gt;c:\Ruby\bin\rake and rake.bat&lt;/p&gt;
&lt;p&gt;rake (without extension) looks like this:&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;
&lt;span class=&quot;dt&quot;&gt;#!C:/RUBY/bin/ruby.exe&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# This file was generated by RubyGems.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# The application 'rake' is installed as part of a gem, and&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# this file is here to facilitate running it.&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#&lt;/span&gt;

require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rubygems&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

version = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;gt;= 0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;ARGV&lt;/span&gt;.first =~ &lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^_(.*)_$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;Gem&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Version&lt;/span&gt;.correct? &lt;span class=&quot;gv&quot;&gt;$1&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;then&lt;/span&gt;
  version = &lt;span class=&quot;gv&quot;&gt;$1&lt;/span&gt;
  &lt;span class=&quot;pc&quot;&gt;ARGV&lt;/span&gt;.shift
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

gem &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rake&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, version
load &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rake&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;and rake.bat looks like this&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;iv&quot;&gt;@ECHO&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;OFF&lt;/span&gt;
&lt;span class=&quot;co&quot;&gt;IF&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;%~f0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; == &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;~f0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;GOTO&lt;/span&gt; &lt;span class=&quot;sy&quot;&gt;:WinNT&lt;/span&gt;
&lt;span class=&quot;er&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;ruby.exe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C:/RUBY/bin/rake&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;1&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;2&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;3&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;4&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;5&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;6&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;7&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;8&lt;/span&gt; %&lt;span class=&quot;i&quot;&gt;9&lt;/span&gt;
&lt;span class=&quot;co&quot;&gt;GOTO&lt;/span&gt; &lt;span class=&quot;sy&quot;&gt;:EOF&lt;/span&gt;
&lt;span class=&quot;sy&quot;&gt;:WinNT&lt;/span&gt;
&lt;span class=&quot;er&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;ruby.exe&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;%~dpn0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; %*
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;so what happens when you run &lt;code&gt;rake&lt;/code&gt; from the command line? it uses the first line in a file &lt;code&gt;#!C:/RUBY/bin/ruby.exe -ws&lt;/code&gt; as a directive to run this file using ruby.exe the -ws is for warnings and swtich parsing. Look for yourself when you run &lt;code&gt;ruby -help&lt;/code&gt; and read the help on switches.&lt;/p&gt;
&lt;p&gt;Everything else in that &lt;code&gt;rake&lt;/code&gt; files is pure ruby code&lt;/p&gt;
&lt;p&gt;The interesting file is the &lt;code&gt;rake.bat&lt;/code&gt;. The %1 to %9 are arguments. %0 being the name of the executing file (not always) but in ruby similar to $0.&lt;/p&gt;
&lt;p&gt;The &amp;#8220;%~dpn0&amp;#8221; in last line I think stands for &amp;#8220;d(rive)p(ath)n(ame)&amp;#8221; but 0 ? maybe something with extension. I don&amp;#8217;t really know. I am rusty witn bat arguments processing.&lt;/p&gt;
&lt;p&gt;and the last %* bit just collects the rest of arguments. You can make a temp.bat file and put this line in it.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;REM &quot;%~d0&quot;, &quot;%~p0&quot;, &quot;%~f0&quot;, &quot;%~n&quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;this should be a fun exercise.&lt;/p&gt;
&lt;p&gt;So. If you have ruby files that you want to execute from the command then put a windows path to ruby directive as the first line&lt;/p&gt;
&lt;p&gt;#!C:/RUBY/bin/ruby.exe&lt;/p&gt;
&lt;p&gt;and save the file without any extension to a dir that&amp;#8217;s in your path (I use ~/bin  or in windows speak &lt;span&gt;USERPROFILE&lt;/span&gt;\bin )&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title type="html">Deconstructing Rspec Runner</title>
    <link href="http://rubytester.com//blog/2009/04/24/deconstructing-rspec-runner.html" />
    <id>tag:rubytester.com,2009-04-24:1240594126</id>
    <published>2009-04-24T12:28:46-05:00</published>
    <updated>2009-04-24T12:28:46-05:00</updated>
    <content type="html">&lt;p&gt;For my Watir &amp;#8216;usecase&amp;#8217; tests I have been running test/unit test cases with the &lt;code&gt;UI::Console::TestRunner.run&lt;/code&gt; . The reason is that I need to decide &amp;#8216;when&amp;#8217; to run some test and when to run some &amp;#8216;setup usecase&amp;#8217; routines. In a &amp;#8216;functional test&amp;#8217; steps of execution sequence and timeline matter while in classic unit tests you assert &amp;#8216;state and behaviour&amp;#8217; of a class in isolation.&lt;/p&gt;
&lt;p&gt;In Functional tests I have to setup preconditions: load the browser and login. These &amp;#8216;steps&amp;#8217; are tests as well in their own right but mostly they play a &amp;#8216;role&amp;#8217; of &amp;#8216;flow setup&amp;#8217; for later tests hence they introduce dependency in &amp;#8216;functional testing&amp;#8217;. This dependency rarely exist in Test Unit style testing, it is built to not care about this kind of &amp;#8216;dependency setup&amp;#8217; &amp;#8211; as a matter of fact it rejects it, it does not run &lt;code&gt;test_xxx&lt;/code&gt; methods sequentially by default but alphabetically (this fact causes constant questions on &lt;a href=&quot;http://groups.google.com/group/watir-general&quot;&gt;watir-general mailing list&lt;/a&gt;. The fix is to use &lt;a href=&quot;http://wtr.rubyforge.org/rdoc/classes/Watir/TestCase.html&quot;&gt;Watir::TestCase&lt;/a&gt; that sorts them sequentially).&lt;/p&gt;
&lt;h2&gt;How Test Unit runs tests&lt;/h2&gt;
&lt;p&gt;By default if you run a file with &lt;code&gt;ruby testfile.rb&lt;/code&gt; that containes Test Unit TestCase the code will be loaded in ObjectSpace and massaged, counted sorted and then executed one by one. Each TestCase class is independent of another. Each &lt;code&gt;test_xxx&lt;/code&gt; in independent of another &lt;code&gt;test_xxx&lt;/code&gt;. TestCase is usually a collection of tests using the same test fixture. The fixture is setup and teardown for each test.&lt;/p&gt;
&lt;p&gt;This simply will not do for my &amp;#8216;browser functional tests&amp;#8217; because I need to be able to specify &amp;#8216;when&amp;#8217; I want the tests to start and &amp;#8216;when&amp;#8217; to finish. The question of &amp;#8216;WHEN&amp;#8217; is important in functional sequential tesing. I test by moving from context to context and each tescase has a role that introduces dependency for the next testcase. The entire model of TestUnit her fails for me when it comes to flow based customer facing tests.&lt;/p&gt;
&lt;p&gt;My cruch so far has bee to disallow the automatic TestCase runs but instead I invoke them at a particular time with the UI::Console::TestRunner.run. Here is how I weave them into my test infrustructure code.&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;# get testrunner &lt;/span&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test/unit/ui/console/testrunner&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# run some code for context setup&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# get the testcase code and run it with TestRunner.run&lt;/span&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;my_testcase&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;co&quot;&gt;Test&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Unit&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;UI&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Console&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;TestRunner&lt;/span&gt;.run &lt;span class=&quot;co&quot;&gt;MyTestCase&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# and clean up context and setup for the next test&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# do some code for next context setup&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# get the testcase2 code and run it with TestRunner.run&lt;/span&gt;
require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;my_testcase2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;co&quot;&gt;Test&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Unit&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;UI&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Console&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;TestRunner&lt;/span&gt;.run &lt;span class=&quot;co&quot;&gt;MyTestCase2&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;or when I run a &amp;#8216;usecase scenario&amp;#8217; I feed tests into &amp;#8216;timeline&amp;#8217; like so&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;iv&quot;&gt;@test_list&lt;/span&gt; = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;%w[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;MyTestCase MyTestCase2 MyTestCase3&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;run_test&lt;/span&gt;(test_number)
  &lt;span class=&quot;co&quot;&gt;TestRunner&lt;/span&gt;.run &lt;span class=&quot;iv&quot;&gt;@test_list&lt;/span&gt;[test_number].constantize
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# setup context for test 1&lt;/span&gt;
run_test &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# setup context for test 2&lt;/span&gt;
run_test &lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This code organization ensures the &amp;#8216;when&amp;#8217; Test::Unit will run and &amp;#8216;when&amp;#8217; it finishes. Now I can control the flow of test setups and I can use testcases as &amp;#8216;roles&amp;#8217; to play some part in moving context forward in timeline of step sequence to run yet more tests.&lt;/p&gt;
&lt;h2&gt;Replacing TestUnit TestCase with Rspec ExampleGroup&lt;/h2&gt;
&lt;p&gt;Now I want to move to rspec and duplicate this same runner functionality. The Rspec style BDD block looks like this&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;describe &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Something&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
  it &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;should be named someting&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;something&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;.should == &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;something&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
  it &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;should not be something else&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;something&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;.should_not == &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;something else&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The above &amp;#8216;syntax&amp;#8217; of describe blocks can be also written as class objects (which will perhaps take away some of the magic from it)&lt;/p&gt;
&lt;div class=&quot;CodeRay&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;SomethingExamples&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;Spec&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Example&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;ExampleGroup&lt;/span&gt;
  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;should_be_named&lt;/span&gt; someting
    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;something&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;.should == &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;something&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;should_not_be_something_else&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;something&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;.should_not == &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;something else&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;and you can exeucte it just like you execute describe block.&lt;/p&gt;
&lt;h3&gt;how rspec executes tests.&lt;/h3&gt;
&lt;p&gt;There are usually 3 ways you would execute rspec examples.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;With ruby&lt;/li&gt;
	&lt;li&gt;With spec executable&lt;/li&gt;
	&lt;li&gt;With Rake::SpecTask&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Usually when you have a file.br that containes code that is wrapped in %describe do end@ block all you need to do it is add a line %requrire &amp;#8216;spec/autorun&amp;#8217;@ and run the file. The autorun will take care of invoking rspec. Similar with the spec executable you provide one or more files to run and they execute (in sequance).&lt;/p&gt;
&lt;p&gt;The drawback is that any code that is not called from the describe blocks will be executed first an then at_exit all the examples will run. Hm&amp;#8230; that&amp;#8217;s not good for me. I either have to go with rspec runner or I am out of luck.&lt;/p&gt;
&lt;p&gt;With rspec is it any reason to even have code outside of it? Maybe I need to rethink my strategy.&lt;/p&gt;
&lt;p&gt;Anyway, I started writing this thinking I need to find an equivalent to TestRunn.run TestCase mechanism but now I am thinking maybe rspec itself is just it and there is no need to run outside of it.&lt;/p&gt;</content>
  </entry>
  
</feed>