tb_blog 1.0.2 → 1.0.3

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 (61) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/javascripts/spud/admin/post_comments.js +14 -0
  3. data/app/assets/javascripts/spud/admin/posts.js +1 -0
  4. data/app/assets/stylesheets/spud/admin/posts.css +20 -1
  5. data/app/controllers/blog_controller.rb +17 -13
  6. data/app/controllers/spud/admin/post_comments_controller.rb +8 -6
  7. data/app/controllers/spud/admin/posts_controller.rb +1 -1
  8. data/app/helpers/spud/admin/post_comments_helper.rb +1 -0
  9. data/app/models/spud_post.rb +9 -4
  10. data/app/models/spud_post_comment.rb +14 -4
  11. data/app/views/blog/_comment_form.html.erb +13 -1
  12. data/app/views/blog/index.html.erb +1 -1
  13. data/app/views/spud/admin/post_comments/index.html.erb +20 -5
  14. data/app/views/spud/admin/posts/index.html.erb +3 -4
  15. data/lib/spud_blog/configuration.rb +2 -1
  16. data/lib/spud_blog/version.rb +1 -1
  17. data/spec/controllers/blog_controller_spec.rb +43 -0
  18. data/spec/controllers/spud/admin/posts_controller_spec.rb +5 -0
  19. data/spec/dummy/README.rdoc +261 -0
  20. data/spec/dummy/Rakefile +7 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  24. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  25. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  26. data/spec/dummy/config.ru +4 -0
  27. data/spec/dummy/config/application.rb +59 -0
  28. data/spec/dummy/config/boot.rb +10 -0
  29. data/spec/dummy/config/database.yml +15 -0
  30. data/spec/dummy/config/environment.rb +10 -0
  31. data/spec/dummy/config/environments/development.rb +37 -0
  32. data/spec/dummy/config/environments/production.rb +67 -0
  33. data/spec/dummy/config/environments/test.rb +37 -0
  34. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  35. data/spec/dummy/config/initializers/inflections.rb +15 -0
  36. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  37. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  38. data/spec/dummy/config/initializers/session_store.rb +8 -0
  39. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  40. data/spec/dummy/config/locales/en.yml +5 -0
  41. data/spec/dummy/config/routes.rb +4 -0
  42. data/spec/dummy/db/migrate/20120610130206_create_spud_admin_permissions.spud_core.rb +12 -0
  43. data/spec/dummy/db/migrate/20120610130207_create_spud_users.spud_core.rb +30 -0
  44. data/spec/dummy/db/migrate/20120610130208_add_time_zone_to_spud_user.spud_core.rb +7 -0
  45. data/spec/dummy/db/migrate/20120610130209_add_scope_to_spud_admin_permissions.spud_core.rb +7 -0
  46. data/spec/dummy/db/migrate/20120610130210_create_spud_user_settings.spud_core.rb +12 -0
  47. data/spec/dummy/db/schema.rb +130 -0
  48. data/spec/dummy/log/development.log +263 -0
  49. data/spec/dummy/log/test.log +3339 -0
  50. data/spec/dummy/public/404.html +26 -0
  51. data/spec/dummy/public/422.html +26 -0
  52. data/spec/dummy/public/500.html +25 -0
  53. data/spec/dummy/public/favicon.ico +0 -0
  54. data/spec/dummy/script/rails +6 -0
  55. data/spec/factories/spud_post_factories.rb +17 -0
  56. data/spec/factories/spud_user_factories.rb +31 -0
  57. data/spec/spec_helper.rb +38 -0
  58. data/spec/support/authlogic_helper.rb +2 -0
  59. metadata +94 -13
  60. data/test/fixtures/spud_post_sites.yml +0 -9
  61. data/test/unit/spud_post_site_test.rb +0 -7
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGJkOWJmMDM3ZDBlYmIyZmM1Y2UyNTczNDNlYWExM2ZhMmVlZTkyMg==
4
+ N2FkN2RjOWZiYzA4OWRlMDUyYzgyMDQxNGYxMzY1M2JhODFmZmI1Yg==
5
5
  data.tar.gz: !binary |-
