middleman-blog 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG.md +18 -0
  2. data/Gemfile +1 -0
  3. data/features/article_dirs.feature +7 -0
  4. data/features/blog_sources.feature +5 -0
  5. data/features/calendar-and-tag.feature +56 -0
  6. data/features/calendar.feature +71 -12
  7. data/features/future_date.feature +36 -0
  8. data/features/layouts.feature +21 -0
  9. data/features/no_date.feature +9 -0
  10. data/features/paginate.feature +157 -0
  11. data/features/published.feature +33 -0
  12. data/features/support/time_steps.rb +24 -0
  13. data/features/tags.feature +15 -2
  14. data/fixtures/article-dirs-app/config.rb +3 -0
  15. data/fixtures/article-dirs-app/source/blog/2011-01-01-new-article.html.markdown +6 -0
  16. data/fixtures/article-dirs-app/source/blog/2011-01-01-new-article/example.txt +1 -0
  17. data/fixtures/article-dirs-app/source/index.html.erb +9 -0
  18. data/fixtures/article-dirs-app/source/layout.erb +13 -0
  19. data/fixtures/calendar-and-tag-app/config-directory-indexes.rb +10 -0
  20. data/fixtures/calendar-and-tag-app/config.rb +7 -0
  21. data/fixtures/calendar-and-tag-app/source/archive.html.erb +17 -0
  22. data/fixtures/calendar-and-tag-app/source/blog/2011-01-01-new-article.html.markdown +7 -0
  23. data/fixtures/calendar-and-tag-app/source/blog/2011-01-02-another-article.html.markdown +8 -0
  24. data/fixtures/calendar-and-tag-app/source/index.html.erb +7 -0
  25. data/fixtures/calendar-and-tag-app/source/layout.erb +15 -0
  26. data/fixtures/calendar-app/config-directory-indexes.rb +10 -0
  27. data/fixtures/calendar-app/config.rb +3 -1
  28. data/fixtures/calendar-app/source/calendar.html.erb +4 -4
  29. data/fixtures/calendar-app/source/index.html.erb +4 -0
  30. data/fixtures/filename-date-app/config.rb +3 -1
  31. data/fixtures/filename-date-app/source/layout.erb +1 -1
  32. data/fixtures/future-date-app/config.rb +5 -0
  33. data/fixtures/future-date-app/source/_article_template.erb +1 -0
  34. data/fixtures/future-date-app/source/blog/2011-01-01-new-article.html.markdown +6 -0
  35. data/fixtures/future-date-app/source/blog/2012-06-19-future-article.html.markdown +6 -0
  36. data/fixtures/future-date-app/source/blog/2012-06-19-future-article/example.txt +1 -0
  37. data/fixtures/future-date-app/source/index.html.erb +9 -0
  38. data/fixtures/future-date-app/source/layout.erb +13 -0
  39. data/fixtures/layouts-app/config.rb +5 -0
  40. data/fixtures/layouts-app/source/2011/01/01/first-article.html.markdown +7 -0
  41. data/fixtures/layouts-app/source/2011/01/01/second-article.html.markdown +7 -0
  42. data/fixtures/layouts-app/source/2011/01/01/third-article.html.markdown +7 -0
  43. data/fixtures/layouts-app/source/2011/01/02/article-in-normal-layout.markdown +6 -0
  44. data/fixtures/layouts-app/source/2011/01/03/article-without-layout.markdown +7 -0
  45. data/fixtures/layouts-app/source/layouts/first.html.erb +2 -0
  46. data/fixtures/layouts-app/source/layouts/layout.erb +9 -0
  47. data/fixtures/layouts-app/source/layouts/second.html.erb +2 -0
  48. data/fixtures/layouts-app/source/layouts/third.html.erb +2 -0
  49. data/fixtures/no-date-app/config.rb +3 -0
  50. data/fixtures/no-date-app/source/_article_template.erb +1 -0
  51. data/fixtures/no-date-app/source/blog/new-article.html.markdown +6 -0
  52. data/fixtures/no-date-app/source/index.html.erb +9 -0
  53. data/fixtures/no-date-app/source/layout.erb +13 -0
  54. data/fixtures/no-day-app/config.rb +3 -0
  55. data/fixtures/no-day-app/source/2012-08-testing.html.markdown +6 -0
  56. data/fixtures/no-day-app/source/layout.erb +13 -0
  57. data/fixtures/paginate-app/config-directory-indexes.rb +11 -0
  58. data/fixtures/paginate-app/config-paginate-off.rb +8 -0
  59. data/fixtures/paginate-app/config.rb +8 -0
  60. data/fixtures/paginate-app/source/blog/2011-01-01-test-article.html.markdown +6 -0
  61. data/fixtures/paginate-app/source/blog/2011-01-02-test-article.html.markdown +6 -0
  62. data/fixtures/paginate-app/source/blog/2011-01-03-test-article.html.markdown +6 -0
  63. data/fixtures/paginate-app/source/blog/2011-01-04-test-article.html.markdown +6 -0
  64. data/fixtures/paginate-app/source/blog/2011-01-05-test-article.html.markdown +6 -0
  65. data/fixtures/paginate-app/source/blog/2011-02-01-test-article.html.markdown +6 -0
  66. data/fixtures/paginate-app/source/blog/2011-02-02-test-article.html.markdown +6 -0
  67. data/fixtures/paginate-app/source/calendar.html.erb +28 -0
  68. data/fixtures/paginate-app/source/index.html.erb +19 -0
  69. data/fixtures/paginate-app/source/layout.erb +15 -0
  70. data/fixtures/paginate-app/source/tag.html.erb +23 -0
  71. data/fixtures/published-app/config.rb +3 -0
  72. data/fixtures/published-app/source/_article_template.erb +1 -0
  73. data/fixtures/published-app/source/blog/2011-01-01-new-article.html.markdown +6 -0
  74. data/fixtures/published-app/source/blog/2012-06-19-draft-article.html.markdown +7 -0
  75. data/fixtures/published-app/source/blog/2012-06-19-draft-article/example.txt +1 -0
  76. data/fixtures/published-app/source/index.html.erb +9 -0
  77. data/fixtures/published-app/source/layout.erb +13 -0
  78. data/fixtures/tags-app/config-directory-indexes.rb +9 -0
  79. data/fixtures/tags-app/source/index.html.erb +2 -0
  80. data/fixtures/tags-app/source/tag.html.erb +3 -3
  81. data/lib/middleman-blog/blog_article.rb +59 -21
  82. data/lib/middleman-blog/blog_data.rb +59 -7
  83. data/lib/middleman-blog/calendar_pages.rb +50 -3
  84. data/lib/middleman-blog/extension.rb +37 -8
  85. data/lib/middleman-blog/paginator.rb +127 -0
  86. data/lib/middleman-blog/tag_pages.rb +20 -1
  87. data/lib/middleman-blog/template/config.tt +8 -1
  88. data/lib/middleman-blog/template/source/calendar.html.erb +27 -9
  89. data/lib/middleman-blog/template/source/index.html.erb +21 -7
  90. data/lib/middleman-blog/template/source/tag.html.erb +22 -4
  91. data/lib/middleman-blog/version.rb +1 -1
  92. data/middleman-blog.gemspec +3 -2
  93. metadata +211 -55
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ 3.1.0
2
+ ====
3
+ * Don't publish future-dated articles. #74
4
+ * Create summary from source instead of output. #70
5
+ * Deprecate instance variables in templates in favor of locals. #66
6
+ * Allow articles to set "published: false" in frontmatter and show up in preview but not in build/production.
7
+ * Allow articles to have their own layout set in the YAML front matter. #59
8
+ * Per-article content subdirectories. #60
9
+ * Allow article date to be in any order in permalink. #60
10
+ * Use `link_to` in blog templates. #62
11
+ * Pagination for index, tag, and calendar pages. #57
12
+
13
+ 3.0.0
14
+ ====
15
+ * Middleman-3.0 compatible release. Complete overhaul.
16
+ * Tag and calendar pages.
17
+ * Sitemap integration.
18
+ * Lots of bugfixes.
data/Gemfile CHANGED
@@ -20,6 +20,7 @@ group :test do
20
20
  gem "fivemat"
