seiten 0.0.1 → 0.0.2

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.
@@ -1 +1 @@
1
- 90351
1
+ 7523
@@ -2,13 +2,67 @@ require 'test_helper'
2
2
 
3
3
  class NavigationTest < ActionDispatch::IntegrationTest
4
4
 
5
- def test_returns_navigation
5
+ def test_returns_2_level_deep_navigation
6
+ p Seiten.config[:storage_directory]
6
7
  visit "/"
7
8
  assert has_content?("Home")
8
9
  assert has_content?("Products")
9
- assert has_content?("Kreatify")
10
- assert has_content?("Ruvetia")
10
+ assert has_content?("Logo Design")
11
+ assert has_content?("Web Development")
12
+ assert has_content?("Hire us")
11
13
  assert has_content?("About")
14
+ assert has_content?("Our Team")
15
+ assert has_content?("Works")
16
+ assert has_content?("Partners")
12
17
  assert has_content?("Contact")
13
18
  end
19
+
20
+ def test_does_not_return_3_level_deep_pages
21
+ visit "/"
22
+ assert !has_content?("Daniel Puglisi")
23
+ assert !has_content?("Codegestalt")
24
+ assert !has_content?("Kreatify")
25
+ end
26
+
27
+ def test_redirects_to_first_child_page
28
+ visit "/about"
29
+ assert_equal "/about/our-team", current_path
30
+ end
31
+
32
+ def test_returns_sub_navigation
33
+ visit "/about/partners"
34
+ assert has_content?("Daniel Puglisi")
35
+ assert has_content?("Codegestalt")
36
+ assert has_content?("Kreatify")
37
+ end
38
+
39
+ def test_returns_breadcrumb_navigation
40
+ visit "/about/our-team/switzerland"
41
+ assert has_content?("> About")
42
+ assert has_content?("> Our Team")
43
+ assert has_content?("> Switzerland")
44
+ end
45
+
46
+ def test_returns_clicked_breadcrumb_page
47
+ visit "/about/our-team/switzerland"
48
+ find(".breadcrumb a", text: "Our Team").click
49
+ assert_equal "/about/our-team", current_path
50
+ end
51
+
52
+ def test_returns_clicked_navigation_page
53
+ visit "/"
54
+ click_link "Web Development"
55
+ assert_equal "/products/web-development", current_path
56
+ end
57
+
58
+ def test_redirects_to_linked_page
59
+ visit "/"
60
+ click_link "Hire us"
61
+ assert_equal "/contact", current_path
62
+ end
63
+
64
+ def test_returns_external_links
65
+ visit "/about/partners"
66
+ assert has_xpath?("//a[@href='http://danielpuglisi.com']")
67
+ end
14
68
  end
data/test/page_test.rb CHANGED
@@ -4,7 +4,7 @@ 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 10, pages.count
7
+ assert_equal 15, pages.count
8
8
  end
9
9
 
10
10
  def test_returns_page_title
@@ -22,7 +22,7 @@ class PageTest < Test::Unit::TestCase
22
22
 
23
23
  def test_returns_children_pages
24
24
  page = Seiten::Page.find(2)
25
- assert_equal ["Kreatify", "Ruvetia"], page.children.map(&:title)
25
+ assert_equal ["Logo Design", "Web Development", "Hire us"], page.children.map(&:title)
26
26
  end
27
27
 
28
28
  def test_returns_true_if_page_is_child_of_parent
@@ -31,8 +31,8 @@ class PageTest < Test::Unit::TestCase
31
31
  end
32
32
 
33
33
  def test_returns_true_if_page_child_is_deeply_nested
34
- child = Seiten::Page.find(5)
35
- assert_equal true, Seiten::Page.find(2).parent_of?(child)
34
+ child = Seiten::Page.find_by_slug("/about/our-team")
35
+ assert_equal true, Seiten::Page.find_by_slug("/about").parent_of?(child)
36
36
  end
37
37
 
38
38
  def test_returns_false_if_page_is_not_child_of_parent
@@ -56,7 +56,7 @@ class PageTest < Test::Unit::TestCase
56
56
  end
57
57
 
58
58
  def test_finds_page_by_slug