6
- YzllNGI4MGQ3Mjg4OTAwOGViODcyMzc3NDRmMzU4ZGU5ZDE5NjcxNg==
6
+ MGY4YjRkMTAyY2U1MDlhZTBhMTQ1MzBiYmFmODlkNTJmMmI1OTY0NQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MzQwMDQyZGFhODU3NTU0MGE2ZjMzYTJjYzAyOTM1NDgxY2U2NzNiMGU1ZDFm
10
- MWFkMjA0NDBiNjEzN2Y2NGNkZWY4N2M0YWIwZmMyZTk3MDE0MzM1Y2I0ZWQ2
11
- ZWIwODRmNzgxOGQ0NWExOTExYWFkNDA1OTViZWE5NGQxMjg2OWQ=
9
+ MjUyMTkzNjJlYjNhYzY4MWE4NjYyYjljZjY5MzQ1ZmFmNjA3NzdmYzU5ZWIw
10
+ YmI5NzU3ZWIxMjY0ZDYzYzcyZmU4ZjUzMGE2ZGFiYjJhMTNjMzVhZDQ5MWM5
11
+ NTA1NTMyYjVlMDEwYzZjYzAxYWMyYTUwNmUyMjlhMWUxZGM1OWE=
12
12
  data.tar.gz: !binary |-
13
- MzQ3ZDMzMDJiNWNiZWVmMzE5N2MzNTljMDhhMTAxYjA0ZTdmMWU1YmM4YzUw
14
- N2RjYTExMmFjMGI1OWE5MjE3OTFlOTY2YzFkMThmZWUyNjk2MjU4ZjhjNjYy
15
- MmNjOGVhZWZhYTEwNWM5ODI0MWJmOTAxNmZhYzg3NWRjZjIzMzc=
13
+ Yjk3ZmZlODRiYzhlYzhhYTdmZWIzZmExNDE5NmYxNzhjYWFlNTE1OWM3MTcw
14
+ MWQ3YzM4MGFkNmQwM2FhNjBhOTQwNzg3NzczYjc4MmNlN2I1MGM4MWY3Njhm
15
+ YzYyNmUzZDkzNTA4YWUwZTJkODRhNzc3M2E3ZTE0MDJhN2NhYzI=
@@ -0,0 +1,14 @@
1
+ (function(){
2
+
3
+ spud.admin.post_comments = {
4
+ index: function(){
5
+ $('body').on('click', '.blog-comment-content-toggle', clickedToggleCommentContent);
6
+ }
7
+ };
8
+
9
+ var clickedToggleCommentContent = function(e){
10
+ e.preventDefault();
11
+ $(this).next('.blog-comment-content-hidden').toggle();
12
+ };
13
+
14
+ })();
@@ -1,4 +1,5 @@
1
1
  //= require spud/admin/post_categories
2
+ //= require spud/admin/post_comments
2
3
 
3
4
  spud = (typeof(spud) == 'undefined') ? {} : spud;
4
5
  spud.admin = (typeof(spud.admin) == 'undefined') ? {} : spud.admin;
@@ -106,8 +106,27 @@
106
106
  display: none;
107
107
  }
108
108
 
109
- /*Comment Manager*/
109
+ /* Comment Manager
110
+ ------------------ */
111
+ .spud-post-comments-manage{
112
+ font-size: 12px;
113
+ font-style: italic;
114
+ }
110
115
  .submitted-on {
111
116
  display:block;
112
117
  color:#555;
113
118
  }
119
+ .blog-comment-content{
120
+
121
+ }
122
+ .blog-comment-content-toggle{
123
+ font-size: 12px;
124
+ display: block;
125
+ }
126
+ .blog-comment-content-hidden{
127
+ font-size: 12px;
128
+ margin: 4px 0 0;
129
+ padding: 4px 0 0;
130
+ border-top: 1px solid #666;
131
+ display: none;
132
+ }
@@ -3,7 +3,7 @@ class BlogController < ApplicationController
3
3
  respond_to :html, :xml, :json, :rss
