comfy_blog 1.12.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -15
  3. data/Gemfile +7 -6
  4. data/LICENSE +1 -1
  5. data/README.md +14 -9
  6. data/Rakefile +1 -32
  7. data/app/controllers/comfy/admin/blog/posts_controller.rb +26 -22
  8. data/app/controllers/comfy/blog/posts_controller.rb +31 -38
  9. data/app/models/comfy/blog/post.rb +34 -36
  10. data/app/views/comfy/admin/blog/partials/_navigation.html.haml +4 -6
  11. data/app/views/comfy/admin/blog/posts/_form.html.haml +23 -11
  12. data/app/views/comfy/admin/blog/posts/edit.html.haml +2 -2
  13. data/app/views/comfy/admin/blog/posts/index.html.haml +29 -25
  14. data/app/views/comfy/admin/blog/posts/new.html.haml +2 -2
  15. data/app/views/comfy/blog/posts/index.html.haml +25 -10
  16. data/app/views/comfy/blog/posts/index.rss.builder +12 -12
  17. data/app/views/layouts/comfy/blog/application.html.erb +22 -0
  18. data/comfy_blog.gemspec +3 -1
  19. data/config/application.rb +13 -7
  20. data/config/blog_routes.rb +2 -2
  21. data/config/environments/development.rb +37 -4
  22. data/config/environments/test.rb +13 -4
  23. data/config/initializers/comfy_blog.rb +3 -7
  24. data/config/locales/cs.yml +38 -0
  25. data/config/locales/da.yml +38 -0
  26. data/config/locales/de.yml +38 -0
  27. data/config/locales/en.yml +38 -0
  28. data/config/locales/es.yml +38 -0
  29. data/config/locales/fr.yml +38 -0
  30. data/config/locales/it.yml +38 -0
  31. data/config/locales/ja.yml +38 -0
  32. data/config/locales/nb.yml +38 -0
  33. data/config/locales/nl.yml +38 -0
  34. data/config/locales/pl.yml +38 -0
  35. data/config/locales/pt-BR.yml +38 -0
  36. data/config/locales/ru.yml +38 -0
  37. data/config/locales/sv.yml +38 -0
  38. data/config/locales/tr.yml +38 -0
  39. data/config/locales/uk.yml +38 -0
  40. data/config/locales/zh-CN.yml +38 -0
  41. data/config/locales/zh-TW.yml +38 -0
  42. data/config/storage.yml +35 -0
  43. data/db/migrate/00_create_cms.rb +144 -116
  44. data/db/migrate/01_create_blog.rb +15 -43
  45. data/lib/comfy_blog/configuration.rb +9 -9
  46. data/lib/comfy_blog/engine.rb +7 -7
  47. data/lib/comfy_blog/routes/blog.rb +12 -13
  48. data/lib/comfy_blog/routes/blog_admin.rb +7 -12
  49. data/lib/comfy_blog/version.rb +1 -1
  50. data/lib/generators/comfy/blog/blog_generator.rb +16 -14
  51. data/test/controllers/comfy/admin/blog/posts_controller_test.rb +83 -59
  52. data/test/controllers/comfy/blog/posts_controller_test.rb +56 -42
  53. data/test/fixtures/comfy/blog/posts.yml +3 -4
  54. data/test/fixtures/comfy/cms/layouts.yml +10 -0
  55. data/test/fixtures/comfy/cms/sites.yml +1 -1
  56. data/test/fixtures/generators/blog/routes.rb +2 -3
  57. data/test/gemfiles/Gemfile.rails.5.2 +22 -0
  58. data/test/generators/blog_generator_test.rb +7 -7
  59. data/test/integration/i18n_test.rb +37 -0
  60. data/test/lib/configuration_test.rb +4 -5
  61. data/test/models/posts_test.rb +35 -30
  62. data/test/test_helper.rb +40 -29
  63. metadata +29 -35
  64. data/app/controllers/comfy/admin/blog/base_controller.rb +0 -12
  65. data/app/controllers/comfy/admin/blog/blogs_controller.rb +0 -51
  66. data/app/controllers/comfy/admin/blog/comments_controller.rb +0 -33
  67. data/app/controllers/comfy/blog/base_controller.rb +0 -33
  68. data/app/controllers/comfy/blog/comments_controller.rb +0 -33
  69. data/app/models/comfy/blog/blog.rb +0 -31
  70. data/app/models/comfy/blog/comment.rb +0 -29
  71. data/app/views/comfy/admin/blog/blogs/_form.html.haml +0 -11
  72. data/app/views/comfy/admin/blog/blogs/edit.html.haml +0 -5
  73. data/app/views/comfy/admin/blog/blogs/index.html.haml +0 -26
  74. data/app/views/comfy/admin/blog/blogs/new.html.haml +0 -5
  75. data/app/views/comfy/admin/blog/comments/_comment.html.haml +0 -17
  76. data/app/views/comfy/admin/blog/comments/index.html.haml +0 -17
  77. data/app/views/comfy/admin/blog/comments/toggle_publish.js.erb +0 -1
  78. data/app/views/comfy/blog/comments/_form.html.haml +0 -10
  79. data/app/views/comfy/blog/posts/show.html.haml +0 -18
  80. data/app/views/layouts/comfy/blog/application.html.haml +0 -7
  81. data/config/initializers/secret_token.rb +0 -15
  82. data/test/controllers/comfy/admin/blog/blogs_controller_test.rb +0 -94
  83. data/test/controllers/comfy/admin/blog/comments_controller_test.rb +0 -57
  84. data/test/controllers/comfy/blog/comments_controller_test.rb +0 -36
  85. data/test/fixtures/comfy/blog/blogs.yml +0 -7
  86. data/test/fixtures/comfy/blog/comments.yml +0 -6
  87. data/test/gemfiles/Gemfile.rails.4.0 +0 -10
  88. data/test/gemfiles/Gemfile.rails.4.1 +0 -10
  89. data/test/gemfiles/Gemfile.rails.4.2 +0 -10
  90. data/test/gemfiles/Gemfile.rails.master +0 -10
  91. data/test/models/blog_test.rb +0 -59
  92. data/test/models/comments_test.rb +0 -45
