• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

[追記 2009.01.20]script/generate featureの項を追加

moroさんの記事を読んで、Cucumber wktk!と思っていたのでtry

http://d.hatena.ne.jp/moro/20081112/1226486135
http://d.hatena.ne.jp/moro/20081118/1226977015
http://gist.github.com/26024

こちらの導入手順を参考しました:
http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails

###必要なgemをinstall

  • rspec
  • rspec-rails
  • cucumber
  • webrat

ローカルには0.1.15を入れたのですが、念のため0.1.13で依存しているというgem:aslakhellesoy-webratもinstallしました。

shell>>
gem sources -a http://gems.github.com
sudo gem install aslakhellesoy-webrat
<<--

###Webratを使うようにCucumberのenvに書く
${RAILS_ROOT}/features/support/env.rb

shell>>
require "webrat"
Webrat.configure do |config|
config.mode = :rails
end
<<--

###script/generate feature
moroさんところのcucumberの構造辺りで紹介されているgeneratorでfeatureやstepsを生成:

shell>>
$ ruby script/generate feature Product
<<--

###Webratの仕様が変わってた
moroさんのgistを下記に保存して使用し始めたのですが、
shell>>
${RAILS_ROOT}/features/step_definitions/webrat_ja_steps.rb
<<--

細かい仕様が変更されていました:
ディレクトリstep_definitionsの位置も変わっているのに加えて、visits => visit、fills_in => fill_inなどが変更されていました。ただ、前もって調べなくても、rake featuresすると仕様変更された旨のmessageが出るので安心です。

rails>>
visit home_path
fill_in "Email", :with => "good@example.com"
<<--

またpendingされたstepには、下記のようにsnippetsが出力されて便利だなぁと思いました:

shell>>
You can use these snippets to implement pending steps which have no step definition:
When /^パラメータを入力する product_comment[body]=dummy comment!$/ do
end
<<--

###Refs
http://moriq.tdiary.net/20081022.html
http://d.hatena.ne.jp/hs9587/20081231/1230691812
http://barkingiguana.com/2008/11/11/getting-started-with-story-driven-development-for-rails-with-cucumber

posted by satoko satoko on Mon 19 Jan 2009 at 15:44 with 0 comments
Contents rssrss
NSAssertやNSLogを無効にする:-DNS_BLOCK_ASSERTIONS=1とNS_BLOCK_ASSERTIONS
GDBでview.frameを表示させる
Core Animationについてのリンク集
[iPhone] new BSDライセンスについてライセンス引用のメモ
Implementing a Container View Controller in UIViewController Class Reference
UITableView用のNSIndexPathの作り方
Xcodeのテンプレート、View-based ApplicationとWindow-based Applicationの違い
CopyOnSelectのLion対応
Xcode4のCode Snippetsを別のPCに移動する+gitで管理する
[iPhone] Singleton: iOS4以降はGCDのdispatch_onceを使う
Tags
iphone開発gitIBInterfaceBuilderiOSSIMBLSnippetsterminaltwitterxcodeXcode4
Comments rssrss
guest guest: Muchos turistas buscan la mejor forma de llegar a ... 05/30 03:19
guest guest: San Antonio de Areco es conocido como la cuna de l... 05/27 19:47
guest guest: Optimizar el tiempo durante un viaje de negocios e... 05/18 00:46
guest guest: Para muchos turistas, el transporte publico y la l... 05/15 18:22
Services from s21g
YOMU Web小説リーダー
小説投稿サイトの公式ページを開き、WebView表示と読み上げ向け表示を切り替えて、移動中や作業中にもWeb小説の続きを聴きやすくするiPhoneアプリです。
補助探
公開されている補助金・助成金情報を集約し、条件に合う制度を探しやすくするサービスです。
jotter.me
個人開発者のためのホスティング一体型ノートサービス
ハンドミラー
iPhone向けの手鏡アプリ
ツイプロ(twpro)
Twitterプロフィールの高速検索エンジン