seiten 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/seiten/pages_controller.rb +19 -2
  3. data/app/helpers/seiten_helper.rb +11 -8
  4. data/config/initializers/seiten.rb +1 -0
  5. data/lib/seiten/controllers/helpers.rb +1 -1
  6. data/lib/seiten/page.rb +29 -23
  7. data/lib/seiten/page_store.rb +71 -6
  8. data/lib/seiten/routes_helper.rb +16 -0
  9. data/lib/seiten/version.rb +1 -1
  10. data/lib/seiten.rb +5 -3
  11. data/test/dummy/app/pages/de/produkte.html.erb +1 -0
  12. data/test/dummy/app/pages/en/about/partners.html.erb +1 -0
  13. data/test/dummy/app/pages/en/products.html.erb +1 -0
  14. data/test/dummy/app/pages/localization.html.erb +1 -0
  15. data/test/dummy/config/navigation/de.yml +36 -0
  16. data/test/dummy/config/navigation/en.yml +37 -0
  17. data/test/dummy/config/navigation.yml +3 -1
  18. data/test/dummy/config/routes.rb +2 -0
  19. data/test/dummy/log/development.log +7019 -2550
  20. data/test/dummy/log/test.log +11327 -3072
  21. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  22. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  23. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  24. data/test/dummy/tmp/pids/server.pid +1 -1
  25. data/test/integration/i18n_test.rb +37 -0
  26. data/test/integration/navigation_test.rb +7 -1
  27. data/test/page_test.rb +9 -5
  28. data/test/seiten_test.rb +4 -2
  29. data/test/test_helper.rb +0 -5
  30. metadata +48 -24
  31. data/app/views/seiten/pages/show.html.erb +0 -1
  32. data/config/routes.rb +0 -11
  33. data/test/dummy/app/pages/about/partners.html.erb +0 -1
  34. data/test/dummy/app/pages/products.html.erb +0 -0
  35. /data/test/dummy/app/pages/{about → en/about}/our-team/italy.html.erb +0 -0
  36. /data/test/dummy/app/pages/{about → en/about}/our-team/switzerland.html.erb +0 -0
  37. /data/test/dummy/app/pages/{about → en/about}/our-team.html.erb +0 -0
  38. /data/test/dummy/app/pages/{about → en/about}/works.html.erb +0 -0
  39. /data/test/dummy/app/pages/{contact.html.erb → en/contact.html.erb} +0 -0
  40. /data/test/dummy/app/pages/{home.html.erb → en/home.html.erb} +0 -0
  41. /data/test/dummy/app/pages/{products → en/products}/logo-design.html.erb +0 -0
  42. /data/test/dummy/app/pages/{products → en/products}/web-development.html.erb +0 -0
@@ -1 +1 @@
1
- 69184
1
+ 80065
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+
3
+ class I18nTest < ActionDispatch::IntegrationTest
4
+
5
+ def test_returns_page_in_root_if_not_found_in_locale_directory
6
+ visit "/localization"
7
+ assert_equal 200, status_code
8
+ assert has_content?("I18n is in root")
9
+ end
10
+
11
+ def test_returns_products_page_in_en_directory
12
+ I18n.locale = :en
13
+ visit "/products"
14
+ assert has_content?("This is the products page")
15
+ end
16
+
17
+ def test_returns_products_page_in_de_directory
18
+ I18n.locale = :de
19
+ visit "/produkte"
20
+ assert has_content?("Das ist die Produkte Seite")
21
+ end
22
+
23
+ def test_loads_de_navigation
24
+ I18n.locale = :de
25
+ assert_equal File.join(Rails.root, "config", "navigation", "de.yml"), Seiten::PageStore.new.storage_file
26
+ end
27
+
28
+ def test_loads_en_navigation
29
+ I18n.locale = :en
30
+ assert_equal File.join(Rails.root, "config", "navigation", "en.yml"), Seiten::PageStore.new.storage_file
31
+ end
32
+
33
+ # def test_loads_navigation_without_locale_if_not_found
34
+ # I18n.locale = :fr
35
+ # assert_equal File.join(Rails.root, "config", "navigation.yml"), Seiten::PageStore.new.storage_file
36
+ # end
37
+ end
@@ -3,7 +3,6 @@ require 'test_helper'
3
3
  class NavigationTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  def test_returns_2_level_deep_navigation
6
- p Seiten.config[:storage_directory]
7
6
  visit "/"
8
7
  assert has_content?("Home")
9
8
  assert has_content?("Products")
@@ -24,6 +23,13 @@ class NavigationTest < ActionDispatch::IntegrationTest
24
23
  assert !has_content?("Kreatify")
25
24
  end
26
25
 
26
+ def test_returns_home_url
27
+ visit "/contact"
28
+ assert_equal "/contact", current_path
29
+ click_link "Home"
30
+ assert_equal "/", current_path
31
+ end
32
+
27
33
  def test_returns_sub_navigation
28
34
  visit "/about/partners"
29
35
  assert has_content?("Daniel Puglisi")