@@ -1,21 +1,21 @@
1
1
  module ComfyBlog
2
2
  class Configuration
3
3
 
4
+ # Application layout to be used to index blog posts.
5
+ # Default is 'comfy/blog/application'
6
+ attr_accessor :app_layout
7
+
4
8
  # Number of posts per page. Default is 10
5
9
  attr_accessor :posts_per_page
6
10
 
7
- # Comments can be automatically approved/published by changing this setting
8
- # Default is false.
9
- attr_accessor :auto_publish_comments
10
-
11
- # A default author can be specified for posts
12
- attr_accessor :default_author
11
+ # Auto-setting parameter derived from the routes
12
+ attr_accessor :public_blog_path
13
13
 
14
14
  # Configuration defaults
15
15
  def initialize
16
- @posts_per_page = 10
17
- @auto_publish_comments = false
18
- @default_author = nil
16
+ @posts_per_page = 10
17
+ @app_layout = 'comfy/blog/application'
18
+ @public_blog_path = nil
19
19
  end
20
20
 
21
21
  end
@@ -4,16 +4,16 @@ require 'comfortable_mexican_sofa'
4
4
  require 'comfy_blog'
5
5
 
6
6
  module ComfyBlog
7
-
7
+
8
8
  module CmsSiteExtensions
9
9
  extend ActiveSupport::Concern
10
- included do
11
- has_many :blogs,
12
- :class_name => 'Blog::Blog',
13
- :dependent => :destroy
10
+ included do
11
+ has_many :blog_posts,
12
+ class_name: 'Blog::Post',
13
+ dependent: :destroy
14
14
  end
15
15
  end
16
-
16
+
17
17
  class Engine < ::Rails::Engine
18
18
  initializer 'comfy_blog.configuration' do |app|
19
19
  ComfortableMexicanSofa::ViewHooks.add(:navigation, '/comfy/admin/blog/partials/navigation')
@@ -22,4 +22,4 @@ module ComfyBlog
22
22
  end
23
23
  end
24
24
  end
25
- end
25
+ end
@@ -1,20 +1,19 @@
1
1
  class ActionDispatch::Routing::Mapper
2
2
 
3
3
  def comfy_route_blog(options = {})
