Test for issue 1709; parent relations with localized and non-localized sources

move_new_block
Ulrich Gabor 2016-01-05 15:08:26 +01:00
parent 5684caeee6
commit bdeb19059a
10 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,38 @@
Feature: i18n merging path trees
Scenario: Mixing localized and non-localized sources and merging the path trees (see issue #1709)
Given a fixture app "i18n-test-app"
And a file named "config.rb" with:
"""
activate :i18n, mount_at_root: :en, langs: [:en, :es]
"""
Given the Server is running at "i18n-mixed-sources"
When I go to "/"
Then I should see "Current locale: en"
Then I should see "path: is-localized Home"
When I go to "/es"
Then I should see "Current locale: es"
Then I should see "path: is-localized Home"
When I go to "/a/"
Then I should see "Current locale: en"
Then I should see "path: is-localized Home # a/index.html.erb"
When I go to "/es/a/"
Then I should see "Current locale: es"
Then I should see "path: is-localized Home # a/index.html.erb"
When I go to "/b/"
Then I should see "Current locale: en"
Then I should see "path: is-localized Home # b/index.html.erb"
When I go to "/a/sub.html"
Then I should see "Current locale: en"
Then I should see "path: is-localized Home # a/index.html.erb # a/sub.html.erb"
When I go to "/b/sub.html"
Then I should see "Current locale: en"
Then I should see "path: is-localized Home # b/index.html.erb # b/sub.html.erb"
Then I should see "Current locale: es"
When I go to "/es/b/sub.html"
Then I should see "path: is-localized Home # b/index.html.erb # b/sub.html.erb"

View File

@ -0,0 +1 @@
activate :i18n, mount_at_root: :en, langs: [:en, :es]

View File

@ -0,0 +1,4 @@
---
en:
greetings: "Howdy"
hi: "Hello"

View File

@ -0,0 +1,4 @@
---
es:
greetings: "Como Esta?"
hi: "Hola"

View File

@ -0,0 +1,9 @@
---
title: a/sub.html.erb
---
Current locale: <%= I18n.locale %>
path: <%=
hierarchy = [current_page]
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
hierarchy.collect {|page| page.data.title }.join(" # ")
%>

View File

@ -0,0 +1,9 @@
---
title: b/index.html.erb
---
Current locale: <%= I18n.locale %>
path: <%=
hierarchy = [current_page]
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
hierarchy.collect {|page| page.data.title }.join(" # ")
%>

View File

@ -0,0 +1,9 @@
---
title: non-localized Home
---
Current locale: <%= I18n.locale %>
path: <%=
hierarchy = [current_page]
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
hierarchy.collect {|page| page.data.title }.join(" # ")
%>

View File

@ -0,0 +1,9 @@
---
title: a/index.html.erb
---
Current locale: <%= I18n.locale %>
path: <%=
hierarchy = [current_page]
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
hierarchy.collect {|page| page.data.title }.join(" # ")
%>

View File

@ -0,0 +1,9 @@
---
title: b/sub.html.erb
---
Current locale: <%= I18n.locale %>
path: <%=
hierarchy = [current_page]
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
hierarchy.collect {|page| page.data.title }.join(" # ")
%>

View File

@ -0,0 +1,9 @@
---
title: is-localized Home
---
Current locale: <%= I18n.locale %>
path: <%=
hierarchy = [current_page]
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
hierarchy.collect {|page| page.data.title }.join(" # ")
%>