21
21
  gem "aruba", "~> 0.4.11"
22
22
  gem "rspec", "~> 2.7"
23
+ gem "timecop", "~> 0.4.0"
23
24
 
24
25
  platforms :ruby do
25
26
  gem "redcarpet", "~> 2.1.1"
@@ -0,0 +1,7 @@
1
+ Feature: Article-specific subdirectories
2
+ Scenario: Blog articles can have their own subdirectories for related files
3
+ Given the Server is running at "article-dirs-app"
4
+ When I go to "/blog/2011-01-01-new-article/example.txt"
5
+ Then I should see "Not Found"
6
+ When I go to "/2011/01/01/new-article/example.txt"
7
+ Then I should see "Example Text"
@@ -7,3 +7,8 @@ Feature: Flexible article sources
7
7
  Then I should see "Not Found"
8
8
  When I go to "/"
9
9
  Then I should see "/2011/01/01/new-article.html"
10
+
11
+ Scenario: Blog articles can omit the day part
12
+ Given the Server is running at "no-day-app"
13
+ When I go to "/2012/08/01/testing.html"
14
+ Then I should see "Testing Article"
@@ -0,0 +1,56 @@
1
+ Feature: Calendar and Tag pages
2
+ Scenario: Calendar pages are using the same template
3
+ Given the Server is running at "calendar-and-tag-app"
4
+ When I go to "/2011.html"
5
+ Then I should not see "Tag:"
6
+ Then I should see "Year: '2011'"
7
+ Then I should see "Month: ''"
8
+ Then I should see "Day: ''"
9
+
10
+ When I go to "/2011/01.html"
11
+ Then I should not see "Tag:"
12
+ Then I should see "Year: '2011'"
13
+ Then I should see "Month: '1'"
14
+ Then I should see "Day: ''"
15
+
16
+ When I go to "/2011/01/01.html"
17
+ Then I should not see "Tag:"
18
+ Then I should see "Year: '2011'"
19
+ Then I should see "Month: '1'"
20
+ Then I should see "Day: '1'"
21
+
22
+ When I go to "/tags/foo.html"
23
+ Then I should see "Tag: 'foo'"
24
+ Then I should not see "Year:"
25
+ Then I should not see "Month:"
26
+ Then I should not see "Day:"
27
+
28
+ Scenario: Calendar pages also get built
29
+ Given a successfully built app at "calendar-and-tag-app"
30
+ When I cd to "build"
31
+ Then the following files should exist:
32
+ | 2011.html |
33
+ | 2011/01.html |
34
+ | 2011/01/01.html |
35
+ | tags/foo.html |
36
+
37
+ And the file "2011.html" should not contain "Tag:"
38
+ And the file "2011.html" should contain "Year: '2011'"
39
+ And the file "2011.html" should contain "Month: ''"
40
+ And the file "2011.html" should contain "Day: ''"
41
+
42
+ And the file "2011/01.html" should not contain "Tag:'"
43
+ And the file "2011/01.html" should contain "Year: '2011'"
44
+ And the file "2011/01.html" should contain "Month: '1'"
45
+ And the file "2011/01.html" should contain "Day: ''"
46
+
47
+ And the file "2011/01/01.html" should not contain "Tag:"
48
+ And the file "2011/01/01.html" should contain "Year: '2011'"
49
+ And the file "2011/01/01.html" should contain "Month: '1'"
50
+ And the file "2011/01/01.html" should contain "Day: '1'"
51
+
52
+ And the file "tags/foo.html" should contain "Tag: 'foo'"
53
+ And the file "tags/foo.html" should not contain "Year:"
54
+ And the file "tags/foo.html" should not contain "Month:"
55
+ And the file "tags/foo.html" should not contain "Day:"
56
+
@@ -1,12 +1,19 @@
1
1
  Feature: Calendar pages