4
- options[:path] ||= 'blog'
5
- path = ['(:cms_path)', options[:path], '(:blog_path)'].join('/')
6
-
7
- scope :module => :comfy, :as => :comfy do
8
- namespace :blog, :path => path, :constraints => {:blog_path => /\w[a-z0-9_-]*/} do
9
- with_options :constraints => {:year => /\d{4}/, :month => /\d{1,2}/} do |o|
10
- o.get ':year' => 'posts#index', :as => :posts_of_year
11
- o.get ':year/:month' => 'posts#index', :as => :posts_of_month
12
- o.get ':year/:month/:slug' => 'posts#show', :as => :posts_dated
4
+
5
+ ComfyBlog.configuration.public_blog_path = options[:path] || 'blog'
6
+ path = ['(:cms_path)', ComfyBlog.configuration.public_blog_path].join('/')
7
+
8
+ scope module: :comfy, as: :comfy do
9
+ namespace :blog, path: path do
10
+ with_options constraints: {year: /\d{4}/, month: /\d{1,2}/} do |o|
11
+ o.get ':year', to: 'posts#index', as: :posts_of_year
12
+ o.get ':year/:month', to: 'posts#index', as: :posts_of_month
13
+ o.get ':year/:month/:slug', to: 'posts#show', as: :post
14
+ o.get '/', to: 'posts#index', as: :posts
13
15
  end
14
- post ':slug/comments' => 'comments#create', :as => :comments
15
- get ':slug' => 'posts#serve', :as => :post
16
- get '/' => 'posts#serve', :as => :posts
17
16
  end
18
17
  end
19
18
  end
20
- end
19
+ end
@@ -1,20 +1,15 @@
1
1
  class ActionDispatch::Routing::Mapper
2
-
2
+
3
3
  def comfy_route_blog_admin(options = {})
4
4
  options[:path] ||= 'admin'
5
5
  path = [options[:path], 'sites', ':site_id'].join('/')
6
-
7
- scope :module => :comfy, :as => :comfy do
8
- scope :module => :admin do
9
- namespace :blog, :as => :admin, :path => path, :except => [:show] do
10
- resources :blogs do
11
- resources :posts
12
- resources :comments, :only => [:index, :destroy] do
13
- patch :toggle_publish, :on => :member
14
- end
15
- end
6
+
7
+ scope module: :comfy, as: :comfy do
8
+ scope module: :admin do
9
+ namespace :blog, as: :admin, path: path, except: [:show] do
10
+ resources :posts, as: :blog_posts, path: "blog-posts"
16
11
  end
17
12
  end
18
13
  end
19
14
  end
20
- end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module ComfyBlog
2
- VERSION = "1.12.3"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -3,47 +3,49 @@ require 'rails/generators/active_record'
3
3
  module Comfy
4
4
  module Generators
5
5
  class BlogGenerator < Rails::Generators::Base
6
-
6
+
7
7
  include Rails::Generators::Migration
8
8
  include Thor::Actions
9
-
9
+
10
10
  source_root File.expand_path('../../../../..', __FILE__)
11
-
11
+
12
12
  def self.next_migration_number(dirname)
13
13
  ActiveRecord::Generators::Base.next_migration_number(dirname)
14
14
  end
15
-
15
+
16
16
  def generate_migration
17
17
  destination = File.expand_path('db/migrate/01_create_blog.rb', self.destination_root)
18
18
  migration_dir = File.dirname(destination)
19
19
  destination = self.class.migration_exists?(migration_dir, 'create_blog')
20
-
20
+
21
21
  if destination
22
22
  puts "\e[0m\e[31mFound existing create_blog migration. Remove it if you want to regenerate.\e[0m"
23
23
  else
24
24
  migration_template 'db/migrate/01_create_blog.rb', 'db/migrate/create_blog.rb'
25
25
  end
26
26
  end
27
-
27
+
28
28
  def generate_initialization
29
29
  copy_file 'config/initializers/comfy_blog.rb',
30
30
  'config/initializers/comfy_blog.rb'
31
31
  end
32
-
32
+
33
33
  def generate_routing
34
- route_string = " comfy_route :blog_admin, :path => '/admin'\n"
35
- route_string << " comfy_route :blog, :path => '/blog'\n"
36
- route route_string[2..-1]
34
+ route_string = <<-RUBY.strip_heredoc
35
+ comfy_route :blog_admin, path: "/admin"
36
+ comfy_route :blog, path: "/blog"
37
+ RUBY
38
+ route route_string
37
39
  end
38
-
40
+
39
41
  def generate_views
40
42
  directory 'app/views/comfy/blog', 'app/views/comfy/blog'
41
43
  end
42
-
44
+
43
45
  def show_readme
44
46
  readme 'lib/generators/comfy/blog/README'
45
47
  end
46
-
48
+
47
49
  end