4
4
  layout Spud::Blog.base_layout
5
5
 
6
- before_filter :find_post, :only => :show
6
+ before_filter :find_post, :only => [:show, :create_comment]
7
7
 
8
8
  caches_action :show, :index,
9
9
  :expires => Spud::Blog.config.action_caching_duration,
@@ -27,14 +27,14 @@ class BlogController < ApplicationController
27
27
  page = params[:page].to_i
28
28
  if page.to_s != params[:page].to_s
29
29
  if(page > 1)
30
- redirect_to blog_path(:page => page),:status => :moved_permanently and return
30
+ redirect_to blog_path(:page => page), :status => :moved_permanently and return
31
31
  else
32
- redirect_to blog_path(:page => nil),:status => :moved_permanently and return
32
+ redirect_to blog_path(:page => nil), :status => :moved_permanently and return
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
- @posts = SpudPost.public_blog_posts(page, Spud::Blog.config.posts_per_page)
37
+ @posts = SpudPost.public_blog_posts(page, Spud::Blog.config.posts_per_page).includes(:categories, :author)
38
38
  if Spud::Core.config.multisite_mode_enabled
39
39
  @posts = @posts.for_spud_site(current_site_id)
40
40
  end
@@ -95,7 +95,7 @@ class BlogController < ApplicationController
95
95
 
96
96
  def show
97
97
  if @post.comments_enabled
98
- @comment = SpudPostComment.new(:spud_post_id => params[:id])
98
+ @comment = SpudPostComment.new()
99
99
  end
100
100
  respond_with @post
101
101
  end
@@ -105,20 +105,24 @@ class BlogController < ApplicationController
105
105
  render :nothing => true
106
106
  return
107
107
  end
108
- @post = SpudPost.find(params[:id])
109
- if @post.blank?
110
- flash[:error] = "Post not found!"
111
- redirect_to blog_path and return false
112
- end
113
108
  @comment = @post.comments.new(params[:spud_post_comment])
114
109
  @comment.user_agent = request.env["HTTP_USER_AGENT"]
115
110
  @comment.user_ip = request.remote_ip
116
111
  @comment.referrer = request.referrer
117
- @comment.approved = true
112
+ @comment.approved = Spud::Blog.default_comment_approval
118
113
  @comment.permalink = blog_post_url(@post.url_name)
119
- flash[:notice] = 'Your comment has been posted.' if @comment.save
114
+ if @comment.save
115
+ if @comment.approved?
116
+ flash[:notice] = 'Your comment has been posted.'
117
+ else
118
+ flash[:notice] = 'Your comment has been saved and will appear after being reviewed by an administrator.'
119
+ end
120
+ @comment = SpudPostComment.new()
121
+ end
120
122
  respond_with @comment do |format|
121
- format.html { redirect_to blog_post_path(@post.url_name, :anchor => 'spud_post_comment_form') }
123
+ format.html {
124
+ render 'show'
125
+ }
122
126
  end
123
127
  end
124
128
 
@@ -7,15 +7,14 @@ class Spud::Admin::PostCommentsController < Spud::Admin::ApplicationController
7
7
  add_breadcrumb 'Blog Posts', :spud_admin_posts_path
8
8
  add_breadcrumb 'Comments', :spud_admin_post_comments_path
9
9
 
10
-
11
10
  def index
12
11
  @page_name = "Comments"
13
12
  if params[:post_id]
14
- @post_comments = SpudPost.find(params[:post_id]).comments
13
+ @post_comments = SpudPostComment.where(:spud_post_id => params[:post_id])
15
14
  else
16
15
  @post_comments = SpudPostComment
17
16
  end
18
- @post_comments = @post_comments.paginate :page => params[:page]
17
+ @post_comments = @post_comments.includes(:post).paginate(:page => params[:page], :per_page => 15)
19
18
  respond_with @post_comments
20
19
  end
21
20
 
@@ -36,11 +35,12 @@ class Spud::Admin::PostCommentsController < Spud::Admin::ApplicationController
36
35
  end
37
36
 
