<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rainux's Journal &#187; Ruby on Rails Archives  &laquo; Rainux&#039;s Journal</title>
	<atom:link href="http://rainux.org/category/web-development/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://rainux.org</link>
	<description>Rubyist of Vimmer</description>
	<lastBuildDate>Sat, 23 Jul 2011 12:09:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Configure capybara-webkit to run acceptance specs with Javascript/AJAX</title>
		<link>http://rainux.org/configure-capybara-webkit-to-run-acceptance-specs-with-javascript-ajax</link>
		<comments>http://rainux.org/configure-capybara-webkit-to-run-acceptance-specs-with-javascript-ajax#comments</comments>
		<pubDate>Sat, 23 Jul 2011 12:09:18 +0000</pubDate>
		<dc:creator>Rainux</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web Development 织网]]></category>
		<category><![CDATA[Capybara]]></category>
		<category><![CDATA[capybara-webkit]]></category>
		<category><![CDATA[RSpec]]></category>

		<guid isPermaLink="false">http://rainux.org/?p=272</guid>
		<description><![CDATA[Add capybara-webkit to your Gemfile and let Guard::Bundler install it automatically (or manually via bundle install if you don't use Guard). gem 'capybara-webkit', '&#62;= 1.0.0.beta4' Set Javascript driver to :webkit for Capybara in spec_helper.rb. Capybara.javascript_driver = :webkit Configure RSpec use non-transactional fixtures, configure Database Cleaner in spec_helper.rb. Notice with this setup, we'll only use truncation [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><p>Add <code>capybara-webkit</code> to your <code>Gemfile</code> and let <a href="https://github.com/guard/guard-bundler" rel="nofollow" >Guard::Bundler</a> install it automatically (or manually via <code>bundle install</code> if you don't use <a href="https://github.com/guard/guard" rel="nofollow" >Guard</a>).</p>

<pre name="code" class="ruby">gem 'capybara-webkit', '&gt;= 1.0.0.beta4'
</pre></li>
<li><p>Set Javascript driver to <code>:webkit</code> for Capybara in <code>spec_helper.rb</code>.</p>

<pre name="code" class="ruby">Capybara.javascript_driver = :webkit
</pre></li>
<li><p>Configure RSpec use non-transactional fixtures, configure <a href="https://github.com/bmabey/database_cleaner" rel="nofollow" >Database Cleaner</a> in <code>spec_helper.rb</code>.</p>

<p>Notice with this setup, we'll only use truncation strategy when driver is not <code>:rack_test</code>. this will make normal specs run faster.</p>

<pre name="code" class="ruby">config.use_transactional_fixtures = false

config.before :each do
  if Capybara.current_driver == :rack_test
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.start
  else
    DatabaseCleaner.strategy = :truncation
  end
end

config.after :each do
  DatabaseCleaner.clean
end
</pre></li>
<li><p>Tag your scenarios in <code>spec/acceptance/*_spec.rb</code> to use Javascript driver if necessary.</p>

<pre name="code" class="ruby">scenario 'Create a lolita via AJAX', :js =&gt; true do
end
</pre></li>
<li><p>Wait for any AJAX call to be completed in your specs. This is very important, or you will get many strange issues like no database record found, AJAX call get empty response with 0 status code, etc.</p>

<p>For example if you have a simple AJAX form, the <code>success</code> callback will simply redirect browser to another page via <code>location.href = '/yet_another_page';</code>. You can use the following code to wait for it done.</p>

<pre name="code" class="ruby">scenario 'Create a lolita via AJAX', :js =&gt; true do
  visit new_lolita_path

  click_on 'Submit'

  wait_until { page.current_path == lolita_path(Lolita.last) }

  # Your expections for the new page
end
</pre></li>
</ul>

	标签：<a href="http://rainux.org/tag/capybara/" title="Capybara" rel="tag">Capybara</a>, <a href="http://rainux.org/tag/capybara-webkit/" title="capybara-webkit" rel="tag">capybara-webkit</a>, <a href="http://rainux.org/tag/rspec/" title="RSpec" rel="tag">RSpec</a><br />
]]></content:encoded>
			<wfw:commentRss>http://rainux.org/configure-capybara-webkit-to-run-acceptance-specs-with-javascript-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>推荐一些 Ruby on Rails 学习资料</title>
		<link>http://rainux.org/tutorials-and-references-for-ruby-on-rails-learning</link>
		<comments>http://rainux.org/tutorials-and-references-for-ruby-on-rails-learning#comments</comments>
		<pubDate>Tue, 11 Jan 2011 18:04:34 +0000</pubDate>
		<dc:creator>Rainux</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://rainux.org/?p=265</guid>
		<description><![CDATA[Ruby 开始之前应该看看 Ruby 官方网站 上的 About Ruby、Ruby in Twenty Minutes 和 Ruby From Other Languages 得到初步的印象和感性认识。在页面底部可以选择语言查看中文版。 经验比较丰富的开发者可以通过 Ruby User's Guide [注1] 快速入门 Ruby，之后应该准备一本 The Ruby Programming Language 作为日常参考。因为作为 Ruby 语言创始人松本行弘参与编写的书籍，它对 Ruby 语言的介绍最完整。而世界上第一本介绍 Ruby 语言的英文书籍 Programming Ruby 大概是最多人用于入门 Ruby 的书籍，虽然对于有经验的开发者来说它稍显啰嗦。Programming Ruby 第一版有提供免费的在线版本。如果你还没有任何程序设计经验，Ruby Programming: 向Ruby之父学程序设计 应该是不错的选择，作者高桥征义是日本 Ruby 协会会长。 Rails 同样，有经验的开发者可以直接通过 Ruby on Rails Guides 入门 Rails。而 Agile [...]]]></description>
			<content:encoded><![CDATA[<h2>Ruby</h2>

<p>开始之前应该看看 <a href="http://www.ruby-lang.org/" rel="nofollow" >Ruby 官方网站</a> 上的 <a href="http://www.ruby-lang.org/en/about/" rel="nofollow" >About Ruby</a>、<a href="http://www.ruby-lang.org/en/documentation/quickstart/" rel="nofollow" >Ruby in Twenty Minutes</a> 和 <a href="http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/" rel="nofollow" >Ruby From Other Languages</a> 得到初步的印象和感性认识。在页面底部可以选择语言查看中文版。</p>

<p>经验比较丰富的开发者可以通过 <a href="http://www.rubyist.net/~slagell/ruby/" rel="nofollow" >Ruby User's Guide</a> [注1] 快速入门 Ruby，之后应该准备一本 <a href="http://books.google.com/books?id=jcUbTcr5XWwC" rel="nofollow" >The Ruby Programming Language</a> 作为日常参考。因为作为 Ruby 语言创始人松本行弘参与编写的书籍，它对 Ruby 语言的介绍最完整。而世界上第一本介绍 Ruby 语言的英文书籍 <a href="http://ruby-doc.org/docs/ProgrammingRuby/" rel="nofollow" >Programming Ruby</a> 大概是最多人用于入门 Ruby 的书籍，虽然对于有经验的开发者来说它稍显啰嗦。Programming Ruby 第一版有提供免费的在线版本。如果你还没有任何程序设计经验，<a href="http://www.china-pub.com/195252" rel="nofollow" >Ruby Programming: 向Ruby之父学程序设计</a> 应该是不错的选择，作者高桥征义是日本 Ruby 协会会长。</p>

<h2>Rails</h2>

<p>同样，有经验的开发者可以直接通过 <a href="http://guides.rubyonrails.org/" rel="nofollow" >Ruby on Rails Guides</a> 入门 Rails。而 <a href="http://pragprog.com/titles/rails4/agile-web-development-with-rails" rel="nofollow" >Agile Web Development with Rails</a> 则大概是最多人用于入门 Rails 的书籍，它的第四版已经使用目前最新的 Rails 3。</p>

<h2>中文资料</h2>

<p><a href="http://twitter.com/ihower" rel="nofollow" >@ihower</a> 组织的 <a href="http://ruby.tw" rel="nofollow" >Ruby Taiwan</a> 社区有提供 <a href="http://guides.ruby.tw/ruby/" rel="nofollow" >Ruby User's Guide</a> 的繁体中文翻译以及 <a href="http://guides.ruby.tw/rails3/" rel="nofollow" >Ruby on Rails Guides</a> 前两章的繁体中文翻译。<a href="http://twitter.com/ihower" rel="nofollow" >@ihower</a> 自己编写的 <a href="http://ihower.tw/rails3/" rel="nofollow" >Ruby on Rails 實戰手冊</a> 也是一部很不错的面向有一定经验开发者的在线书籍。</p>

<h2>其它</h2>

<p>Ruby on Rails 社区非常注重代码的美观及可读性。使用相同的 coding style 是保证代码美观可读的有效措施之一，所以在自己尝试写代码时应该看看 <a href="https://github.com/chneukirchen/styleguide/blob/master/RUBY-STYLE" rel="nofollow" >Ruby Coding Style Guide</a>。</p>

<p>真正开始使用 Ruby on Rails 之后，<a href="http://www.railsapi.com/" rel="nofollow" >Rails Searchable API Doc</a> 和 <a href="http://rdoc.info/" rel="nofollow" >RubyDoc.info</a> 一定会是最常用的两个在线文档服务。</p>

<p>注1: Ruby User's Guide 写于 Ruby 1.8.3 时代，现在建议使用的 Ruby 版本是 1.8.7。文中提到的 eval.rb 应该使用 irb 取代，另外可以使用 <a href="https://github.com/janlelis/irbtools" rel="nofollow" >irbtools</a> 大幅度增强 irb。Ruby Taiwan 的繁体中文翻译版本对类似问题有提供译注，建议参考。</p>
该日志未加标签。]]></content:encoded>
			<wfw:commentRss>http://rainux.org/tutorials-and-references-for-ruby-on-rails-learning/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>很爽的 Rails CHM Documentation 2.0.2</title>
		<link>http://rainux.org/%e5%be%88%e7%88%bd%e7%9a%84-rails-api-documentation-chm-%e7%89%88%e6%9c%ac</link>
		<comments>http://rainux.org/%e5%be%88%e7%88%bd%e7%9a%84-rails-api-documentation-chm-%e7%89%88%e6%9c%ac#comments</comments>
		<pubDate>Fri, 30 May 2008 07:49:52 +0000</pubDate>
		<dc:creator>Rainux</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.rainux.org/2008/05/30/225</guid>
		<description><![CDATA[delynn 老兄终于发布了他的 Rails CHM Documentation 的 2.0.2 版，再也不用忍受 RailsBrain.com 那个 Rails API with the AJAX flavor 糟糕的目录结构了。 网上流传的所有 Rails 文档都是用 rdoc 从 Rails 源代码里的 RDoc 注释自动生成的，内容都完全一样。但只有这位 delynn 老兄的 Rails CHM Documentation 目录是手工整理的，按照 Module 分类，结构非常清晰。 标签：Ruby on Rails]]></description>
			<content:encoded><![CDATA[<p><a href="http://delynnberry.com/" rel="nofollow" >delynn</a> 老兄终于发布了他的 <a href="http://delynnberry.com/projects/rails-chm-documentation/" rel="nofollow" >Rails CHM Documentation</a> 的 2.0.2 版，再也不用忍受 <a href="http://www.railsbrain.com/" rel="nofollow" >RailsBrain.com</a> 那个 <a href="http://www.railsbrain.com/api/rails-2.0.2/doc/index.html" rel="nofollow" >Rails API with the AJAX flavor</a> 糟糕的目录结构了。</p>

<p>网上流传的所有 Rails 文档都是用 rdoc 从 Rails 源代码里的 RDoc 注释自动生成的，内容都完全一样。但只有这位 delynn 老兄的 Rails CHM Documentation 目录是手工整理的，按照 Module 分类，结构非常清晰。</p>

	标签：<a href="http://rainux.org/tag/ruby-on-rails/" title="Ruby on Rails" rel="tag">Ruby on Rails</a><br />
]]></content:encoded>
			<wfw:commentRss>http://rainux.org/%e5%be%88%e7%88%bd%e7%9a%84-rails-api-documentation-chm-%e7%89%88%e6%9c%ac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

