Merge pull request #90 from netfighter/bugfix/8230_missing_translation_when_deleting_cost_type

pull/6827/head
Hagen Schink 11 years ago
commit 1db973e19d
  1. 3
      config/locales/de.yml
  2. 3
      config/locales/en.yml
  3. 7
      features/cost_types/deletion.feature
  4. 23
      features/step_definitions/cost_type_steps.rb

@ -203,3 +203,6 @@ de:
x_entries: x_entries:
one: "1 Eintrag" one: "1 Eintrag"
other: "%{count} Einträge" other: "%{count} Einträge"
js:
text_are_you_sure: "Sind Sie sicher?"

@ -203,3 +203,6 @@ en:
x_entries: x_entries:
one: "1 Entry" one: "1 Entry"
other: "%{count} Entries" other: "%{count} Entries"
js:
text_are_you_sure: "Are you sure?"

@ -36,3 +36,10 @@ Feature: Cost type deletion
Then the cost type "cost_type1" should be listed as deleted on the index page Then the cost type "cost_type1" should be listed as deleted on the index page
@javascript
Scenario: Click on the "delete" link for a cost type
When I go to the index page of cost types
Then I expect to click "OK" on a confirmation box saying "Are you sure?"
And I click the delete link for the cost type "cost_type1"
And the confirmation box should have been displayed

@ -47,6 +47,29 @@ When(/^I delete the cost type "(.*?)"$/) do |name|
end end
end end
When(/^I click the delete link for the cost type "(.*?)"$/) do |name|
ct = CostType.find_by_name name
within ("#delete_cost_type_#{ct.id}") do
find('a.submit_cost_type').click
end
end
When /^I expect to click "([^"]*)" on a confirmation box saying "([^"]*)"$/ do |option, message|
retval = (option == 'OK') ? 'true' : 'false'
page.evaluate_script("window.confirm = function (msg) {
document.cookie = msg
return #{retval}
}")
@expected_message = message.gsub("\\n", "\n")
end
When /^the confirmation box should have been displayed$/ do
assert page.evaluate_script('document.cookie').include?(@expected_message),
"Expected confirm box with message: '#{@expected_message}'" +
" got: '#{page.evaluate_script('document.cookie')}'"
end
Then(/^the cost type "(.*?)" should not be listed on the index page$/) do |name| Then(/^the cost type "(.*?)" should not be listed on the index page$/) do |name|
if has_css?(".cost_types") if has_css?(".cost_types")

Loading…
Cancel
Save