data/test/page_test.rb CHANGED
@@ -4,15 +4,19 @@ class PageTest < Test::Unit::TestCase
4
4
 
5
5
  def test_returns_correct_number_of_page_objects
6
6
  pages = Seiten::Page.all
7
- assert_equal 15, pages.count
7
+ assert_equal 16, pages.count
8
8
  end
9
9
 
10
10
  def test_returns_page_title
11
11
  assert_equal "Home", Seiten::Page.find(1).title
12
12
  end
13
13
 
14
+ def test_returns_nil_for_root_page_slug
15
+ assert_equal nil, Seiten::Page.find(1).slug
16
+ end
17
+
14
18
  def test_returns_page_slug
15
- assert_equal "/", Seiten::Page.find(1).slug
19
+ assert_equal "about/our-team", Seiten::Page.find(7).slug
16
20
  end
17
21
 
18
22
  def test_returns_page_layout
@@ -35,8 +39,8 @@ class PageTest < Test::Unit::TestCase
35
39
  end
36
40
 
37
41
  def test_returns_true_if_page_child_is_deeply_nested
38
- child = Seiten::Page.find_by_slug("/about/our-team")
39
- assert_equal true, Seiten::Page.find_by_slug("/about").parent_of?(child)
42
+ child = Seiten::Page.find_by_slug("about/our-team")
43
+ assert_equal true, Seiten::Page.find_by_slug("about").parent_of?(child)
40
44
  end
41
45
 
42
46
  def test_returns_false_if_page_is_not_child_of_parent
@@ -60,7 +64,7 @@ class PageTest < Test::Unit::TestCase
60
64
  end
61
65
 
62
66
  def test_finds_page_by_slug
63
- page = Seiten::Page.find_by_slug("/products/logo-design")
67
+ page = Seiten::Page.find_by_slug("products/logo-design")
64
68
  assert_equal "Logo Design", page.title
65
69
  end
66
70
 
data/test/seiten_test.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class SeitenTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, Seiten
4
+
5
+ def test_returns_page_storage_path
6
+ assert_equal File.join(Rails.root, "app/pages/home.html.erb"), Seiten::PageStore.current.file_path(filename: "home.html.erb")
7
+ assert_equal File.join(Rails.root, "app/pages/en/contact.html.erb"), Seiten::PageStore.current.file_path(filename: "contact.html.erb", locale: "en")
6
8
  end
7
9
  end
data/test/test_helper.rb CHANGED
@@ -10,11 +10,6 @@ Rails.backtrace_cleaner.remove_silencers!
10
10
  # Load support files
11
11
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
12
12
 
13
- # Load fixtures from the engine
14
- if ActiveSupport::TestCase.method_defined?(:fixture_path=)
15
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
16
- end
17
-
18
13
  class Test::Unit::TestCase
19
14
  # Seiten.config[:storage_type] = :yaml
20
15
  # Seiten.config[:storage_file] = File.join('..', 'fixtures', 'navigation.yml')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seiten
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Puglisi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-20 00:00:00.000000000 Z
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '3.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.2'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sqlite3
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -62,12 +76,12 @@ extra_rdoc_files: []
62
76
  files:
63
77
  - app/controllers/seiten/pages_controller.rb
64
78
  - app/helpers/seiten_helper.rb
65
- - app/views/seiten/pages/show.html.erb
66
- - config/routes.rb
79
+ - config/initializers/seiten.rb
67
80
  - lib/seiten/controllers/helpers.rb
68
81
  - lib/seiten/engine.rb
69
82
  - lib/seiten/page.rb
70
83
  - lib/seiten/page_store.rb
84
+ - lib/seiten/routes_helper.rb
71
85
  - lib/seiten/version.rb
72
86
  - lib/seiten.rb
73
87
  - lib/tasks/sticky_pages_tasks.rake
@@ -78,16 +92,18 @@ files:
78
92
  - test/dummy/app/controllers/application_controller.rb
79
93
  - test/dummy/app/controllers/pages_controller.rb
80
94
  - test/dummy/app/helpers/application_helper.rb
81
- - test/dummy/app/pages/about/our-team/italy.html.erb
82
- - test/dummy/app/pages/about/our-team/switzerland.html.erb
83
- - test/dummy/app/pages/about/our-team.html.erb
84
- - test/dummy/app/pages/about/partners.html.erb
85
- - test/dummy/app/pages/about/works.html.erb
86
- - test/dummy/app/pages/contact.html.erb
87
- - test/dummy/app/pages/home.html.erb
88
- - test/dummy/app/pages/products/logo-design.html.erb
89
- - test/dummy/app/pages/products/web-development.html.erb
90
- - test/dummy/app/pages/products.html.erb
95
+ - test/dummy/app/pages/de/produkte.html.erb
96
+ - test/dummy/app/pages/en/about/our-team/italy.html.erb
97
+ - test/dummy/app/pages/en/about/our-team/switzerland.html.erb
98
+ - test/dummy/app/pages/en/about/our-team.html.erb
99
+ - test/dummy/app/pages/en/about/partners.html.erb
100
+ - test/dummy/app/pages/en/about/works.html.erb
101
+ - test/dummy/app/pages/en/contact.html.erb
102
+ - test/dummy/app/pages/en/home.html.erb
103
+ - test/dummy/app/pages/en/products/logo-design.html.erb
104
+ - test/dummy/app/pages/en/products/web-development.html.erb
105
+ - test/dummy/app/pages/en/products.html.erb
106
+ - test/dummy/app/pages/localization.html.erb
91
107
  - test/dummy/app/views/layouts/application.html.erb