38
37
  def approve
39
-
40
38
  if Spud::Blog.enable_rakismet && @post_comment.spam
41
39
  @post_comment.ham!
42
40
  end
43
- @post_comment.update_attributes(:spam => false)
41
+ @post_comment.spam = false
42
+ @post_comment.approved = true
43
+ @post_comment.save()
44
44
  redirect_to request.referer || spud_admin_post_comments_path
45
45
  end
46
46
 
@@ -48,7 +48,9 @@ class Spud::Admin::PostCommentsController < Spud::Admin::ApplicationController
48
48
  if Spud::Blog.enable_rakismet && !@post_comment.spam
49
49
  @post_comment.spam!
50
50
  end
51
- @post_comment.update_attributes(:spam => true)
51
+ @post_comment.spam = true
52
+ @post_comment.approved = false
53
+ @post_comment.save()
52
54
  redirect_to request.referer || spud_admin_post_comments_path
53
55
  end
54
56
 
@@ -8,7 +8,7 @@ class Spud::Admin::PostsController < Spud::Admin::ApplicationController
8
8
  cache_sweeper :spud_post_sweeper, :only => [:create, :update, :destroy]
9
9
 
10
10
  def index
11
- @posts = SpudPost.where(:is_news => false).order('published_at desc').includes(:visible_comments, :spam_comments, :author).paginate(:page => params[:page], :per_page => 15)
11
+ @posts = SpudPost.where(:is_news => false).order('published_at desc').includes(:pending_comments, :author).paginate(:page => params[:page], :per_page => 15)
12
12
  respond_with @posts
13
13
  end
14
14
 
@@ -1,2 +1,3 @@
1
1
  module Spud::Admin::PostCommentsHelper
2
+
2
3
  end
@@ -6,8 +6,9 @@ class SpudPost < ActiveRecord::Base
6
6
  :join_table => 'spud_post_categories_posts',
7
7
  :foreign_key => 'spud_post_id'
8
8
  belongs_to :author, :class_name => 'SpudUser', :foreign_key => 'spud_user_id'
9
- has_many :comments, :class_name => 'SpudPostComment'
10
- has_many :visible_comments, :class_name => 'SpudPostComment',:conditions => {:spam => [nil,false]}
9
+ has_many :comments, :class_name => 'SpudPostComment', :inverse_of => :post
10
+ has_many :pending_comments, :class_name => "SpudPostComment", :conditions => {:spam => [nil, false], :approved => false}
11
+ has_many :visible_comments, :class_name => 'SpudPostComment',:conditions => {:spam => [nil,false], :approved => true}
11
12
  has_many :spam_comments, :class_name => "SpudPostComment", :conditions => {:spam => true}
12
13
  has_many :spud_permalinks,:as => :attachment
13
14
  has_many :spud_post_sites, :dependent => :destroy
@@ -29,7 +30,7 @@ class SpudPost < ActiveRecord::Base
29
30
  end
30
31
 
31
32
  def self.public_posts(page, per_page)
32
- return where('visible = ? AND published_at <= ?', true,Time.now.utc).order('published_at desc').includes(:categories).paginate(:page => page, :per_page => per_page)
33
+ return where('visible = ? AND published_at <= ?', true,Time.now.utc).order('published_at desc').paginate(:page => page, :per_page => per_page)
33
34
  end
34
35
 
35
36
  def self.public_blog_posts(page, per_page)
@@ -136,6 +137,10 @@ class SpudPost < ActiveRecord::Base
136
137
  return !is_public?
137
138
  end
138
139
 
140
+ def category_names
141
+ return self.categories.collect{ |c| c.name }.join(', ')
142
+ end
143
+
139
144
  # Spud site ids getter
140
145
  def spud_site_ids
141
146
  if @spud_site_ids.nil?
@@ -153,7 +158,7 @@ class SpudPost < ActiveRecord::Base
153
158
  end
154
159
  end
155
160
 
156
- private
161
+ private
157
162
 
158
163
  def set_url_name