48
50
  end
49
- end
51
+ end
@@ -1,108 +1,132 @@
1
1
  require_relative '../../../../test_helper'
2
2
 
3
- class Comfy::Admin::Blog::PostsControllerTest < ActionController::TestCase
4
-
5
- def setup
6
- @site = comfy_cms_sites(:default)
7
- @blog = comfy_blog_blogs(:default)
8
- @post = comfy_blog_posts(:default)
3
+ class Comfy::Admin::Blog::PostsControllerTest < ActionDispatch::IntegrationTest
4
+
5
+ setup do
6
+ @site = comfy_cms_sites(:default)
7
+ @layout = comfy_cms_layouts(:default)
8
+ @post = comfy_blog_posts(:default)
9
9
  end
10
-
10
+
11
11
  def test_get_index
12
- get :index, :site_id => @site, :blog_id => @blog
12
+ r :get, comfy_admin_blog_posts_path(@site)
13
13
  assert_response :success
14
14
  assert assigns(:posts)
15
15
  assert_template :index
16
16
  end
17
-
18
- def test_get_new
19
- get :new, :site_id => @site, :blog_id => @blog
17
+
18
+ def test_get_index_with_no_posts
19
+ Comfy::Blog::Post.delete_all
20
+ r :get, comfy_admin_blog_posts_path(@site)
21
+ assert_response :redirect
22
+ assert_redirected_to action: :new
23
+ end
24
+
25
+ def test_get_index_with_category
26
+ category = @site.categories.create!(
27
+ label: 'Test Category',
28
+ categorized_type: 'Comfy::Blog::Post'
29
+ )
30
+ category.categorizations.create!(categorized: @post)
31
+
32
+ r :get, comfy_admin_blog_posts_path(@site), params: {categories: category.label}
20
33
  assert_response :success
21
- assert assigns(:post)
22
- assert_template :new
23
- assert_select "form[action='/admin/sites/#{@site.id}/blogs/#{@blog.id}/posts']"
34
+ assert assigns(:posts)
35
+ assert_equal 1, assigns(:posts).count
36
+ assert assigns(:posts).first.categories.member? category
24
37
  end
25
-
26
- def test_get_new_with_default_author
27
- ComfyBlog.config.default_author = 'Default Author'
28
- get :new, :site_id => @site, :blog_id => @blog
38
+
39
+ def test_get_index_with_category_invalid
40
+ r :get, comfy_admin_blog_posts_path(@site), params: {categories: 'invalid'}
41
+ assert_response :success
42
+ assert assigns(:posts)
43
+ assert_equal 0, assigns(:posts).count
44
+ end
45
+
46
+ def test_get_new
47
+ r :get, new_comfy_admin_blog_post_path(@site)
29
48
  assert_response :success
30
49
  assert assigns(:post)
31
- assert_equal 'Default Author', assigns(:post).author
50
+ assert_template :new
51
+ assert_select "form[action='/admin/sites/#{@site.id}/blog-posts']"
32
52
  end
33
-
53
+
34
54
  def test_creation
35
- assert_difference 'Comfy::Blog::Post.count' do
36
- post :create, :site_id => @site, :blog_id => @blog, :post => {
37
- :title => 'Test Post',
38
- :slug => 'test-post',
39
- :content => 'Test Content',
40
- :excerpt => 'Test Excerpt',
41
- :published_at => 2.days.ago.to_s(:db),
42
- :is_published => '1'
43
- }
55
+ post_count = -> {Comfy::Blog::Post.count}
56
+ frag_count = -> {Comfy::Cms::Fragment.count}
57
+ assert_difference [post_count, frag_count] do
58
+ r :post, comfy_admin_blog_posts_path(@site), params: {post: {
59
+ title: 'Test Post',
60
+ slug: 'test-post',
61
+ published_at: 2.days.ago.to_s(:db),
62
+ is_published: '1',
63
+ layout_id: @layout,
64
+ fragments_attributes: [
65
+ { identifier: 'content',
66
+ content: 'test text' }
67
+ ]
68
+ }}
44
69
  assert_response :redirect
45
- assert_redirected_to :action => :edit, :id => assigns(:post)
70
+ assert_redirected_to action: :edit, id: assigns(:post)
46
71
  assert_equal 'Blog Post created', flash[:success]
47
72
  end
48
73
  end
49
-
74
+
50
75
  def test_creation_failure