59
- page = Seiten::Page.find_by_slug("/products/ruvetia")
60
- assert_equal "Ruvetia", page.title
59
+ page = Seiten::Page.find_by_slug("/products/logo-design")
60
+ assert_equal "Logo Design", page.title
61
61
  end
62
62
  end
data/test/test_helper.rb CHANGED
@@ -16,8 +16,9 @@ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
16
16
  end
17
17
 
18
18
  class Test::Unit::TestCase
19
- Seiten.config[:storage_type] = :yaml
20
- Seiten.config[:storage_file] = File.join('..', 'fixtures', 'navigation.yml')
19
+ # Seiten.config[:storage_type] = :yaml
20
+ # Seiten.config[:storage_file] = File.join('..', 'fixtures', 'navigation.yml')
21
+ # Seiten.config[:storage_directory] = File.join('app', 'pages')
21
22
  end
22
23
 
23
24
  class ActionDispatch::IntegrationTest
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.1
4
+ version: 0.0.2
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-07-23 00:00:00.000000000 Z
11
+ date: 2013-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -77,7 +77,16 @@ files:
77
77
  - test/dummy/app/assets/stylesheets/application.css
78
78
  - test/dummy/app/controllers/application_controller.rb
79
79
  - test/dummy/app/helpers/application_helper.rb
80
+ - test/dummy/app/pages/about/our-team/italy.html.erb
81
+ - test/dummy/app/pages/about/our-team/switzerland.html.erb
82
+ - test/dummy/app/pages/about/our-team.html.erb
83
+ - test/dummy/app/pages/about/partners.html.erb
84
+ - test/dummy/app/pages/about/works.html.erb
85
+ - test/dummy/app/pages/contact.html.erb
80
86
  - test/dummy/app/pages/home.html.erb
87
+ - test/dummy/app/pages/products/logo-design.html.erb
88
+ - test/dummy/app/pages/products/web-development.html.erb
89
+ - test/dummy/app/pages/products.html.erb
81
90
  - test/dummy/app/views/layouts/application.html.erb
82
91
  - test/dummy/config/application.rb
83
92
  - test/dummy/config/boot.rb
@@ -111,7 +120,6 @@ files:
111
120
  - test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
112
121
  - test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
113
122
  - test/dummy/tmp/pids/server.pid
114
- - test/fixtures/navigation.yml
115
123
  - test/integration/navigation_test.rb
116
124
  - test/page_test.rb
117
125
  - test/seiten_test.rb
@@ -144,7 +152,16 @@ test_files:
144
152
  - test/dummy/app/assets/stylesheets/application.css
145
153
  - test/dummy/app/controllers/application_controller.rb
146
154
  - test/dummy/app/helpers/application_helper.rb
155
+ - test/dummy/app/pages/about/our-team/italy.html.erb
156
+ - test/dummy/app/pages/about/our-team/switzerland.html.erb
157
+ - test/dummy/app/pages/about/our-team.html.erb
158
+ - test/dummy/app/pages/about/partners.html.erb
159
+ - test/dummy/app/pages/about/works.html.erb
160
+ - test/dummy/app/pages/contact.html.erb
147
161
  - test/dummy/app/pages/home.html.erb
162
+ - test/dummy/app/pages/products/logo-design.html.erb
163
+ - test/dummy/app/pages/products/web-development.html.erb
164
+ - test/dummy/app/pages/products.html.erb
148
165
  - test/dummy/app/views/layouts/application.html.erb
149
166
  - test/dummy/config/application.rb
150
167
  - test/dummy/config/boot.rb
@@ -178,7 +195,6 @@ test_files:
178
195
  - test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
179
196
  - test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
180
197
  - test/dummy/tmp/pids/server.pid
181
- - test/fixtures/navigation.yml
182
198
  - test/integration/navigation_test.rb
183
199
  - test/page_test.rb
184
200
  - test/seiten_test.rb
@@ -1,17 +0,0 @@
1
- - title: "Home"
2
- url: "/"
3
-
4
- - title: "Products"
5
- nodes:
6
- - title: "Kreatify"
7
- nodes:
8
- - title: "About"
9
- - title: "Pricing"
10
- - title: "Ruvetia"
11
- redirect: true
12
- nodes:
13
- - title: "Meetups"
14
- - title: "Team"
15
-
16
- - title: "About"
17
- - title: "Contact"