159
164
  self.url_name = "#{self.published_at.strftime('%Y-%m-%d')}-#{self.title.parameterize}"
@@ -1,18 +1,28 @@
1
1
  class SpudPostComment < ActiveRecord::Base
2
+
3
+ attr_accessible :author, :content, :spud_post_id, :referrer, :spam, :user_agent, :user_ip, :permalink
4
+
2
5
  if Spud::Blog.enable_rakismet
3
6
  include Rakismet::Model
4
7
  before_save :rakismet_check_for_spam
5
8
  end
6
9
 
7
-
8
10
  validates_presence_of :author, :content
9
- belongs_to :post, :class_name => 'SpudPost', :foreign_key => 'spud_post_id', :counter_cache => :comments_count
11
+ belongs_to :post, :class_name => 'SpudPost', :foreign_key => 'spud_post_id', :counter_cache => :comments_count, :inverse_of => :comments
10
12
 
11
- attr_accessible :author,:content,:spud_post_id,:referrer,:spam,:user_agent,:user_ip,:permalink
13
+ def visible?
14
+ return approved && !spam
15
+ end
12
16
 
17
+ private
13
18
 
14
19
  def rakismet_check_for_spam
15
- self.spam = self.spam?
20
+ if self.spam?
21
+ self.spam = true
22
+ self.approved = false
23
+ else
24
+ self.spam = true
25
+ end
16
26
  return true
17
27
  end
18
28
 
@@ -1,4 +1,16 @@
1
- <%= form_for @comment, :url => blog_post_path(@post) do |f| %>
1
+ <%= form_for @comment, :url => blog_post_path(@post.url_name, :anchor => 'comment_form') do |f| %>
2
+
3
+ <% if @comment.errors.any? %>
4
+ <div class="comment_error_list">
5
+ <h4>Please correct the following <%= pluralize(@comment.errors.count, "error") %>:</h4>
6
+ <ul>
7
+ <% @comment.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
2
14
  <div>
3
15
  <%= f.label :author %>
4
16
  <%= f.text_field :author %>
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
 
19
19
  <div id="spud_blog_posts">
20
- <% if @posts.any? %>
20
+ <% if @posts.length > 0 %>
21
21
  <% @posts.each do |post| %>
22
22
  <div class="spud_blog_post">
23
23
  <h3><%= link_to post.title, blog_post_path(post.url_name) %></h3>
@@ -18,21 +18,33 @@
18
18
  <% @post_comments.each do |comment| %>
19
19
  <tr>
20
20
  <td><%= comment.author %></td>
21
- <td>
21
+ <td width="400" class="blog-comment-content">
22
22
  <span class='submitted-on'>Submitted: <%=timestamp(comment.created_at)%></span>
23
- <%= comment.content %>
23
+ <%= truncate(comment.content, :length => 50) %>
24
+ <% if comment.content.length > 50 %>
25
+ <a href="#" class="blog-comment-content-toggle">Show/Hide</a>
26
+ <div class="blog-comment-content-hidden">
27
+ <%= comment.content %>
28
+ </div>
29
+ <% end %>
24
30
  </td>
25
31
  <td><%= link_to comment.post.title, blog_post_path(comment.post.url_name)%></td>
26
32
  <td>
27
33
  <% if comment.spam %>
28
34
  Spam
29
- <% else %>
35
+ <% elsif comment.approved %>
30
36
  Approved
37
+ <% else %>
38
+ Pending
31
39
  <% end %>
32
40
  </td>
33
41
  <td align="right">
34
- <%= link_to 'Approve', approve_spud_admin_post_comment_path(comment), :class => 'btn btn-success btn-small' %>
35
- <%= link_to 'Spam', spam_spud_admin_post_comment_path(comment), :class => 'btn btn-warning btn-small' %>
42
+ <% if !comment.approved %>
43
+ <%= link_to 'Approve', approve_spud_admin_post_comment_path(comment), :class => 'btn btn-success btn-small' %>
44
+ <% end %>
45
+ <% if !comment.spam %>
46
+ <%= link_to 'Spam', spam_spud_admin_post_comment_path(comment), :class => 'btn btn-warning btn-small' %>
47
+ <% end %>
36
48
  <%= link_to 'Delete', spud_admin_post_comment_path(comment), :method => :delete, :confirm => 'Are you sure you want to delete this comment?', :class => 'btn btn-danger btn-small' %>
