middleman/middleman-core/features/i18n_v3_preview.feature

252 lines
7.9 KiB
Gherkin
Raw Normal View History

2014-03-28 21:54:54 +01:00
Feature: i18n v3 Preview
2012-04-16 22:30:22 +02:00
In order to preview localized html
2013-10-29 00:42:08 +01:00
2012-04-16 22:30:22 +02:00
Scenario: Running localize with the default config
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3
2012-04-16 22:30:22 +02:00
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
When I go to "/"
Then I should see "Howdy"
When I go to "/hello.html"
Then I should see "Hello World"
When I go to "/morning.html"
Then I should see "Good morning"
When I go to "/one.html"
Then I should see "Only one"
When I go to "/defaults_en/index.html"
Then I should see "File Not Found"
2012-04-16 22:30:22 +02:00
When I go to "/en/index.html"
Then I should see "File Not Found"
When I go to "/en/morning.html"
Then I should see "File Not Found"
When I go to "/defaults_es/index.html"
Then I should see "File Not Found"
2012-04-16 22:30:22 +02:00
When I go to "/es/index.html"
Then I should see "Como Esta?"
When I go to "/es/hola.html"
Then I should see "Hola World"
When I go to "/es/manana.html"
Then I should see "Buenos días"
When I go to "/es/una.html"
Then I should see "Solamente una"
Scenario: A template changes i18n during preview
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
And the file "locales/en.yml" has the contents
"""
---
en:
greetings: "Howdy"
hi: "Hello"
"""
When I go to "/"
Then I should see "Howdy"
When I go to "/hello.html"
Then I should see "Hello World"
When the file "locales/en.yml" has the contents
"""
---
en:
greetings: "How You Doin"
hi: "Sup"
"""
When I go to "/"
Then I should see "How You Doin"
When I go to "/hello.html"
Then I should see "Sup World"
2012-04-16 22:30:22 +02:00
Scenario: Running localize with the alt path config
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3, :path => "/lang_:locale/"
2012-04-16 22:30:22 +02:00
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
When I go to "/"
Then I should see "Howdy"
When I go to "/hello.html"
Then I should see "Hello World"
When I go to "/lang_en/index.html"
Then I should see "File Not Found"
When I go to "/lang_es/index.html"
Then I should see "Como Esta?"
When I go to "/lang_es/hola.html"
Then I should see "Hola World"
2013-10-29 00:42:08 +01:00
2012-04-16 22:30:22 +02:00
Scenario: Running localize with the alt root config
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-alt-root-app"
2012-04-16 22:30:22 +02:00
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3, :templates_dir => "lang_data"
2012-04-16 22:30:22 +02:00
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-alt-root-app"
2012-04-16 22:30:22 +02:00
When I go to "/"
Then I should see "Howdy"
When I go to "/hello.html"
Then I should see "Hello World"
When I go to "/en/index.html"
Then I should see "File Not Found"
When I go to "/es/index.html"
Then I should see "Como Esta?"
When I go to "/es/hola.html"
Then I should see "Hola World"
2013-10-29 00:42:08 +01:00
2012-04-16 22:30:22 +02:00
Scenario: Running localize with the lang map config
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3, :lang_map => { :en => :english, :es => :spanish }
2012-04-16 22:30:22 +02:00
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
When I go to "/"
Then I should see "Howdy"
When I go to "/hello.html"
Then I should see "Hello World"
When I go to "/english/index.html"
Then I should see "File Not Found"
When I go to "/spanish/index.html"
Then I should see "Como Esta?"
When I go to "/spanish/hola.html"
Then I should see "Hola World"
Scenario: Running localize with a non-English mount config
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3, :mount_at_root => :es
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
When I go to "/en/index.html"
Then I should see "Howdy"
When I go to "/en/hello.html"
Then I should see "Hello World"
When I go to "/"
Then I should see "Como Esta?"
When I go to "/hola.html"
Then I should see "Hola World"
When I go to "/manana.html"
Then I should see "Buenos días"
When I go to "/hello.html"
Then I should see "File Not Found"
When I go to "/en/morning.html"
Then I should see "Good morning"
When I go to "/es/manana.html"
Then I should see "File Not Found"
When I go to "/es/index.html"
Then I should see "File Not Found"
When I go to "/es/hola.html"
Then I should see "File Not Found"
Scenario: Running localize with a non-English lang subset
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3, :langs => :es
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
When I go to "/en/index.html"
Then I should see "File Not Found"
When I go to "/en/hello.html"
Then I should see "File Not Found"
When I go to "/"
Then I should see "Como Esta?"
When I go to "/hola.html"
Then I should see "Hola World"
When I go to "/hello.html"
Then I should see "File Not Found"
When I go to "/es/index.html"
Then I should see "File Not Found"
When I go to "/es/hola.html"
Then I should see "File Not Found"
2013-10-29 00:42:08 +01:00
2012-04-16 22:30:22 +02:00
Scenario: Running localize with the no mount config
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3, :mount_at_root => false
2012-04-16 22:30:22 +02:00
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
When I go to "/en/index.html"
Then I should see "Howdy"
When I go to "/en/hello.html"
Then I should see "Hello World"
When I go to "/"
Then I should see "File Not Found"
When I go to "/hello.html"
Then I should see "File Not Found"
When I go to "/es/index.html"
Then I should see "Como Esta?"
When I go to "/es/hola.html"
Then I should see "Hola World"
2013-10-29 00:42:08 +01:00
2012-04-16 22:30:22 +02:00
Scenario: Running localize with the subset config
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3, :langs => [:en]
2012-04-16 22:30:22 +02:00
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
2012-04-16 22:30:22 +02:00
When I go to "/"
Then I should see "Howdy"
When I go to "/hello.html"
Then I should see "Hello World"
When I go to "/en/index.html"
Then I should see "File Not Found"
When I go to "/es/index.html"
Then I should see "File Not Found"
When I go to "/es/hola.html"
2012-09-02 19:04:43 +02:00
Then I should see "File Not Found"
2013-10-29 00:42:08 +01:00
2012-09-02 19:04:43 +02:00
Scenario: Running localize with relative_assets
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-test-app"
2012-09-02 19:04:43 +02:00
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3
2012-09-02 19:04:43 +02:00
activate :relative_assets
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-test-app"
2012-09-02 19:04:43 +02:00
When I go to "/"
Then I should see '"stylesheets/site.css"'
When I go to "/hello.html"
Then I should see '"stylesheets/site.css"'
When I go to "/es/index.html"
Then I should see '"../stylesheets/site.css"'
When I go to "/es/hola.html"
Then I should see '"../stylesheets/site.css"'
Scenario: Missing translations fall back to the default locale
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-default-app"
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3, :mount_at_root => :es
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-default-app"
When I go to "/en/"
Then I should see "Default locale: es"
Then I should see "Current locale: en"
Then I should see "Buenos días"
Then I should see "Howdy"
Scenario: Nested i18n yaml
2014-03-28 21:54:54 +01:00
Given a fixture app "i18n-v3-nested-app"
And a file named "config.rb" with:
"""
2014-03-28 21:54:54 +01:00
activate :i18n_v3
"""
2014-03-28 21:54:54 +01:00
Given the Server is running at "i18n-v3-nested-app"
When I go to "/"
Then I should see "Howdy"
Then I should see "More"
When I go to "/es/"
Then I should see "Como Esta?"
2013-10-29 00:42:08 +01:00
Then I should see "Mucho"