51
- assert_no_difference 'Comfy::Blog::Post.count' do
52
- post :create, :site_id => @site, :blog_id => @blog, :post => { }
76
+ assert_no_difference ->{Comfy::Blog::Post.count} do
77
+ r :post, comfy_admin_blog_posts_path(@site), params: {post: {}}
53
78
  assert_response :success
54
79
  assert_template :new
55
80
  assert assigns(:post)
56
- assert_equal 'Failed to create Blog Post', flash[:error]
81
+ assert_equal 'Failed to create Blog Post', flash[:danger]
57
82
  end
58
83
  end
59
-
84
+
60
85
  def test_get_edit
61
- get :edit, :site_id => @site, :blog_id => @blog, :id => @post
86
+ r :get, edit_comfy_admin_blog_post_path(@site, @post)
62
87
  assert_response :success
63
88
  assert_template :edit
64
89
  assert assigns(:post)
65
- assert_select "form[action='/admin/sites/#{@site.id}/blogs/#{@blog.id}/posts/#{@post.id}']"
90
+ assert_select "form[action='/admin/sites/#{@site.id}/blog-posts/#{@post.id}']"
66
91
  end
67
-
92
+
68
93
  def test_get_edit_failure
69
- get :edit, :site_id => @site, :blog_id => @blog, :id => 'invalid'
94
+ r :get, edit_comfy_admin_blog_post_path(@site, 'invalid')
70
95
  assert_response :redirect
71
- assert_redirected_to :action => :index
72
- assert_equal 'Blog Post not found', flash[:error]
96
+ assert_redirected_to action: :index
97
+ assert_equal 'Blog Post not found', flash[:danger]
73
98
  end
74
-
99
+
75
100
  def test_update
76
- put :update, :site_id => @site, :blog_id => @blog, :id => @post, :post => {
77
- :title => 'Updated Post'
78
- }
101
+ r :put, comfy_admin_blog_post_path(@site, @post), params: {post: {
102
+ title: 'Updated Post'
103
+ }}
79
104
  assert_response :redirect
80
- assert_redirected_to :action => :edit, :id => assigns(:post)
105
+ assert_redirected_to action: :edit, id: assigns(:post)
81
106
  assert_equal 'Blog Post updated', flash[:success]
82
-
107
+
83
108
  @post.reload
84
109
  assert_equal 'Updated Post', @post.title
85
110
  end
86
-
111
+
87
112
  def test_update_failure
88
- put :update, :site_id => @site, :blog_id => @blog, :id => @post, :post => {
89
- :title => ''
90
- }
113
+ r :put, comfy_admin_blog_post_path(@site, @post), params: {post: {
114
+ title: ''
115
+ }}
91
116
  assert_response :success
92
117
  assert_template :edit
93
- assert_equal 'Failed to update Blog Post', flash[:error]
94
-
118
+ assert_equal 'Failed to update Blog Post', flash[:danger]
119
+
95
120
  @post.reload
96
121
  assert_not_equal '', @post.title
97
122
  end
98
-
123
+
99
124
  def test_destroy
100
- assert_difference 'Comfy::Blog::Post.count', -1 do
101
- delete :destroy, :site_id => @site, :blog_id => @blog, :id => @post
125
+ assert_difference -> {Comfy::Blog::Post.count}, -1 do
126
+ r :delete, comfy_admin_blog_post_path(@site, @post)
102
127
  assert_response :redirect
103
- assert_redirected_to :action => :index
128
+ assert_redirected_to action: :index
104
129
  assert_equal 'Blog Post removed', flash[:success]
105
130
  end
106
131
  end
107
-
108
- end
132
+ end
@@ -1,80 +1,94 @@
1
1
  require_relative '../../../test_helper'
2
2
 
3
- class Comfy::Blog::PostsControllerTest < ActionController::TestCase
4
-
3
+ class Comfy::Blog::PostsControllerTest < ActionDispatch::IntegrationTest
4
+
5
5
  def setup
6
- @blog = comfy_blog_blogs(:default)
6
+ @site = comfy_cms_sites(:default)
7
7
  @post = comfy_blog_posts(:default)
8
8
  end
9
-
9
+
10
10
  def test_get_index
11
- get :serve
11
+ get comfy_blog_posts_path
12
12
  assert_response :success
13
13
  assert_template :index
14
- assert assigns(:posts)
15
- assert_equal 1, assigns(:posts).size
14
+ assert assigns(:blog_posts)
15
+ assert_equal 1, assigns(:blog_posts).size
16
16
  end