2
2
  Scenario: Calendar pages are accessible from preview server
3
3
  Given the Server is running at "calendar-app"
4
- When I go to "/2011.html"
4
+ When I go to "/2011/01/01.html"
5
5
  Then I should see "/2011-01-01-new-article.html"
6
+ Then I should not see "/2011-01-02-another-article.html"
7
+ Then I should see "Year: '2011'"
8
+ Then I should see "Month: '1'"
9
+ Then I should see "Day: '1'"
10
+
11
+ When I go to "/2011/01/02.html"
12
+ Then I should not see "/2011-01-01-new-article.html"
6
13
  Then I should see "/2011-01-02-another-article.html"
7
14
  Then I should see "Year: '2011'"
8
- Then I should see "Month: ''"
9
- Then I should see "Day: ''"
15
+ Then I should see "Month: '1'"
16
+ Then I should see "Day: '2'"
10
17
 
11
18
  When I go to "/2011/01.html"
12
19
  Then I should see "/2011-01-01-new-article.html"
@@ -15,16 +22,68 @@ Feature: Calendar pages
15
22
  Then I should see "Month: '1'"
16
23
  Then I should see "Day: ''"
17
24
 
18
- When I go to "/2011/01/01.html"
25
+ When I go to "/2011.html"
19
26
  Then I should see "/2011-01-01-new-article.html"