37
49
  </td>
38
50
  </tr>
@@ -43,5 +55,8 @@
43
55
  <%= will_paginate @post_comments%>
44
56
  </div>
45
57
 
58
+ <script>
59
+ $(document).ready(spud.admin.post_comments.index);
60
+ </script>
46
61
 
47
62
  <%end%>
@@ -11,7 +11,7 @@
11
11
  <th>Title</th>
12
12
  <th>Author</th>
13
13
  <th>Published At</th>
14
- <th>Comments</th>
14
+ <th>Comments Pending</th>
15
15
  <th>&nbsp;</th>
16
16
  </tr>
17
17
  </thead>
@@ -29,9 +29,8 @@
29
29
  <td><%= post.author.full_name %></td>
30
30
  <td><%= link_to(post.published_at.strftime('%m/%d/%Y'), blog_post_path(post.url_name)) %></td>
31
31
  <td>
32
- Approved: <%=link_to post.visible_comments.count, spud_admin_post_post_comments_path(:post_id => post.id) %>
33
- <br/>
34
- Spam: <%=link_to post.spam_comments.count, spud_admin_post_post_comments_path(:post_id => post.id) %>
32
+ <%= post.pending_comments.length %>
33
+ <%= link_to "Manage", spud_admin_post_post_comments_path(:post_id => post.id), :class => 'spud-post-comments-manage' %>
35
34
  </td>
36
35
  <td align="right">
37
36
  <%= link_to 'Delete', spud_admin_post_path(post), :method => :delete, :confirm => 'Are you sure you want to delete this post?', :class => 'btn btn-danger' %>
@@ -6,7 +6,7 @@ module Spud
6
6
  :news_enabled, :posts_per_page, :blog_path,
7
7
  :news_path, :enable_sitemap, :has_custom_fields,
8
8
  :cache_mode, :action_caching_duration,
9
- :enable_rakismet, :enable_markdown
9
+ :enable_rakismet, :enable_markdown, :default_comment_approval
10
10
  )
11
11
  self.base_layout = 'application'
12
12
  self.news_layout = nil
@@ -21,5 +21,6 @@ module Spud
21
21
  self.action_caching_duration = 3600
22
22
  self.enable_rakismet = false
23
23
  self.enable_markdown = false
24
+ self.default_comment_approval = true
24
25
  end
25
26
  end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Blog
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe BlogController, :type => :controller do
4
+
5
+ before(:all) do
6
+
7
+ end
8
+
9
+ describe :index do
10
+ it "should display a list of posts" do
11
+ 2.times { |i| FactoryGirl.create(:spud_post) }
12
+ get :index
13
+ assigns(:posts).count.should be > 1
14
+ end
15
+ end
16
+
17
+ describe :create_comment do
18
+ it "should create a comment" do
19
+ @post = FactoryGirl.create(:spud_post)
20
+ post :create_comment, :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"}
21
+ @post.comments.length.should be > 0
22
+ end
23
+
24
+ it "should approve a comment by default if default_comment_approval is true" do
25
+ Spud::Blog.configure do |config|
26
+ config.default_comment_approval = true
27
+ end
28
+ @post = FactoryGirl.create(:spud_post)
29
+ post :create_comment, :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"}
30
+ @post.comments.first.approved.should be_true
31
+ end
32
+
33
+ it "should not approve a comment by default if default_comment_approval is false" do
34
+ Spud::Blog.configure do |config|
35
+ config.default_comment_approval = false
36
+ end
37
+ @post = FactoryGirl.create(:spud_post)
38
+ post :create_comment, :id => @post.url_name, :spud_post_comment => {:author => "Test User", :content => "Lorem Ipsum"}
39
+ @post.comments.first.approved.should be_false
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spud::Admin::PostsController do
4
+
5
+ end