<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
  <title>app</title>
  <id>http://beckelman.net</id>
  <updated>2012-01-18</updated>
  <author>
    <name>Bill Beckelman</name>
  </author>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/BillBeckelman" /><feedburner:info uri="billbeckelman" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
    <title>Internals Visible To</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/BrA9T01dcuQ/" />
    <id>http://beckelman.net/2012/01/18/internals-visible-to/</id>
    <published>2012-01-18</published>
    <updated>2012-01-18</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;I was working on an &lt;a href="http://msdn.microsoft.com/en-us/library/zec9k340(v=vs.71).aspx"&gt;HttpModule&lt;/a&gt; today that I will try and blog about later. I wanted to make an interface that I was programming against internal. This of course broke my unit tests. Luckily&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;I was working on an &lt;a href="http://msdn.microsoft.com/en-us/library/zec9k340(v=vs.71).aspx"&gt;HttpModule&lt;/a&gt; today that I will try and blog about later. I wanted to make an interface that I was programming against internal. This of course broke my unit tests. Luckily
I remembered that you can make internals visible to other assemblies such as test assemblies. I just couldn&amp;rsquo;t remember how.&lt;/p&gt;

&lt;p&gt;This &lt;a href="http://stackoverflow.com/questions/920844/c-sharp-how-to-access-internal-class-from-external-assembly"&gt;stackoverflow post&lt;/a&gt; had the answer. The line of code below needs to be added to the assembly.cs file located in the project with the internal code.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[assembly: InternalsVisibleTo("name of assembly here")] 
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Since I am using &lt;a href="http://code.google.com/p/moq/"&gt;Moq&lt;/a&gt; for mocking, I also had to make the internals visible to the castle dynamic proxy. I found out how to do that on this &lt;a href="http://blog.ashmind.com/2008/05/09/mocking-internal-interfaces-with-moq/"&gt;post&lt;/a&gt;. You just have to add the line below:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;   [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9of2s6ldBZO7h0EX62QtzcdoF7g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9of2s6ldBZO7h0EX62QtzcdoF7g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9of2s6ldBZO7h0EX62QtzcdoF7g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9of2s6ldBZO7h0EX62QtzcdoF7g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/BrA9T01dcuQ" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2012/01/18/internals-visible-to/</feedburner:origLink></entry>
  <entry>
    <title>Capybara InvalidSelectorError - Selenium Issue 2099</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/jUMGldevdKw/" />
    <id>http://beckelman.net/2011/08/24/capybara-invalidselectorerror---selenium-issue-2099/</id>
    <published>2011-08-24</published>
    <updated>2011-08-24</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;This morning I tried running our entire capybara suite and a ton of tests failed due to an issue with the Selenium Webdriver. It took some searching and tinkering to come up with the fix
below.&lt;/p&gt;

&lt;p&gt;The following links were very helpful and provided most of the patch below that I added prior to the code that runs the tests:&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;This morning I tried running our entire capybara suite and a ton of tests failed due to an issue with the Selenium Webdriver. It took some searching and tinkering to come up with the fix
below.&lt;/p&gt;

&lt;p&gt;The following links were very helpful and provided most of the patch below that I added prior to the code that runs the tests:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://carol-nichols.com/2011/07/seleniumwebdrivererrorunhandlederror-ns_error_illegal_value/"&gt;http://carol-nichols.com/2011/07/seleniumwebdrivererrorunhandlederror-ns_error_illegal_value/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.google.com/p/selenium/issues/detail?id=2099"&gt;https://code.google.com/p/selenium/issues/detail?id=2099&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;br /&gt;


&lt;script src="https://gist.github.com/1168691.js?file=gistfile1.rb"&gt;&lt;/script&gt;


&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7hr9R3ziEkjWzYfAx3-JQtsvXo4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7hr9R3ziEkjWzYfAx3-JQtsvXo4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7hr9R3ziEkjWzYfAx3-JQtsvXo4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7hr9R3ziEkjWzYfAx3-JQtsvXo4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/jUMGldevdKw" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/08/24/capybara-invalidselectorerror---selenium-issue-2099/</feedburner:origLink></entry>
  <entry>
    <title>BDD for JavaScript with Jasmine</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/sQTqFBO2SHY/" />
    <id>http://beckelman.net/2011/08/17/bdd-for-javascript-with-jasmine/</id>
    <published>2011-08-17</published>
    <updated>2011-08-17</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;Both &lt;a href="http://peepcode.com/"&gt;peepcode&lt;/a&gt; and &lt;a href="http://tekpub.com/"&gt;tekpub&lt;/a&gt; have done excellent screencasts on using
&lt;a href="http://documentcloud.github.com/backbone/"&gt;backbone.js&lt;/a&gt; in the last couple of months. In peepcode&amp;rsquo;s screencasts, they used
a JavaScript BDD framework that was very intriguing called &lt;a href="http://pivotal.github.com/jasmine/"&gt;Jasmine&lt;/a&gt;&amp;hellip;&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Both &lt;a href="http://peepcode.com/"&gt;peepcode&lt;/a&gt; and &lt;a href="http://tekpub.com/"&gt;tekpub&lt;/a&gt; have done excellent screencasts on using
&lt;a href="http://documentcloud.github.com/backbone/"&gt;backbone.js&lt;/a&gt; in the last couple of months. In peepcode&amp;rsquo;s screencasts, they used
a JavaScript BDD framework that was very intriguing called &lt;a href="http://pivotal.github.com/jasmine/"&gt;Jasmine&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;From the Jasmine home page:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Jasmine is a behavior-driven development framework for testing your JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM. And it has a clean, obvious syntax so that you can easily write tests.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Here is a non trivial example of some specs I wrote for a recent enhancement request.&lt;/p&gt;

&lt;script src="https://gist.github.com/1151753.js?file=jasmine_example.js"&gt;&lt;/script&gt;


&lt;p&gt;The example above uses a handy plugin for the fixtures called &lt;a href="https://github.com/velesin/jasmine-jquery"&gt;jasmine-jquery&lt;/a&gt;. One gotcha to look out for when using the fixtures
is that current versions of chrome do not allow file:// URI without an override. You can start Chrome with
the &lt;a href="http://peter.sh/experiments/chromium-command-line-switches/"&gt;&amp;mdash;allow-file-access-from-files&lt;/a&gt; condition to get around this.&lt;/p&gt;

&lt;p&gt;One other plugin that comes in handy when using Jasmine (though not used in the example above) is &lt;a href="http://sinonjs.org/"&gt;Sinon&lt;/a&gt;.
Sinon provides standalone test spies, stubs and mocks for JavaScript. It has no dependencies, and works with any unit testing framework.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xqnK0nUnmArMXQguXPQJthYWzgE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xqnK0nUnmArMXQguXPQJthYWzgE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xqnK0nUnmArMXQguXPQJthYWzgE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xqnK0nUnmArMXQguXPQJthYWzgE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/sQTqFBO2SHY" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/08/17/bdd-for-javascript-with-jasmine/</feedburner:origLink></entry>
  <entry>
    <title>Knockout JS</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/NAYggoR2mf4/" />
    <id>http://beckelman.net/2011/08/06/knockout-js/</id>
    <published>2011-08-06</published>
    <updated>2011-08-06</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;I have known about &lt;a href="http://knockoutjs.com/"&gt;knockout.js&lt;/a&gt; for quite a while now. It&amp;rsquo;s one of those libraries that gets a lot of coverage,
I just haven&amp;rsquo;t had the time to check it out.&lt;/p&gt;

&lt;p&gt;From the introduction:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying&lt;/p&gt;&lt;/blockquote&gt;
</summary>
    <content type="html">&lt;p&gt;I have known about &lt;a href="http://knockoutjs.com/"&gt;knockout.js&lt;/a&gt; for quite a while now. It&amp;rsquo;s one of those libraries that gets a lot of coverage,
I just haven&amp;rsquo;t had the time to check it out.&lt;/p&gt;

&lt;p&gt;From the introduction:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying
data model. Any time you have sections of UI that update dynamically (e.g., changing depending on the user&amp;rsquo;s actions or when an
external data source changes) KO can help you implement it more simply and maintainably.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Check out my Hello World fiddle below:&lt;/p&gt;

&lt;iframe style="width: 100%; height: 200px" src="http://jsfiddle.net/beckelmw/QCwXs/embedded/"&gt;&lt;/iframe&gt;


&lt;p&gt;On the result tab, notice if you edit one of the inputs, the text below changes automatically.&lt;/p&gt;

&lt;p&gt;As I built out the eventual page I decided to try knockout out on, the following resources were very helpful:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;a href="http://knockoutjs.com/documentation/introduction.html"&gt;knockout documentation&lt;/a&gt; &amp;ndash; it&amp;rsquo;s very good&lt;/li&gt;
&lt;li&gt;Articles on Ryan Niemeyer&amp;rsquo;s &lt;a href="http://www.knockmeout.net/"&gt;blog&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IXXtZe7vY_DRlFqiYAP91jhS02s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IXXtZe7vY_DRlFqiYAP91jhS02s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IXXtZe7vY_DRlFqiYAP91jhS02s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IXXtZe7vY_DRlFqiYAP91jhS02s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/NAYggoR2mf4" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/08/06/knockout-js/</feedburner:origLink></entry>
  <entry>
    <title>Check Active Element with Capybara</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/s0toBWzhfwk/" />
    <id>http://beckelman.net/2011/08/06/check-active-element-with-capybara/</id>
    <published>2011-08-06</published>
    <updated>2011-08-06</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;The other day, I wanted to test that a certain element had the focus with capybara. This is what I came up with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;assert(@s.evaluate_script('document.activeElement')[:id] == 'IdOfElement', 'The element did not have the focus')
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note: @s is my session. I am managing session myself as I am testing a non rack app&amp;hellip;&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;The other day, I wanted to test that a certain element had the focus with capybara. This is what I came up with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;assert(@s.evaluate_script('document.activeElement')[:id] == 'IdOfElement', 'The element did not have the focus')
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note: @s is my session. I am managing session myself as I am testing a non rack app.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7dfLqygkFizox2rWkf5BFbKoP3c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7dfLqygkFizox2rWkf5BFbKoP3c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7dfLqygkFizox2rWkf5BFbKoP3c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7dfLqygkFizox2rWkf5BFbKoP3c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/s0toBWzhfwk" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/08/06/check-active-element-with-capybara/</feedburner:origLink></entry>
  <entry>
    <title>My Vim Setup on Windows</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/LkOfaY8_zBk/" />
    <id>http://beckelman.net/2011/07/27/my-vim-setup-on-windows/</id>
    <published>2011-07-27</published>
    <updated>2011-07-27</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;I have been slowing teaching myself how to use vi/vim for quite some time now. I have been using a Visual Studio plugin called
&lt;a href="http://www.viemu.com/"&gt;ViEmu&lt;/a&gt; and I have also been using &lt;a href="http://code.google.com/p/macvim/"&gt;MacVim&lt;/a&gt; some on my Mac. A few days ago&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;I have been slowing teaching myself how to use vi/vim for quite some time now. I have been using a Visual Studio plugin called
&lt;a href="http://www.viemu.com/"&gt;ViEmu&lt;/a&gt; and I have also been using &lt;a href="http://code.google.com/p/macvim/"&gt;MacVim&lt;/a&gt; some on my Mac. A few days ago
I decided to also install &lt;a href="http://www.vim.org/download.php"&gt;gVim&lt;/a&gt; and use it on windows in situations where I don&amp;rsquo;t
need the overhead of Visual Studio.&lt;/p&gt;

&lt;p&gt;I am using this post to document how I setup gVim for use on my windows machine. Below are the settings I have added to the _vimrc file:&lt;/p&gt;

&lt;script src="https://gist.github.com/1109314.js?file=default_vim_settings.vim"&gt;&lt;/script&gt;


&lt;p&gt;Here is the documentation on where they came from:&lt;/p&gt;

&lt;h3&gt;Fonts&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI"&gt;http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Tabs and Spaces&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://vim.wikia.com/wiki/Converting_tabs_to_spaces"&gt;http://vim.wikia.com/wiki/Converting_tabs_to_spaces&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Line Endings&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/799417/gvim-showing-carriage-return-m-even-when-file-mode-is-explicitly-dos"&gt;http://stackoverflow.com/questions/799417/gvim-showing-carriage-return-m-even-when-file-mode-is-explicitly-dos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vim.wikia.com/wiki/File_format"&gt;http://vim.wikia.com/wiki/File_format&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Color Scheme&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.vim.org/scripts/script.php?script_id=1891"&gt;http://www.vim.org/scripts/script.php?script_id=1891&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/tpope/vim-vividchalk"&gt;https://github.com/tpope/vim-vividchalk&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;No backup&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/2197749/gvim-on-windows-way-to-disable-the-tmp-file-cretion"&gt;http://stackoverflow.com/questions/2197749/gvim-on-windows-way-to-disable-the-tmp-file-cretion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Line Numbers&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://vim.wikia.com/wiki/Display_line_numbers"&gt;http://vim.wikia.com/wiki/Display_line_numbers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/otaRLUqlPmLa2fleia40GtMrbJA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/otaRLUqlPmLa2fleia40GtMrbJA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/otaRLUqlPmLa2fleia40GtMrbJA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/otaRLUqlPmLa2fleia40GtMrbJA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/LkOfaY8_zBk" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/07/27/my-vim-setup-on-windows/</feedburner:origLink></entry>
  <entry>
    <title>Quick way to use Amazon CDN with toto</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/QHq6FPN-1J8/" />
    <id>http://beckelman.net/2011/07/22/quick-way-to-use-amazon-cdn-with-toto/</id>
    <published>2011-07-22</published>
    <updated>2011-07-22</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;Just a few days back &lt;a href="http://aws.amazon.com/sdkforruby/"&gt;Amazon&lt;/a&gt; released an official Ruby SDK for Amazon Web Services (AWS). I found out about it through an introductory
&lt;a href="http://www.rubyinside.com/amazon-official-aws-sdk-for-ruby-developers-5132.html"&gt;article on rubyinside.com&lt;/a&gt;&amp;hellip;&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Just a few days back &lt;a href="http://aws.amazon.com/sdkforruby/"&gt;Amazon&lt;/a&gt; released an official Ruby SDK for Amazon Web Services (AWS). I found out about it through an introductory
&lt;a href="http://www.rubyinside.com/amazon-official-aws-sdk-for-ruby-developers-5132.html"&gt;article on rubyinside.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I figured writing a quick script to upload my &lt;a href="http://cloudhead.io/toto"&gt;toto&lt;/a&gt; public folder to S3 would be a neat way to explore the new SDK. The script below is very simple. It just iterates through my public
folder and uploads each item to my S3 bucket.&lt;/p&gt;

&lt;script src="https://gist.github.com/1100806.js?file=aws.rb"&gt;&lt;/script&gt;


&lt;p&gt;I ran into a couple of issues along the way though that you should be aware of:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;I wasn&amp;rsquo;t happy with the auto detection of mime types that Amazon was doing. For example, an uploaded png was getting a mime type of image/jpeg when downloaded. I fixed this by explicitly setting the content type for each uploaded item. I did this using the built in &lt;a href="http://mime-types.rubyforge.org/"&gt;mime library&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I initially uploaded my fonts to S3, but currently &lt;a href="https://forums.aws.amazon.com/thread.jspa?threadID=34281"&gt;AWS does not have the ability to send the Access-Control-Allow-Origin header&lt;/a&gt; that Firefox requires before it will serve a font from another domain (rubystatic.beckelmans.com in this case). I ended up having to continue to serve my fonts from the beckelmans.com domain.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Duw6VPxYy74Lw4rqx8LWH6o2Ph8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Duw6VPxYy74Lw4rqx8LWH6o2Ph8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Duw6VPxYy74Lw4rqx8LWH6o2Ph8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Duw6VPxYy74Lw4rqx8LWH6o2Ph8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/QHq6FPN-1J8" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/07/22/quick-way-to-use-amazon-cdn-with-toto/</feedburner:origLink></entry>
  <entry>
    <title>Close the Browser After Each Capybara Test</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/xvFDba-0k9E/" />
    <id>http://beckelman.net/2011/07/11/close-the-browser-after-each-capybara-test/</id>
    <published>2011-07-11</published>
    <updated>2011-07-11</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;I have been using Capybara to test a non rack based app. Basically I am just pointing it at URL and am then managing my own sessions. Until recently, I was not properly closing
the browser after each test and if I ran I full suite of tests would end up with many, many open browser windows that would get closed only once the full suite had been run&amp;hellip;&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;I have been using Capybara to test a non rack based app. Basically I am just pointing it at URL and am then managing my own sessions. Until recently, I was not properly closing
the browser after each test and if I ran I full suite of tests would end up with many, many open browser windows that would get closed only once the full suite had been run.&lt;/p&gt;

&lt;p&gt;This was easy to remedy. There is an instance method on &lt;a href="http://rubydoc.info/gems/capybara/1.0.0/Capybara/Selenium/Driver"&gt;Capybara::Selenium::Driver&lt;/a&gt; called quit that does
exactly what you would guess.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;def setup
  @s = new_session
end

def teardown
  @s.driver.browser.quit
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/QtK2AcW78heZF99r1r2mMzL2PXE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QtK2AcW78heZF99r1r2mMzL2PXE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/QtK2AcW78heZF99r1r2mMzL2PXE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QtK2AcW78heZF99r1r2mMzL2PXE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/xvFDba-0k9E" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/07/11/close-the-browser-after-each-capybara-test/</feedburner:origLink></entry>
  <entry>
    <title>Looking for non ASCII Characters with Capybara</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/HGCao9C6O8M/" />
    <id>http://beckelman.net/2011/07/09/looking-for-non-ascii-characters-with-capybara/</id>
    <published>2011-07-09</published>
    <updated>2011-07-09</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;I was trying to test some internationalized pages with capybara this week and kept running into problems. In my test, I was trying to make sure that the prices on our UK
pages showed British pounds &amp;pound; instead of US dollars $.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://rubystatic.beckelmans.com/v2/img/encoding/british_pounds.png" alt="Brishish Pounds" /&gt;&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;I was trying to test some internationalized pages with capybara this week and kept running into problems. In my test, I was trying to make sure that the prices on our UK
pages showed British pounds &amp;pound; instead of US dollars $.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://rubystatic.beckelmans.com/v2/img/encoding/british_pounds.png" alt="Brishish Pounds" /&gt;&lt;/p&gt;

&lt;p&gt;Before I could even run the test, I was running into an invalid multi-byte character error:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://rubystatic.beckelmans.com/v2/img/encoding/invalid_multi_byte_character.png" alt="Invalid Multi Byte Character" /&gt;&lt;/p&gt;

&lt;p&gt;I remembered reading that one of the big changes with Ruby 1.9 was encoding. It took some Googling and experimentation, but the test is now working. I did the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;I saved my files as UTF-8 (I am working in Visual Studio which does not use UTF-8 by default and is generally set on a US machine to Western European Code Page 1252). You can
change the encoding by selecting Save As from the File menu and then choose to save with encoding.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://rubystatic.beckelmans.com/v2/img/encoding/save_with_encoding.png" alt="Save in Visual Studio with Encoding" /&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I then added a &lt;a href="http://zargony.com/2009/07/24/ruby-1-9-and-file-encodings"&gt;comment at the top of my Ruby test file&lt;/a&gt; to hint to the parser that the page is UTF-8 as shown below:&lt;/p&gt;

&lt;p&gt; # encoding: utf-8&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8ye_p8Tua4V9paSYx7R42ug-ELI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8ye_p8Tua4V9paSYx7R42ug-ELI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8ye_p8Tua4V9paSYx7R42ug-ELI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8ye_p8Tua4V9paSYx7R42ug-ELI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/HGCao9C6O8M" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/07/09/looking-for-non-ascii-characters-with-capybara/</feedburner:origLink></entry>
  <entry>
    <title>Using a Custom Firefox Profile with Capybara</title>
    <link rel="alternate" href="http://feedproxy.google.com/~r/BillBeckelman/~3/QJtuGhZO80s/" />
    <id>http://beckelman.net/2011/07/07/using-a-custom-firefox-profile-with-capybara/</id>
    <published>2011-07-07</published>
    <updated>2011-07-07</updated>
    <author>
      <name>Bill Beckelman</name>
    </author>
    <summary type="html">&lt;p&gt;I wanted to be able to test some internationalization using capybara with a non rack app.
You cannot set request headers using the selenium driver, so I had to find a different way. What I came up with
was using a &lt;a href="http://support.mozilla.com/en-US/kb/Managing-profiles"&gt;custom Firefox profile&lt;/a&gt; since the profile to use can be set when you setup the capybara driver to use&amp;hellip;&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;I wanted to be able to test some internationalization using capybara with a non rack app.
You cannot set request headers using the selenium driver, so I had to find a different way. What I came up with
was using a &lt;a href="http://support.mozilla.com/en-US/kb/Managing-profiles"&gt;custom Firefox profile&lt;/a&gt; since the profile to use can be set when you setup the capybara driver to use.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Capybara.register_driver :selenium_firefox_gb do |app|
    Capybara::Selenium::Driver.new(app, :browser =&amp;gt; :firefox, :profile =&amp;gt; "gb")
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In the Firefox profile, I set the default language as I desired, but you could also tweak other things like the &lt;a href="http://johnbokma.com/mexit/2004/04/24/changinguseragent.html"&gt;user agent string&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Tools &gt; Options &gt; Content &gt; Languages&lt;/p&gt;

&lt;p&gt;&lt;img src="http://rubystatic.beckelmans.com/v2/img/custom_profile/language.png" alt="Language Options" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3jUzhGcGQVw-2r6PvX32dbNRWyk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3jUzhGcGQVw-2r6PvX32dbNRWyk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3jUzhGcGQVw-2r6PvX32dbNRWyk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3jUzhGcGQVw-2r6PvX32dbNRWyk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/BillBeckelman/~4/QJtuGhZO80s" height="1" width="1"/&gt;</content>
  <feedburner:origLink>http://beckelman.net/2011/07/07/using-a-custom-firefox-profile-with-capybara/</feedburner:origLink></entry>
</feed>

