Easy Internationalization for Your Rails App with BDD, Part III
- Easy Internationalization for Your Rails App with BDD
- Easy Internationalization for Your Rails App with BDD, Part II
- Easy Internationalization for Your Rails App with BDD, Part III
- Easy Internationalization for Your Rails App with BDD, Part IV
Editing A Location.
In the first part, we built an application that lists locations in English and Spanish. In the second part, we added the ability to create new locations in English and Spanish.
In this part we will edit a location, showing localization concerns along the way. Remember, we are using Cucumber and BDD to drive out our application.
Let’s write a scenario to do that.
Scenario: Edit a location Given there is a location named "location 1" And I am on the en site When I Update the location Name to "location has changed" Then I should see "location has changed"Before we commit to that, let’s take a step back. At the end of Part II we refactored our scenarios into scenario outlines. We’ll write the scenario like that to save some refactoring later. We will also use the @wip tag so we can just concentrate on this test for now.
@wipScenario Outline: Edit a location Given I am on the <language> site And there is a location named "<location>" When I "<action>" the location "<field>" to "<new_name>" Then I should see "<new_name>"
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed |The example table holds the parameters for our scenarios. The parameters are the language, the original location name, the action to perform, and the label for the name field. The last parameter specifies the message displayed after the action completes.
Let’s add that to our /features/managing_locations.feature file. Run Cucumber and see what happens.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/managing_locations.feature:34 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed |
1 scenario (1 undefined)4 steps (1 skipped, 1 undefined, 2 passed)0m1.289s
You can implement step definitions for undefined steps with these snippets:
When /^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/ do |arg1, arg2, arg3| pending # express the regexp above with the code you wish you hadend
The --wip switch was used, so the failures were expected. All is good.Not too bad. A couple of steps already pass. Cucumber is telling us what to do next. How would you “Update” the location “Name” to “New name”?
How about?
+ Go to a location’s page.
+ Click on the edit link.
+ Fill in the name field with our new location name.
+ Click the update button.
Sounds good, let’s write those steps.
Open up /features/stepdefinitions/locationssteps.rb and add those steps.
When /^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/ do |button, field, value| visit(location_path(Location.first, :locale => I18n.locale.to_s)) click_link "Edit" fill_in(field, :with => value) click_button(button)endDoes that make sense?
Since we created a location in an earlier step, we grab the first location. We also pass the locale. That will make the following route “/en/locations/1”. Thanks to Capybara the “Edit” link will get clicked. The form will get filled in. And the submit button will be clicked.
Think it’ll work? Let’s run Cucumber.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | no link with title, id or text 'Edit' found (Capybara::ElementNotFound) (eval):2:in `click_link' ./features/step_definitions/location_steps.rb:35:in `/^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/' features/managing_locations.feature:34:in `When I "<action>" the location "<field>" to "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
1 scenario (1 failed)4 steps (1 failed, 1 skipped, 2 passed)0m2.123s
The --wip switch was used, so the failures were expected. All is good.All right. Cucumber is guiding the next task: adding the edit link on the show page. Open up /app/views/locations/show.html.erb
<p><%= link_to "Edit", edit_location_path(@location) %></p>Roll the dice.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | undefined method `edit_location_path' for #<#<Class:0xb4954c>:0xb1bde0> (ActionView::Template::Error) ./app/views/locations/show.html.erb:2:in `_app_views_locations_show_html_erb___614471579_8136790' ... ./features/step_definitions/location_steps.rb:34:in `/^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/' features/managing_locations.feature:34:in `When I "<action>" the location "<field>" to "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
1 scenario (1 failed)4 steps (1 failed, 1 skipped, 2 passed)0m2.041s
The --wip switch was used, so the failures were expected. All is good.We need to define the edit_location route. We can do that. Open up /config/routes.rb and, above the root route, add
match 'locations/:id/edit' => 'locations#edit', :as => :edit_locationvThat should do it. Cucumber, Let’er rip.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | The action 'edit' could not be found for LocationsController (AbstractController::ActionNotFound) (eval):2:in `click_link' ./features/step_definitions/location_steps.rb:35:in `/^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/' features/managing_locations.feature:34:in `When I "<action>" the location "<field>" to "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
1 scenario (1 failed)4 steps (1 failed, 1 skipped, 2 passed)0m2.255s
The --wip switch was used, so the failures were expected. All is good.Huh? We need to add the edit action in the locations controller. Open the location controller file up and add that action
# GET /locations/1/editdef edit @location = Location.find(params[:id])endSecond verse, same as the first. Rerun the test.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | Missing template locations/edit, application/edit with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/Users/johnivanoff/Sites/international/app/views" (ActionView::MissingTemplate) /Users/johnivanoff/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/benchmark.rb:309:in `realtime' (eval):2:in `click_link' ./features/step_definitions/location_steps.rb:35:in `/^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/' features/managing_locations.feature:34:in `When I "<action>" the location "<field>" to "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
1 scenario (1 failed)4 steps (1 failed, 1 skipped, 2 passed)0m2.088s
The --wip switch was used, so the failures were expected. All is good.We need an edit page. Since our edit page and new page are the same we will combine them using partials. Make the form page and then include that partial in the new and edit pages. Extract the form from the new.html.erb file and paste it into the /app/views/locations/_form.html.erb
_form.html.erb
<%= form_for(@location) do |f| %> <p> <%= f.label :name, t('.name_html') %> <%= f.text_field :name %> </p>
<p> <%= f.button t('.button_html') %> </p><% end %>In the new.html.erb, call the form partial.
new.html.erb
<%= render 'form' %>The edit page looks very similar….
edit.html.erb
<%= render 'form' %>Let’s run the test and see what damage we’ve done.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | no button with value or id or text 'Update' found (Capybara::ElementNotFound) (eval):2:in `click_button' ./features/step_definitions/location_steps.rb:37:in `/^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/' features/managing_locations.feature:34:in `When I "<action>" the location "<field>" to "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
1 scenario (1 failed)4 steps (1 failed, 1 skipped, 2 passed)0m2.343s
The --wip switch was used, so the failures were expected. All is good.We don’t see the update button.
According the the en.yml file the button will say Create. If we change that to Update then the test for Create will fail. The original form just had a <%= f.submit %> for the button and it knew when to say Create or Update. Let’s dig into the source code of rails and see how that works.
Check out the form helpers for the actionview around line 1064 it explains how that works. And, OMG, they tell us what to do when using i18n. Freakin’ awesome!
# Those labels can be customized using I18n, under the helpers.submit key and accept # the %{model} as translation interpolation: # # en: # helpers: # submit: # create: "Create a %{model}" # update: "Confirm changes to %{model}"Now, update the en.yml file to reflect that.
en: helpers: submit: create: "Create %{model}" update: "Update %{model}" locations: index: title_html: "Locations" new: name_html: "Name"Run the test.
WAIT! Look at what we did. We no longer have a .button_html in the en.yml file. Now, we’re saying that the helper for submit will say either Create for Post, otherwise it will say Update. That being said, we need to change the button in the form back to the default approach.
<%= form_for(@location) do |f| %> <p> <%= f.label :name, t('.name_html') %> <%= f.text_field :name %> </p>
<p> <%= f.submit %> </p><% end %>That feels cleaner.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | expected there to be content "location has changed" in "Internationalnnlocation 1nEditnn" (RSpec::Expectations::ExpectationNotMetError) ./features/step_definitions/location_steps.rb:15:in `/^(?:|I )should see "([^"]*)"$/' features/managing_locations.feature:35:in `Then I should see "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
1 scenario (1 failed)4 steps (1 failed, 3 passed)0m2.175s
The --wip switch was used, so the failures were expected. All is good._expected there to be content "location has changed" in "International\n\nlocation 1\nEdit\n\n"_ HMMM…that doesn’t seem right. Why does it still say location 1? Let’s look at the test log file.
Open /log/test.log and look at the last few lines.
[1m[36m (0.1ms)[0m [1mbegin transaction[0m [1m[35m (0.1ms)[0m SAVEPOINT active_record_1 [1m[36mSQL (40.8ms)[0m [1mINSERT INTO "locations" ("created_at", "name", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Wed, 07 Mar 2012 20:29:52 UTC +00:00], ["name", "location 1"], ["updated_at", Wed, 07 Mar 2012 20:29:52 UTC +00:00]] [1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1 [1m[36mLocation Load (0.2ms)[0m [1mSELECT "locations".* FROM "locations" LIMIT 1[0m
Started GET "/en/locations/1" for 127.0.0.1 at 2012-03-07 14:29:52 -0600Processing by LocationsController#show as HTML Parameters: {"locale"=>"en", "id"=>"1"} [1m[35mLocation Load (0.2ms)[0m SELECT "locations".* FROM "locations" WHERE "locations"."id" = ? LIMIT 1 [["id", "1"]] Rendered locations/show.html.erb within layouts/application (42.5ms)Completed 200 OK in 207ms (Views: 201.2ms | ActiveRecord: 0.2ms)
Started GET "/en/locations/1/edit" for 127.0.0.1 at 2012-03-07 14:29:53 -0600Processing by LocationsController#edit as HTML Parameters: {"locale"=>"en", "id"=>"1"} [1m[36mLocation Load (0.1ms)[0m [1mSELECT "locations".* FROM "locations" WHERE "locations"."id" = ? LIMIT 1[0m [["id", "1"]] Rendered locations/_form.html.erb (4.7ms) Rendered locations/edit.html.erb within layouts/application (30.1ms)Completed 200 OK in 35ms (Views: 33.0ms | ActiveRecord: 0.1ms)
Started PUT "/en/locations/1" for 127.0.0.1 at 2012-03-07 14:29:53 -0600Processing by LocationsController#show as HTML Parameters: {"utf8"=>"✓", "location"=>{"name"=>"location has changed"}, "commit"=>"Update Location", "locale"=>"en", "id"=>"1"} [1m[35mLocation Load (0.1ms)[0m SELECT "locations".* FROM "locations" WHERE "locations"."id" = ? LIMIT 1 [["id", "1"]] Rendered locations/show.html.erb within layouts/application (0.7ms)Completed 200 OK in 4ms (Views: 2.8ms | ActiveRecord: 0.1ms) [1m[36m (0.9ms)[0m [1mrollback transaction[0mAfter the edit action, it’s routing to the show action. Routing issue! If you look at the last request Started PUT “/en/locations/1″ for 127.0.0.1. It’s using the verb PUT to signify an update action. We have a route for /locations/:id and it goes to the show action. Since that route can use any verb, GET, PUT, or anything else, that route needs to respond to only a GET. Then we need to make a route for the update action that only responds to PUT.
Let’s open up the routes file.
match "locations/(:id)" => 'locations#show', :as => :location, :via => [:get]match "locations/(:id)" => 'locations#update', :as => :location, :via => [:put]Any bets? Will it pass? Roll the cucumber dice.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | The action 'update' could not be found for LocationsController (AbstractController::ActionNotFound) (eval):2:in `click_button' ./features/step_definitions/location_steps.rb:37:in `/^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/' features/managing_locations.feature:34:in `When I "<action>" the location "<field>" to "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
1 scenario (1 failed)4 steps (1 failed, 1 skipped, 2 passed)0m2.312s
The --wip switch was used, so the failures were expected. All is good.There we go. I was expecting this error. Let’s add the update action to the controller.
# PUT /locations/1 # PUT /locations/1.json def update @location = Location.find(params[:id])
respond_to do |format| if @location.update_attributes(params[:location]) format.html { redirect_to @location, notice: 'Location was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @location.errors, status: :unprocessable_entity } end end endYou know what to do next… rerun the test.
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed |
1 scenario (1 passed)4 steps (4 passed)0m2.357s
The --wip switch was used, so I didn't expect anything to pass. These scenarios passed:(::) passed scenarios (::)
features/managing_locations.feature:39:in `| en | location 1 | Update | Name | location has changed |'Break Time!
Implementar la prueba española
Let’s add the Spanish part of the scenario. Add the following valus to the end of the examples table.
| es | location 1 | Actualizar | Nombre | location has changed |Think it will all be green?
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | | es | location 1 | Actualizar | Nombre | location has changed | cannot fill in, no text field, text area or password field with id, name, or label 'Nombre' found (Capybara::ElementNotFound) (eval):2:in `fill_in' ./features/step_definitions/location_steps.rb:36:in `/^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/' features/managing_locations.feature:34:in `When I "<action>" the location "<field>" to "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
2 scenarios (1 failed, 1 passed)8 steps (1 failed, 1 skipped, 6 passed)0m2.508s
The --wip switch was used, so I didn't expect anything to pass. These scenarios passed:(::) passed scenarios (::)
features/managing_locations.feature:39:in `| en | location 1 | Update | Name | location has changed |'Alright, this is familiar. we need to change the es.yml file like we did the en.yml file. Open the spanish locale file.
es: helpers: submit: create: "crear %{model}" update: "Actualizar %{model}"
locations: index: title_html: "Locaciones" new: name_html: "Nombre"Rerun the test. Go green!
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | | es | location 1 | Actualizar | Nombre | location has changed | cannot fill in, no text field, text area or password field with id, name, or label 'Nombre' found (Capybara::ElementNotFound) (eval):2:in `fill_in' ./features/step_definitions/location_steps.rb:36:in `/^I "([^"]*)" the location "([^"]*)" to "([^"]*)"$/' features/managing_locations.feature:34:in `When I "<action>" the location "<field>" to "<new_name>"'
Failing Scenarios:cucumber -p wip features/managing_locations.feature:31 # Scenario: Edit a location
2 scenarios (1 failed, 1 passed)8 steps (1 failed, 1 skipped, 6 passed)0m2.222s
The --wip switch was used, so I didn't expect anything to pass. These scenarios passed:(::) passed scenarios (::)
features/managing_locations.feature:39:in `| en | location 1 | Update | Name | location has changed |'Odd, that worked in the English version. If we fire up the rails server and go to the edit page of a location we see the name field says Name Html for both the English and Spanish locales. What happened? Let’s reflect a little… When we moved the form out of the new.html.erb file and placed it into the _form.html.erb file we didn’t reflect that change in our locale files. Let’s make that change in both locale files.
Before we test again, do you see why the English test passed? If you said it passed because “name” is in the label, you are correct. Take a bow.
Third verse, same as the first
$ cucumber --profile wipUsing the wip profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
@wip Scenario Outline: Edit a location # features/managing_locations.feature:31 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | | es | location 1 | Actualizar | Nombre | location has changed |
2 scenarios (2 passed)8 steps (8 passed)0m2.528s
The --wip switch was used, so I didn't expect anything to pass. These scenarios passed:(::) passed scenarios (::)
features/managing_locations.feature:39:in `| en | location 1 | Update | Name | location has changed |'
features/managing_locations.feature:40:in `| es | location 1 | Actualizar | Nombre | location has changed |'Before we high five, remove the wip tag from the test and run cucumber to run all the tests.
$ cucumberUsing the default profile...Feature: Manage locations In order to manage locations As a user I want to create and edit my locations.
Scenario Outline: List locations # features/managing_locations.feature:6 Given there is a location named "<location>" # features/step_definitions/location_steps.rb:1 And I am on the <language> site # features/step_definitions/location_steps.rb:5 When I am on the locations page # features/step_definitions/location_steps.rb:9 Then I should see "<title>" # features/step_definitions/location_steps.rb:13 And I should see "<location>" # features/step_definitions/location_steps.rb:13
Examples: | location | language | title | | location 1 | en | Locations | | location 2 | es | Locaciones |
Scenario Outline: : Create a new location # features/managing_locations.feature:18 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And I am on new location page # features/step_definitions/location_steps.rb:21 And I fill in "<name>" with "<location>" # features/step_definitions/location_steps.rb:25 And press "<button>" # features/step_definitions/location_steps.rb:29 Then I should see "<location>" # features/step_definitions/location_steps.rb:13
Examples: | language | name | location | button | | en | Name | location 1 | Create | | es | Nombre | location 1 | crear |
Scenario Outline: Edit a location # features/managing_locations.feature:30 Given I am on the <language> site # features/step_definitions/location_steps.rb:5 And there is a location named "<location>" # features/step_definitions/location_steps.rb:1 When I "<action>" the location "<field>" to "<new_name>" # features/step_definitions/location_steps.rb:33 Then I should see "<new_name>" # features/step_definitions/location_steps.rb:13
Examples: | language | location | action | field | new_name | | en | location 1 | Update | Name | location has changed | | es | location 1 | Actualizar | Nombre | location has changed |
6 scenarios (6 passed)28 steps (28 passed)0m5.281s…and curtain.
In this part we dug into the source code of rails. That wasn’t so scary. We looked at log files to help figure out what’s going on. Those are full of valuable information.
Now all we have to do is delete a location and we will have a simple internationalized web application.
Until then.