20
- Then I should not see "/2011-01-02-another-article.html"
27
+ Then I should see "/2011-01-02-another-article.html"
21
28
  Then I should see "Year: '2011'"
22
- Then I should see "Month: '1'"
23
- Then I should see "Day: '1'"
29
+ Then I should see "Month: ''"
30
+ Then I should see "Day: ''"
24
31
 
25
- When I go to "/2011/01/02.html"
32
+ When I go to "/index.html"
33
+ Then I should see "Year Path: '/2011.html'"
34
+ Then I should see "Month Path: '/2011/01.html'"
35
+ Then I should see "Day Path: '/2011/01/01.html'"
36
+
37
+ Scenario: Calendar pages are accessible from preview server with directory_indexes
38
+ Given a fixture app "calendar-app"
39
+ And app "calendar-app" is using config "directory-indexes"
40
+ And the Server is running
41
+ When I go to "/2011.html"
42
+ Then I should see "File Not Found"
43
+
44
+ When I go to "/2011/"
26
45
  Then I should not see "/2011-01-01-new-article.html"
27
- Then I should see "/2011-01-02-another-article.html"
28
- Then I should see "Year: '2011'"
29
- Then I should see "Month: '1'"
30
- Then I should see "Day: '2'"
46
+ Then I should see "/2011-01-01-new-article/"
47
+
48
+ When I go to "/index.html"
49
+ Then I should see "Year Path: '/2011/'"
50
+ Then I should see "Month Path: '/2011/01/'"
51
+ Then I should see "Day Path: '/2011/01/01/'"
52
+
53
+ Scenario: Calendar pages also get built
54
+ Given a successfully built app at "calendar-app"
55
+ When I cd to "build"
56
+ Then the following files should exist:
57
+ | 2011.html |
58
+ | 2011/01.html |
59
+ | 2011/01/01.html |
60
+ | 2011/01/02.html |
61
+
62
+ And the file "2011.html" should contain "/2011-01-01-new-article.html"
63
+ And the file "2011.html" should contain "/2011-01-02-another-article.html"
64
+ And the file "2011.html" should contain "Year: '2011'"
65
+ And the file "2011.html" should contain "Month: ''"
66
+ And the file "2011.html" should contain "Day: ''"
67
+
68
+ And the file "2011/01.html" should contain "/2011-01-01-new-article.html"
69
+ And the file "2011/01.html" should contain "/2011-01-02-another-article.html"
70
+ And the file "2011/01.html" should contain "Year: '2011'"
71
+ And the file "2011/01.html" should contain "Month: '1'"
72
+ And the file "2011/01.html" should contain "Day: ''"
73
+
74
+ And the file "2011/01/01.html" should contain "/2011-01-01-new-article.html"
75
+ And the file "2011/01/01.html" should not contain "/2011-01-02-another-article.html"
76
+ And the file "2011/01/01.html" should contain "Year: '2011'"
77
+ And the file "2011/01/01.html" should contain "Month: '1'"
78
+ And the file "2011/01/01.html" should contain "Day: '1'"
79
+
80
+ And the file "2011/01/02.html" should not contain "/2011-01-01-new-article.html"
81
+ And the file "2011/01/02.html" should contain "/2011-01-02-another-article.html"
82
+ And the file "2011/01/02.html" should contain "Year: '2011'"
83
+ And the file "2011/01/02.html" should contain "Month: '1'"
84
+ And the file "2011/01/02.html" should contain "Day: '2'"
85
+
86
+ And the file "index.html" should contain "Year Path: '/2011.html'"
87
+ And the file "index.html" should contain "Month Path: '/2011/01.html'"
88
+ And the file "index.html" should contain "Day Path: '/2011/01/01.html'"
89
+
@@ -0,0 +1,36 @@
1
+ Feature: Future-dated blog articles
2
+ Scenario: Future-dated articles show up in the preview server
3
+ Given the date is 2012-06-18
4
+ And the Server is running at "future-date-app"
5
+ When I go to "/2011/01/01/new-article.html"
6
+ Then I should see "Newer Article Content"
7
+ When I go to "/2012/06/19/future-article.html"
8
+ Then I should see "This is a future-dated article"
9
+ When I go to "/2012/06/19/future-article/example.txt"
10
+ Then I should see "Example Text"
11
+
12
+ Scenario: Future-dated articles don't show up when the environment is not :development
13
+ Given a fixture app "future-date-app"
14
+ And a file named "config.rb" with:
15
+ """
16
+ set :environment, :production
17
+ Time.zone = "Pacific Time (US & Canada)"
18
+ activate :blog do |blog|
19
+ blog.sources = "blog/:year-:month-:day-:title.html"
20
+ end
21
+ """
22
+ Given the date is 2012-06-18
23
+ And the Server is running at "future-date-app"
24
+ When I go to "/2011/01/01/new-article.html"
25
+ Then I should see "Newer Article Content"
26
+ When I go to "/2012/06/19/future-article.html"
27
+ Then I should see "Not Found"
28
+ When I go to "/2012/06/19/future-article/example.txt"
29
+ Then I should see "Not Found"
30
+
31
+ Given the date is 2012-06-20
32
+ And the Server is running at "future-date-app"
33
+ When I go to "/2012/06/19/future-article.html"
34
+ Then I should see "This is a future-dated article"
35
+ When I go to "/2012/06/19/future-article/example.txt"
36
+ Then I should see "Example Text"
@@ -0,0 +1,21 @@
1
+ Feature: Layouts
2
+ Background:
3
+ Given the Server is running at "layouts-app"
4
+ Scenario: The layout of a blog entry can be set in its front matter.
5
+ When I go to "/2011/01/01/first-article.html"
6
+ Then I should see "First Alternative Layout"
7
+ And I should see "First Article"
8
+ When I go to "/2011/01/01/second-article.html"
9
+ Then I should see "Second Alternative Layout"
10
+ And I should see "Second Article"
11
+ When I go to "/2011/01/01/third-article.html"
12
+ Then I should see "Third Alternative Layout"
13
+ And I should see "Third Article"
14
+ Scenario: The default blog layout is used if none is set in front matter.
15
+ When I go to "/2011/01/02/article-in-normal-layout.html"
16
+ Then I should see "Default Layout"
17
+ And I should see "New Article"
18
+ Scenario: Do not use a layout for the article if set to false in front matter.
19
+ When I go to "/2011/01/03/article-without-layout.html"
20
+ Then I should not see "Default Layout"
21
+ And I should see "Article Content"
@@ -0,0 +1,9 @@
1
+ Feature: Flexible article sources
2
+ Scenario: Blog sources may not include the date in the filename
3
+ Given the Server is running at "no-date-app"
4
+ When I go to "/2011/01/01/new-article.html"
5
+ Then I should see "/2011/01/01/new-article.html"
6
+ When I go to "/blog/new-article.html"
7
+ Then I should see "Not Found"
8
+ When I go to "/"
9
+ Then I should see "/2011/01/01/new-article.html"
@@ -0,0 +1,157 @@
1
+ Feature: Pagination
2
+ Scenario: Index pages are accessible from preview server
3
+ Given the Server is running at "paginate-app"
4
+ When I go to "/2011.html"
5
+ Then I should see "Paginate: true"
6
+ Then I should see "Article Count: 5"
7
+ Then I should see "Page Num: 1"
8
+ Then I should see "Num Pages: 2"
9
+ Then I should see "Per Page: 5"
10
+ Then I should see "Page Start: 1"
11
+ Then I should see "Page End: 5"
12
+ Then I should see "Next Page: '/2011/page/2.html'"
13
+ Then I should see "Prev Page: ''"
14
+ Then I should not see "/2011-01-01-test-article.html"
15
+ Then I should not see "/2011-01-02-test-article.html"
16
+ Then I should see "/2011-01-03-test-article.html"
17
+ Then I should see "/2011-01-04-test-article.html"
18
+ Then I should see "/2011-01-05-test-article.html"
19
+ Then I should see "/2011-02-01-test-article.html"
20
+ Then I should see "/2011-02-02-test-article.html"
21
+
22
+ When I go to "/2011/page/2.html"
23
+ Then I should see "Article Count: 2"
24
+ Then I should see "Page Num: 2"
25
+ Then I should see "Page Start: 6"
26
+ Then I should see "Page End: 7"
27
+ Then I should see "Next Page: ''"
28
+ Then I should see "Prev Page: '/2011.html'"
29
+ Then I should see "/2011-01-01-test-article.html"
30
+ Then I should see "/2011-01-02-test-article.html"
31
+ Then I should not see "/2011-01-03-test-article.html"
32
+ Then I should not see "/2011-01-04-test-article.html"
33
+ Then I should not see "/2011-01-05-test-article.html"
34
+ Then I should not see "/2011-02-01-test-article.html"
35
+ Then I should not see "/2011-02-02-test-article.html"
36
+
37
+ When I go to "/tags/bar.html"
38
+ Then I should see "Paginate: true"
39
+ Then I should see "Article Count: 2"
40
+ Then I should see "Page Num: 1"
41
+ Then I should see "Num Pages: 3"
42
+ Then I should see "Per Page: 2"
43
+ Then I should see "Page Start: 1"
44
+ Then I should see "Page End: 2"
45
+ Then I should see "Next Page: '/tags/bar/page/2.html'"
46
+ Then I should see "Prev Page: ''"
47
+ Then I should see "/2011-02-02-test-article.html"
48
+ Then I should see "/2011-02-01-test-article.html"
49
+ Then I should not see "/2011-02-05-test-article.html"
50
+ Then I should not see "/2011-01-04-test-article.html"
51
+ Then I should not see "/2011-01-03-test-article.html"
52
+
53
+ Scenario: Index pages are accessible from preview server, with pagination off
54
+ Given a fixture app "paginate-app"
55
+ And app "paginate-app" is using config "paginate-off"
56
+ And the Server is running
57
+ When I go to "/2011.html"
58
+ Then I should see "Paginate: false"
59
+ Then I should see "Article Count: 7"
60
+ Then I should see "/2011-01-01-test-article.html"
61
+ Then I should see "/2011-01-02-test-article.html"
62
+ Then I should see "/2011-01-03-test-article.html"
63
+ Then I should see "/2011-01-04-test-article.html"
64
+ Then I should see "/2011-01-05-test-article.html"
65
+ Then I should see "/2011-02-01-test-article.html"
66
+ Then I should see "/2011-02-02-test-article.html"
67
+
68
+ When I go to "/2011/page/2.html"
69
+ Then I should see "File Not Found"
70
+
71
+ When I go to "/tags/bar.html"
72
+ Then I should see "Paginate: false"
73
+ Then I should see "Article Count: 2"
74
+ Then I should see "/2011-02-02-test-article.html"
75
+ Then I should see "/2011-02-01-test-article.html"
76
+ Then I should not see "/2011-01-05-test-article.html"
77
+ Then I should not see "/2011-01-04-test-article.html"
78
+ Then I should not see "/2011-01-03-test-article.html"
79
+
80
+ Scenario: Index pages are accessible from preview server, with directory_indexes on
81
+ Given a fixture app "paginate-app"
82
+ And app "paginate-app" is using config "directory-indexes"
83
+ And the Server is running
84
+ When I go to "/2011.html"
85
+ Then I should see "File Not Found"
86
+
87
+ When I go to "/2011/"
88
+ Then I should see "Next Page: '/2011/page/2/'"
89
+ Then I should not see "/2011-01-03-test-article.html"
90
+ Then I should see "/2011-01-03-test-article/"
91
+
92
+ When I go to "/2011/page/2/"
93
+ Then I should see "Prev Page: '/2011/'"
94
+
95
+ When I go to "/tags/bar/"
96
+ Then I should see "Next Page: '/tags/bar/page/2/'"
97
+
98
+ Scenario: Index pages also get built
99
+ Given a successfully built app at "paginate-app"
100
+ When I cd to "build"
101
+ Then the following files should exist:
102
+ | tags/foo.html |
103
+ | tags/bar.html |
104
+ | tags/bar/page/2.html |
105
+ | tags/bar/page/3.html |
106
+ | 2011.html |
107
+ | 2011/page/2.html |
108
+ Then the following files should not exist:
109
+ | tags.html |
110
+ | calendar.html |
111
+
112
+ And the file "2011/page/2.html" should contain "Year: '2011'"
113
+ And the file "2011/page/2.html" should contain "Month: ''"
114
+ And the file "2011/page/2.html" should contain "Day: ''"
115
+ And the file "2011/page/2.html" should contain "Article Count: 2"
116
+ And the file "2011/page/2.html" should contain "/2011-01-02-test-article.html"
117
+ And the file "2011/page/2.html" should contain "/2011-01-01-test-article.html"
118
+
119
+ And the file "tags/bar/page/2.html" should contain "Tag: bar"
120
+ And the file "tags/bar/page/2.html" should contain "Article Count: 2"
121
+ And the file "tags/bar/page/2.html" should contain "Prev Page: '/tags/bar.html'"
122
+ And the file "tags/bar/page/2.html" should contain "Next Page: '/tags/bar/page/3.html'"
123
+ And the file "tags/bar/page/2.html" should contain "/2011-01-05-test-article.html"
124
+ And the file "tags/bar/page/2.html" should contain "/2011-01-04-test-article.html"
125
+
126
+ And the file "tags/bar/page/3.html" should contain "Tag: bar"
127
+ And the file "tags/bar/page/3.html" should contain "Article Count: 1"
128
+ And the file "tags/bar/page/3.html" should contain "Prev Page: '/tags/bar/page/2.html'"
129
+ And the file "tags/bar/page/3.html" should contain "Next Page: ''"
130
+ And the file "tags/bar/page/3.html" should contain "/2011-01-03-test-article.html"
131
+
132
+ Scenario: Adding a tag to a post in preview adds a new index page
133
+ Given the Server is running at "paginate-app"
134
+ When I go to "/tags/foo.html"
135
+ Then I should see "/2011-01-01-test-article.html"
136
+ Then I should see "Next Page: ''"
137
+
138
+ When I go to "/tags/foo/page/2.html"
139
+ Then I should see "Not Found"
140
+
141
+ And the file "source/blog/2011-02-03-new-article.html.markdown" has the contents
142
+ """
143
+ ---
144
+ title: "Newest Article"
145
+ date: 2011-02-03
146
+ tags: foo
147
+ ---
148
+
149
+ Newer Article Content
150
+ """
151
+ When I go to "/tags/foo.html"
152
+ Then I should see "Next Page: '/tags/foo/page/2.html'"
153
+ Then I should see "/2011-02-03-new-article.html"
154
+ Then I should not see "/2011-01-01-test-article.html"
155
+
156
+ When I go to "/tags/foo/page/2.html"
157
+ Then I should see "/2011-01-01-test-article.html"
@@ -0,0 +1,33 @@
1
+ Feature: Unpublished blog articles
2
+ Scenario: Unpublished articles show up in the preview server
3
+ Given the Server is running at "published-app"
4
+ When I go to "/2011/01/01/new-article.html"
5
+ Then I should see "Newer Article Content"
6
+ When I go to "/2012/06/19/draft-article.html"
7
+ Then I should see "This is a draft"
8
+ When I go to "/2012/06/19/draft-article/example.txt"
9
+ Then I should see "Example Text"
10
+
11
+ Scenario: Unpublished articles don't show up when the environment is not :development
12
+ Given a fixture app "published-app"
13
+ And a file named "config.rb" with:
14
+ """
15
+ set :environment, :production
16
+ activate :blog do |blog|
17
+ blog.sources = "blog/:year-:month-:day-:title.html"
18
+ end
19
+ """
20
+ Given the Server is running at "published-app"
21
+ When I go to "/2012/06/19/draft-article.html"
22
+ Then I should see "Not Found"
23
+ When I go to "/2012/06/19/draft-article/example.txt"
24
+ Then I should see "Not Found"
25
+
26
+ Scenario: Unpublished articles don't get built
27
+ Given a successfully built app at "published-app"
28
+ When I cd to "build"
29
+ Then the following files should not exist:
30
+ | 2012/06/19/draft-article.html |
31
+ | 2012/06/19/draft-article/example.txt |
32
+ Then the following files should exist:
33
+ | 2011/01/01/new-article.html |