governor_comments 0.2.5 → 0.2.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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- governor_comments (0.2.5)
4
+ governor_comments (0.2.6)
5
5
  governor (>= 0.5.0)
6
6
  rails (~> 3.0.5)
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -3,6 +3,7 @@ module Governor
3
3
  include Governor::Controllers::Helpers
4
4
 
5
5
  before_filter :init_resource
6
+ before_filter :validate_params, :only => [:create]
6
7
  before_filter :authorize_commenter!, :except => [:new, :create]
7
8
  before_filter :get_comment, :only => [:edit, :update, :destroy, :mark_spam, :not_spam]
8
9
 
@@ -76,5 +77,11 @@ module Governor
76
77
  redirect_to root_path unless governor_authorized?(:edit, resource)
77
78
  end
78
79
  end
80
+
81
+ def validate_params
82
+ unless params.has_key?(:comment)
83
+ render :text => 'Please include the comment.', :status => :bad_request
84
+ end
85
+ end
79
86
  end
80
87
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{governor_comments}
8
- s.version = "0.2.5"
8
+ s.version = "0.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Liam Morley"]
12
- s.date = %q{2011-05-18}
12
+ s.date = %q{2011-06-20}
13
13
  s.description = %q{Comments plugin for the Rails 3-based Governor blogging system.}
14
14
  s.email = %q{liam@carpeliam.com}
15
15
  s.extra_rdoc_files = [
@@ -52,6 +52,7 @@ Gem::Specification.new do |s|
52
52
  "spec/controllers/governor/comments_controller_spec.rb",
53
53
  "spec/governor_comments_spec.rb",
54
54
  "spec/models/article_spec.rb",
55
+ "spec/models/comment_spec.rb",
55
56
  "spec/rails_app/.gitignore",
56
57
  "spec/rails_app/Gemfile",
57
58
  "spec/rails_app/Gemfile.lock",
@@ -120,6 +121,7 @@ Gem::Specification.new do |s|
120
121
  "spec/controllers/governor/comments_controller_spec.rb",
121
122
  "spec/governor_comments_spec.rb",
122
123
  "spec/models/article_spec.rb",
124
+ "spec/models/comment_spec.rb",
123
125
  "spec/rails_app/app/controllers/application_controller.rb",
124
126
  "spec/rails_app/app/controllers/home_controller.rb",
125
127
  "spec/rails_app/app/helpers/application_helper.rb",
@@ -16,6 +16,7 @@ module GovernorComments
16
16
 
17
17
  base.validates_presence_of :content
18
18
  base.validates_presence_of :commenter
19
+ base.validates_associated :commenter
19
20
  end
20
21
 
21
22
  def mark_spam
@@ -19,7 +19,10 @@ module Governor
19
19
  assigns[:article].should == @article
20
20
  end
21
21
 
22
- it "looks up returning guests by email"
22
+ it "handles bad input from nasty spammers" do
23
+ post :create, :governor_mapping => :articles, :article_id => @article.id
24
+ response.response_code.should == 400
25
+ end
23
26
  end
24
27
 
25
28
  context "#mark_spam" do
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Comment do
4
+ before do
5
+ @bad_guest = Guest.new
6
+ @bad_guest.should be_invalid
7
+ @good_guest = Guest.new(:name => 'name', :email => 'email@address.com')
8
+ @good_guest.should be_valid
9
+ end
10
+ it "is invalid if the commenter is invalid" do
11
+ Comment.new(:content => 'some content', :commenter => @bad_guest).should be_invalid
12
+ Comment.new(:content => 'some content', :commenter => @good_guest).should be_valid
13
+ end
14
+ end
@@ -9,7 +9,7 @@ gem 'sqlite3'
9
9
 
10
10
  gem 'devise'
11
11
  gem 'rakismet'
12
- gem 'governor', :git => 'git://github.com/carpeliam/governor.git'
12
+ gem 'governor'
13
13
  gem 'governor_comments', :path => '../..'
14
14
 
15
15
  gem 'dynamic_form'
@@ -1,14 +1,7 @@
1
- GIT
2
- remote: git://github.com/carpeliam/governor.git
3
- revision: c1867661afb7659c2bdfa6aee5afda6d2a93c8a3
4
- specs:
5
- governor (0.5.7)
6
- rails (>= 3.0.5)
7
-
8
1
  PATH
9
2
  remote: ../..
10
3
  specs:
11
- governor_comments (0.2.5)
4
+ governor_comments (0.2.6)
12
5
  governor (>= 0.5.0)
13
6
  rails (~> 3.0.5)
14
7
 
@@ -51,6 +44,8 @@ GEM
51
44
  dynamic_form (1.1.3)
52
45
  erubis (2.6.6)
53
46
  abstract (>= 1.0.0)
47
+ governor (0.5.7)
48
+ rails (>= 3.0.5)
54
49
  i18n (0.5.0)
55
50
  mail (2.2.19)
56
51
  activesupport (>= 2.3.6)
@@ -94,7 +89,7 @@ PLATFORMS
94
89
  DEPENDENCIES
95
90
  devise
96
91
  dynamic_form
97
- governor!
92
+ governor
98
93
  governor_comments!
99
94
  rails (= 3.0.5)
100
95
  rakismet
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: governor_comments
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 5
10
- version: 0.2.5
9
+ - 6
10
+ version: 0.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Liam Morley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-18 00:00:00 -04:00
18
+ date: 2011-06-20 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -284,6 +284,7 @@ files:
284
284
  - spec/controllers/governor/comments_controller_spec.rb
285
285
  - spec/governor_comments_spec.rb
286
286
  - spec/models/article_spec.rb
287
+ - spec/models/comment_spec.rb
287
288
  - spec/rails_app/.gitignore
288
289
  - spec/rails_app/Gemfile
289
290
  - spec/rails_app/Gemfile.lock
@@ -380,6 +381,7 @@ test_files:
380
381
  - spec/controllers/governor/comments_controller_spec.rb
381
382
  - spec/governor_comments_spec.rb
382
383
  - spec/models/article_spec.rb
384
+ - spec/models/comment_spec.rb
383
385
  - spec/rails_app/app/controllers/application_controller.rb
384
386
  - spec/rails_app/app/controllers/home_controller.rb
385
387
  - spec/rails_app/app/helpers/application_helper.rb