17
-
17
+
18
18
  def test_get_index_as_rss
19
- get :serve, :format => :rss
19
+ get comfy_blog_posts_path, params: {format: :rss}
20
20
  assert_response :success
21
21
  assert_template :index
22
- assert assigns(:posts)
23
- assert_equal 1, assigns(:posts).size
22
+ assert assigns(:blog_posts)
23
+ assert_equal 1, assigns(:blog_posts).size
24
24
  end
25
-
25
+
26
26
  def test_get_index_with_unpublished
27
27
  comfy_blog_posts(:default).update_column(:is_published, false)
28
- get :serve
28
+ get comfy_blog_posts_path
29
29
  assert_response :success
30
- assert_equal 0, assigns(:posts).size
30
+ assert_equal 0, assigns(:blog_posts).size
31
31
  end
32
-
32
+
33
33
  def test_get_index_for_year_archive
34
- get :index, :year => 2012
34
+ get comfy_blog_posts_of_year_path(@site.path, 2012)
35
35
  assert_response :success
36
- assert_equal 1, assigns(:posts).size
37
-
38
- get :index, :year => 1999
36
+ assert_equal 1, assigns(:blog_posts).size
37
+
38
+ get comfy_blog_posts_of_year_path(@site.path, 1999)
39
39
  assert_response :success
40
- assert_equal 0, assigns(:posts).size
40
+ assert_equal 0, assigns(:blog_posts).size
41
41
  end
42
-
42
+
43
43
  def test_get_index_for_month_archive
44
- get :index, :year => 2012, :month => 1
44
+ get comfy_blog_posts_of_month_path(@site.path, 2012, 1)
45
45
  assert_response :success
46
- assert_equal 1, assigns(:posts).size
47
-
48
- get :index, :year => 2012, :month => 12
46
+ assert_equal 1, assigns(:blog_posts).size
47
+
48
+ get comfy_blog_posts_of_month_path(@site.path, 2012, 12)
49
49
  assert_response :success
50
- assert_equal 0, assigns(:posts).size
50
+ assert_equal 0, assigns(:blog_posts).size
51
51
  end
52
-
52
+
53
+ def test_get_index_with_category
54
+ category = @site.categories.create!(
55
+ label: 'Test Category',
56
+ categorized_type: 'Comfy::Blog::Post'
57
+ )
58
+ category.categorizations.create!(categorized: @post)
59
+
60
+ get comfy_blog_posts_path, params: {category: category.label}
61
+
62
+ assert_response :success
63
+ assert assigns(:blog_posts)
64
+ assert_equal 1, assigns(:blog_posts).count
65
+ assert assigns(:blog_posts).first.categories.member? category
66
+ end
67
+
68
+ def test_get_index_with_category_invalid
69
+ get comfy_blog_posts_path, params: {category: 'invalid'}
70
+ assert_response :success
71
+ assert assigns(:blog_posts)
72
+ assert_equal 0, assigns(:blog_posts).count
73
+ end
74
+
53
75
  def test_get_show
54
- get :serve, :slug => @post.slug
76
+ @post.update_column(:content_cache, "blog post content")
77
+ get comfy_blog_post_path(@site.path, @post.year, @post.month, @post.slug)
55
78
  assert_response :success
56
- assert_template :show
57
- assert assigns(:post)
79
+ assert_equal "blog post content", response.body
58
80
  end
59
-
81
+
60
82
  def test_get_show_unpublished
61
83
  @post.update_attribute(:is_published, false)
62
84
  assert_exception_raised ComfortableMexicanSofa::MissingPage do
63
- get :serve, :slug => @post.slug
85
+ get comfy_blog_post_path(@site.path, @post.year, @post.month, @post.slug)
64
86
  end
65
87
  end
66
-
67
- def test_get_show_with_date
68
- get :show, :year => @post.year, :month => @post.month, :slug => @post.slug
69
- assert_response :success
70
- assert_template :show
71
- assert assigns(:post)
72
- end
73
-
88
+
74
89
  def test_get_show_with_date_invalid
75
90
  assert_exception_raised ComfortableMexicanSofa::MissingPage do
76
- get :show, :year => '1999', :month => '99', :slug => 'invalid'
91
+ get comfy_blog_post_path(@site.path, 1234, 99, @post.slug)
77
92
  end
78
93
  end
79
-
80
94
  end