16. RubyでTDDをしてみる
1.Cucumberで1つのシナリオに焦点を合わせる
#
language:
ja
機能:
文字列の表示
シナリオ:
sample.rbを実行する
#
features/sample.feature:4
もしsample.rbを実行した場合
#
features/sample.feature:5
かつメッセージが出力される
#
features/sample.feature:6
ならば"Hiroshima.rb
#027"と表示している
#
features/sample.feature:7
1
scenario
(1
undefined)
3
steps
(3
undefined)
0m0.003s Step definitions
You
can
implement
step
definitions
for
undefined
steps
with
these
snippets: に書いてね
もし
/^sample.rbを実行した場合$/
do
pending
#
express
the
regexp
above
with
the
code
you
wish
you
had
end
もし
/^メッセージが出力される$/
do
pending
#
express
the
regexp
above
with
the
code
you
wish
you
had
end
ならば
/^"(.*?)"と表示している$/
do
|arg1|
pending
#
express
the
regexp
above
with
the
code
you
wish
you
had
end
13年2月2日土曜日 16
17. RubyでTDDをしてみる
2.失敗するステップ定義を書く
# coding: utf-8
もし /^sample.rbを実行した場合$/ do
pending # express the regexp above with the code you wish you had
end
もし /^メッセージが出力される$/ do
pending # express the regexp above with the code you wish you had
end
ならば /^"(.*?)"と表示している$/ do |arg1|
pending # express the regexp above with the code you wish you had
end
13年2月2日土曜日 17