92
108
  - test/dummy/app/views/layouts/home.html.erb
93
109
  - test/dummy/app/views/layouts/products.html.erb
@@ -107,6 +123,8 @@ files:
107
123
  - test/dummy/config/initializers/session_store.rb
108
124
  - test/dummy/config/initializers/wrap_parameters.rb
109
125
  - test/dummy/config/locales/en.yml
126
+ - test/dummy/config/navigation/de.yml
127
+ - test/dummy/config/navigation/en.yml
110
128
  - test/dummy/config/navigation.yml
111
129
  - test/dummy/config/routes.rb
112
130
  - test/dummy/config.ru
@@ -125,6 +143,7 @@ files:
125
143
  - test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
126
144
  - test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
127
145
  - test/dummy/tmp/pids/server.pid
146
+ - test/integration/i18n_test.rb
128
147
  - test/integration/layout_test.rb
129
148
  - test/integration/navigation_test.rb
130
149
  - test/integration/redirect_test.rb
@@ -161,16 +180,18 @@ test_files:
161
180
  - test/dummy/app/controllers/application_controller.rb
162
181
  - test/dummy/app/controllers/pages_controller.rb
163
182
  - test/dummy/app/helpers/application_helper.rb
164
- - test/dummy/app/pages/about/our-team/italy.html.erb
165
- - test/dummy/app/pages/about/our-team/switzerland.html.erb
166
- - test/dummy/app/pages/about/our-team.html.erb
167
- - test/dummy/app/pages/about/partners.html.erb
168
- - test/dummy/app/pages/about/works.html.erb
169
- - test/dummy/app/pages/contact.html.erb
170
- - test/dummy/app/pages/home.html.erb
171
- - test/dummy/app/pages/products/logo-design.html.erb
172
- - test/dummy/app/pages/products/web-development.html.erb
173
- - test/dummy/app/pages/products.html.erb
183
+ - test/dummy/app/pages/de/produkte.html.erb
184
+ - test/dummy/app/pages/en/about/our-team/italy.html.erb
185
+ - test/dummy/app/pages/en/about/our-team/switzerland.html.erb
186
+ - test/dummy/app/pages/en/about/our-team.html.erb
187
+ - test/dummy/app/pages/en/about/partners.html.erb
188
+ - test/dummy/app/pages/en/about/works.html.erb
189
+ - test/dummy/app/pages/en/contact.html.erb
190
+ - test/dummy/app/pages/en/home.html.erb
191
+ - test/dummy/app/pages/en/products/logo-design.html.erb
192
+ - test/dummy/app/pages/en/products/web-development.html.erb
193
+ - test/dummy/app/pages/en/products.html.erb
194
+ - test/dummy/app/pages/localization.html.erb
174
195
  - test/dummy/app/views/layouts/application.html.erb
175
196
  - test/dummy/app/views/layouts/home.html.erb
176
197
  - test/dummy/app/views/layouts/products.html.erb
@@ -190,6 +211,8 @@ test_files:
190
211
  - test/dummy/config/initializers/session_store.rb
191
212
  - test/dummy/config/initializers/wrap_parameters.rb
192
213
  - test/dummy/config/locales/en.yml
214
+ - test/dummy/config/navigation/de.yml
215
+ - test/dummy/config/navigation/en.yml
193
216
  - test/dummy/config/navigation.yml
194
217
  - test/dummy/config/routes.rb
195
218
  - test/dummy/config.ru
@@ -208,6 +231,7 @@ test_files:
208
231
  - test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
209
232
  - test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
210
233
  - test/dummy/tmp/pids/server.pid
234
+ - test/integration/i18n_test.rb
211
235
  - test/integration/layout_test.rb
212
236
  - test/integration/navigation_test.rb
213
237
  - test/integration/redirect_test.rb
@@ -1 +0,0 @@
1
- <%= render_html %>
data/config/routes.rb DELETED
@@ -1,11 +0,0 @@
1
- Rails.application.routes.draw do
2
-
3
- # Redirects
4
- Seiten::Page.all.each do |page|
5
- if page.redirect
6
- get page.slug => redirect(page.redirect)
7
- end
8
- end
9
-
10
- get "/*page" => "seiten/pages#show", as: :seiten_page
11
- end
@@ -1 +0,0 @@
1
- <%= seiten_navigation parent_id: Seiten::Page.find_by_slug("/about/partners").id %>
File without changes