--- /dev/null
+# 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 |
+
--- /dev/null
+# -*- 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