シナリオ: ユニットを新規作成する
前提 言語は"ja"
かつ "admin"としてログインしている
- もし "ホーム"ページを表示している
- かつ "admin"リンクをクリックする
- かつ "ユニット"リンクをクリックする
- かつ "New"リンクをクリックする
- かつ 以下の項目を入力する:
+ かつ "新規ユニット"ページを表示している
+ もし 以下の項目を入力する:
| unit_name | name |
| unit_symbol | symbol |
かつ "Save changes"ボタンをクリックする
シナリオ: ユニットを削除する
前提 言語は"ja"
- かつ 以下のユニットを用意する:
+ かつ 以下の"units"を用意する:
| name | symbol |
| name1 | symbol_a |
| name2 | symbol_b |
| name4 | symbol_d |
| name5 | symbol_e |
かつ "admin"としてログインしている
- もし "3"番目のユニットを削除する
- ならば 以下のテーブルが"table#units tr"に表示されていること:
+ かつ "ユニット一覧"ページを表示している
+ もし "3"番目のレコードを削除する
+ ならば 以下のテーブルが"table.list tr"に表示されていること:
| 表示名 | シンボル |
| name1 | symbol_a |
| name2 | symbol_b |
Then /^以下のテーブルが"(.+?)"に表示されていること:$/ do |selector, expected|
expected.diff!(tableish(selector, "th,td").to_a)
end
+
+Given /^the following (.+?):$/ do |table_name, attributes|
+ table_name.classify.constantize.create!(attributes.hashes)
+end
+
+Given /^以下の"(.+?)"を用意する:$/ do |table_name, attributes|
+ Given %{the following #{table_name}:}, attributes
+end
+
+When /^I delete the (\d+)(?:st|nd|rd|th) records$/ do |pos|
+ within("table.list tbody tr:nth-child(#{pos.to_i})") do
+ click_link "Destroy"
+ end
+end
+
+When /^"(\d+)"番目のレコードを削除する$/ do |pos|
+ When %{I delete the #{pos}st records}
+end
+++ /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
when /the home\s?page/, /ホーム/
'/'
+ when /the new affiliation page/, /新規所属/
+ new_admin_affiliation_path
+
when /the new user page/
new_admin_user_path
url_for(:controller => '/auth')
when /the admin page/, /管理/
url_for(:controller => '/admin')
+ when /the units index page/, /ユニット一覧/
+ admin_units_path
+ when /the affiliations index page/, /所属一覧/
+ admin_affiliations_path
else
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"