OSDN Git Service

add manage_unit.feature
authorokimoto <okimoto@good-day.co.jp>
Mon, 15 Mar 2010 07:49:52 +0000 (16:49 +0900)
committerokimoto <okimoto@good-day.co.jp>
Mon, 15 Mar 2010 07:49:52 +0000 (16:49 +0900)
features/manage_unit.feature [new file with mode: 0644]
features/step_definitions/unit_steps.rb [new file with mode: 0644]

diff --git a/features/manage_unit.feature b/features/manage_unit.feature
new file mode 100644 (file)
index 0000000..c848b95
--- /dev/null
@@ -0,0 +1,37 @@
+# language: ja
+フィーチャ: ユニットを管理する
+  ユニットを管理するため
+  管理者として
+  操作を行う
+
+  シナリオ: ユニットを新規作成する
+    前提   言語は"ja"
+    かつ   "admin"としてログインしている
+    もし   "ホーム"ページを表示している
+    かつ   "admin"リンクをクリックする
+    かつ   "ユニット"リンクをクリックする
+    かつ   "New"リンクをクリックする
+    かつ   以下の項目を入力する:
+           | unit_name   | name   |
+           | unit_symbol | symbol |
+    かつ   "Save changes"ボタンをクリックする
+    ならば "Unit was successfully created"と表示されていること
+
+  シナリオ: ユニットを削除する
+    前提   言語は"ja"
+    かつ   以下のユニットを用意する:
+           | name  | symbol   |
+           | name1 | symbol_a |
+           | name2 | symbol_b |
+           | name3 | symbol_c |
+           | name4 | symbol_d |
+           | name5 | symbol_e |
+    かつ   "admin"としてログインしている
+    もし   "3"番目のユニットを削除する
+    ならば 以下のテーブルが"table#units tr"に表示されていること:
+           | 表示名 | シンボル |
+           | name1 | symbol_a |
+           | name2 | symbol_b |
+           | name4 | symbol_d |
+           | name5 | symbol_e |
+    
diff --git a/features/step_definitions/unit_steps.rb b/features/step_definitions/unit_steps.rb
new file mode 100644 (file)
index 0000000..091f9fb
--- /dev/null
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+Given /^the following units:$/ do |units|
+  Unit.create!(units.hashes)
+end
+
+Given /^以下のユニットを用意する:$/ do |units|
+  Given %{the following units:}, units
+end
+
+When /^I delete the (\d+)(?:st|nd|rd|th) units$/ do |pos|
+  visit admin_units_url
+  within("table#units tbody tr:nth-child(#{pos.to_i})") do
+    click_link "Destroy"
+  end
+end
+
+When /^"(\d+)"番目のユニットを削除する$/ do |pos|
+  When %{I delete the #{pos}st units}
+end
+
+Then /^I should see the following units:$/ do |expected_units_table|
+  expected_units_table.diff!(tableish('table tr', 'td,th'))
+end