acts_as_commentable_with_threading 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/CHANGELOG.md +62 -0
- data/Gemfile +2 -14
- data/Gemfile.lock +79 -70
- data/README.md +4 -5
- data/acts_as_commentable_with_threading.gemspec +10 -10
- data/gemfiles/Gemfile.rails-4.0 +1 -16
- data/gemfiles/Gemfile.rails-4.1 +2 -17
- data/lib/generators/acts_as_commentable_upgrade_migration/acts_as_commentable_upgrade_migration_generator.rb +1 -1
- data/lib/generators/acts_as_commentable_with_threading_migration/acts_as_commentable_with_threading_migration_generator.rb +1 -1
- data/lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb +4 -4
- data/spec/comment_spec.rb +11 -11
- data/spec/commentable_spec.rb +11 -11
- data/spec/db/schema.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +34 -38
- data/CHANGELOG +0 -22
- data/gemfiles/Gemfile.rails-3.0 +0 -24
- data/gemfiles/Gemfile.rails-3.1 +0 -24
- data/gemfiles/Gemfile.rails-3.2 +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb97d670c7c38f3ebd5734662be5a97407d25ed9
|
4
|
+
data.tar.gz: 183b5bb8b0fbefc77e9b3bd42dabfecfbb6516d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee6b452fe066bc0384e9ae35d8ba7ee92b0c31d30c260ca09e2e121d484965e1f42c05d33ca75bb90e4953c9e9c0bda246f05d01a96d632eeb775e7a91bcc81
|
7
|
+
data.tar.gz: e20dacff4e85b6eee5b9446e3a6cce03534128a10a3c86bb46868570ec6b79d65e99bc50841a0c287f89821df48b8acbed34a2c63c2a78c7e353a008acee68b8
|
data/.travis.yml
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
gemfile:
|
2
|
-
- gemfiles/Gemfile.rails-3.0
|
3
|
-
- gemfiles/Gemfile.rails-3.1
|
4
|
-
- gemfiles/Gemfile.rails-3.2
|
5
2
|
- gemfiles/Gemfile.rails-4.0
|
6
3
|
- gemfiles/Gemfile.rails-4.1
|
7
4
|
rvm:
|
@@ -9,8 +6,9 @@ rvm:
|
|
9
6
|
- 2.0.0
|
10
7
|
- 2.1.0
|
11
8
|
- jruby-19mode
|
12
|
-
- rbx
|
9
|
+
- rbx-2
|
13
10
|
matrix:
|
14
11
|
allow_failures:
|
12
|
+
- rvm: rbx-2
|
15
13
|
- gemfile: gemfiles/Gemfile.rails-4.1
|
16
14
|
rvm: jruby-19mode
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
v2.0.0
|
2
|
+
------
|
3
|
+
|
4
|
+
- Removed support for Rails 3.x - gem only supports Rails 4+ going forward.
|
5
|
+
- Updated rspec versions to 3.x and switch to 'expect' syntax.
|
6
|
+
- Removed default values from referencing id columns in `Comment` class.
|
7
|
+
- Added missing '.rb' suffix on migration files.
|
8
|
+
|
9
|
+
v1.2.0
|
10
|
+
------
|
11
|
+
|
12
|
+
- Updated rspec versions to 2.x and make corresponding changes to Rakefile.
|
13
|
+
- Removed sqlite3 development dependency to support JRuby in development/test.
|
14
|
+
- Added initial Rails 4 support, subject to acts_as_nested_set dependency.
|
15
|
+
- Removed empty string default values for string columns in `Comment`.
|
16
|
+
|
17
|
+
v1.1.3
|
18
|
+
------
|
19
|
+
|
20
|
+
- Fixed typos in acts_as_votable integration comment and instructions.
|
21
|
+
- Updated commentable to call `destroy_all` on `root_comments`, rather than on all comments (to ensure comments are properly deleted).
|
22
|
+
- Fixed polymorphic index to include `commentable_type`.
|
23
|
+
- Update Comment to use `validates` rather than the deprecated `validates_presence_of`.
|
24
|
+
|
25
|
+
v1.1.2
|
26
|
+
------
|
27
|
+
|
28
|
+
- Updated awesome_nested_set dependency to account for change in repository location.
|
29
|
+
- Fixed Comment so it stores the correct class when a commentable is an STL child class.
|
30
|
+
- Added commentable association to Comment.
|
31
|
+
- Assorted README changes.
|
32
|
+
|
33
|
+
v1.1.1
|
34
|
+
------
|
35
|
+
|
36
|
+
- Removed length limit on Commentable class name.
|
37
|
+
- Removed default order from `comment_threads`
|
38
|
+
|
39
|
+
v1.1.0
|
40
|
+
------
|
41
|
+
|
42
|
+
- Updated to Rails 3+.
|
43
|
+
- First Rubygems release.
|
44
|
+
|
45
|
+
v0.1.2
|
46
|
+
------
|
47
|
+
|
48
|
+
- Added new documentation in README that should better help users understand this plugin.
|
49
|
+
- Added new instance method `root_comments` that will return all comments belonging to a model except child comments.
|
50
|
+
- Added new class method for Comment: `self.build_from(object, user_id, comment_text:string)`. This method cleans up the code inside the controllers.
|
51
|
+
- Added new class method for Comment: `has_children?` that will return true or false depending on if a comment has children.
|
52
|
+
- Updated deprecated code in instance method `comments_ordered_by_submitted` - changed `self.type.name` to `self.class.name`.
|
53
|
+
|
54
|
+
v0.1.1
|
55
|
+
------
|
56
|
+
|
57
|
+
- Fixes to gemspec.
|
58
|
+
|
59
|
+
v0.1.0
|
60
|
+
------
|
61
|
+
|
62
|
+
- Initial Release.
|
data/Gemfile
CHANGED
@@ -1,20 +1,8 @@
|
|
1
|
-
|
2
|
-
source 'http://rubygems.org'
|
1
|
+
source 'https://rubygems.org'
|
3
2
|
|
4
|
-
|
5
|
-
gem "activesupport", "~> 4.0"
|
6
|
-
gem "awesome_nested_set", "~> 3.0.0.rc.2"
|
7
|
-
|
8
|
-
platforms :rbx do
|
9
|
-
gem 'rubysl', '~> 2.0'
|
10
|
-
gem 'rubinius-developer_tools'
|
11
|
-
end
|
3
|
+
gemspec
|
12
4
|
|
13
5
|
group :development do
|
14
|
-
gem "rake", ">= 0"
|
15
|
-
gem "bundler"
|
16
|
-
gem "rspec"
|
17
6
|
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
18
7
|
gem 'sqlite3', :platforms => :ruby
|
19
|
-
gem "rails", "~> 4.0"
|
20
8
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,99 +1,108 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
acts_as_commentable_with_threading (2.0.0)
|
5
|
+
activerecord (>= 4.0)
|
6
|
+
activesupport (>= 4.0)
|
7
|
+
awesome_nested_set (>= 3.0)
|
8
|
+
|
1
9
|
GEM
|
2
|
-
remote:
|
10
|
+
remote: https://rubygems.org/
|
3
11
|
specs:
|
4
|
-
actionmailer (4.
|
5
|
-
actionpack (= 4.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
12
|
+
actionmailer (4.1.6)
|
13
|
+
actionpack (= 4.1.6)
|
14
|
+
actionview (= 4.1.6)
|
15
|
+
mail (~> 2.5, >= 2.5.4)
|
16
|
+
actionpack (4.1.6)
|
17
|
+
actionview (= 4.1.6)
|
18
|
+
activesupport (= 4.1.6)
|
11
19
|
rack (~> 1.5.2)
|
12
20
|
rack-test (~> 0.6.2)
|
13
|
-
|
14
|
-
activesupport (= 4.
|
15
|
-
builder (~> 3.1
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
actionview (4.1.6)
|
22
|
+
activesupport (= 4.1.6)
|
23
|
+
builder (~> 3.1)
|
24
|
+
erubis (~> 2.7.0)
|
25
|
+
activemodel (4.1.6)
|
26
|
+
activesupport (= 4.1.6)
|
27
|
+
builder (~> 3.1)
|
28
|
+
activerecord (4.1.6)
|
29
|
+
activemodel (= 4.1.6)
|
30
|
+
activesupport (= 4.1.6)
|
31
|
+
arel (~> 5.0.0)
|
32
|
+
activesupport (4.1.6)
|
33
|
+
i18n (~> 0.6, >= 0.6.9)
|
34
|
+
json (~> 1.7, >= 1.7.7)
|
35
|
+
minitest (~> 5.1)
|
26
36
|
thread_safe (~> 0.1)
|
27
|
-
tzinfo (~>
|
28
|
-
arel (
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
builder (3.1.4)
|
37
|
+
tzinfo (~> 1.1)
|
38
|
+
arel (5.0.1.20140414130214)
|
39
|
+
awesome_nested_set (3.0.1)
|
40
|
+
activerecord (>= 4.0.0, < 5)
|
41
|
+
builder (3.2.2)
|
33
42
|
diff-lcs (1.2.5)
|
34
43
|
erubis (2.7.0)
|
35
44
|
hike (1.2.3)
|
36
|
-
i18n (0.6.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
mime-types (
|
41
|
-
minitest (4.
|
42
|
-
multi_json (1.
|
43
|
-
polyglot (0.3.3)
|
45
|
+
i18n (0.6.11)
|
46
|
+
json (1.8.1)
|
47
|
+
mail (2.6.1)
|
48
|
+
mime-types (>= 1.16, < 3)
|
49
|
+
mime-types (2.3)
|
50
|
+
minitest (5.4.1)
|
51
|
+
multi_json (1.10.1)
|
44
52
|
rack (1.5.2)
|
45
53
|
rack-test (0.6.2)
|
46
54
|
rack (>= 1.0)
|
47
|
-
rails (4.
|
48
|
-
actionmailer (= 4.
|
49
|
-
actionpack (= 4.
|
50
|
-
|
51
|
-
|
55
|
+
rails (4.1.6)
|
56
|
+
actionmailer (= 4.1.6)
|
57
|
+
actionpack (= 4.1.6)
|
58
|
+
actionview (= 4.1.6)
|
59
|
+
activemodel (= 4.1.6)
|
60
|
+
activerecord (= 4.1.6)
|
61
|
+
activesupport (= 4.1.6)
|
52
62
|
bundler (>= 1.3.0, < 2.0)
|
53
|
-
railties (= 4.
|
54
|
-
sprockets-rails (~> 2.0
|
55
|
-
railties (4.
|
56
|
-
actionpack (= 4.
|
57
|
-
activesupport (= 4.
|
63
|
+
railties (= 4.1.6)
|
64
|
+
sprockets-rails (~> 2.0)
|
65
|
+
railties (4.1.6)
|
66
|
+
actionpack (= 4.1.6)
|
67
|
+
activesupport (= 4.1.6)
|
58
68
|
rake (>= 0.8.7)
|
59
69
|
thor (>= 0.18.1, < 2.0)
|
60
|
-
rake (10.
|
61
|
-
rspec (
|
62
|
-
rspec-core (~>
|
63
|
-
rspec-expectations (~>
|
64
|
-
rspec-mocks (~>
|
65
|
-
rspec-core (
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
+
rake (10.3.2)
|
71
|
+
rspec (3.1.0)
|
72
|
+
rspec-core (~> 3.1.0)
|
73
|
+
rspec-expectations (~> 3.1.0)
|
74
|
+
rspec-mocks (~> 3.1.0)
|
75
|
+
rspec-core (3.1.3)
|
76
|
+
rspec-support (~> 3.1.0)
|
77
|
+
rspec-expectations (3.1.1)
|
78
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
79
|
+
rspec-support (~> 3.1.0)
|
80
|
+
rspec-mocks (3.1.0)
|
81
|
+
rspec-support (~> 3.1.0)
|
82
|
+
rspec-support (3.1.0)
|
83
|
+
sprockets (2.12.2)
|
70
84
|
hike (~> 1.2)
|
71
85
|
multi_json (~> 1.0)
|
72
86
|
rack (~> 1.0)
|
73
87
|
tilt (~> 1.1, != 1.3.0)
|
74
|
-
sprockets-rails (2.
|
88
|
+
sprockets-rails (2.1.4)
|
75
89
|
actionpack (>= 3.0)
|
76
90
|
activesupport (>= 3.0)
|
77
91
|
sprockets (~> 2.8)
|
78
|
-
sqlite3 (1.3.
|
79
|
-
thor (0.
|
80
|
-
thread_safe (0.
|
81
|
-
atomic
|
92
|
+
sqlite3 (1.3.9)
|
93
|
+
thor (0.19.1)
|
94
|
+
thread_safe (0.3.4)
|
82
95
|
tilt (1.4.1)
|
83
|
-
|
84
|
-
|
85
|
-
polyglot (>= 0.3.1)
|
86
|
-
tzinfo (0.3.38)
|
96
|
+
tzinfo (1.2.2)
|
97
|
+
thread_safe (~> 0.1)
|
87
98
|
|
88
99
|
PLATFORMS
|
89
100
|
ruby
|
90
101
|
|
91
102
|
DEPENDENCIES
|
92
|
-
activerecord
|
93
|
-
|
94
|
-
|
95
|
-
bundler
|
96
|
-
rails (~> 4.0)
|
103
|
+
activerecord-jdbcsqlite3-adapter
|
104
|
+
acts_as_commentable_with_threading!
|
105
|
+
rails (>= 4.0)
|
97
106
|
rake
|
98
|
-
rspec
|
107
|
+
rspec (>= 3.0)
|
99
108
|
sqlite3
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/elight/acts_as_commentable_with_threading.png)](https://travis-ci.org/elight/acts_as_commentable_with_threading)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/elight/acts_as_commentable_with_threading/badges/gpa.svg)](https://codeclimate.com/github/elight/acts_as_commentable_with_threading)
|
2
3
|
|
3
4
|
Acts As Commentable (now with comment threads(TM)!!! -- kidding on the (TM))
|
4
5
|
===================
|
@@ -9,7 +10,7 @@ schema change)
|
|
9
10
|
|
10
11
|
Requirements
|
11
12
|
------------
|
12
|
-
|
13
|
+
The 2.x version of this gem is for Rails 4 and later versions only. For the Rails 3.x compatible version of this gem, please use version 1.2.0.
|
13
14
|
|
14
15
|
This gem depends on CollectiveIdea's Awesome Nested Set gem. It is installed if
|
15
16
|
not already present when you install this gem.
|
@@ -61,7 +62,7 @@ Usage
|
|
61
62
|
|
62
63
|
* To make a newly created comment into a child/reply of another comment:
|
63
64
|
|
64
|
-
comment.move_to_child_of(the_desired_parent_comment)
|
65
|
+
@comment.move_to_child_of(the_desired_parent_comment)
|
65
66
|
|
66
67
|
* To retrieve all comments for an article, including child comments:
|
67
68
|
|
@@ -84,9 +85,7 @@ Usage
|
|
84
85
|
@comment.children
|
85
86
|
|
86
87
|
* If you plan to use the `acts_as_votable` plugin with your comment system be
|
87
|
-
sure to uncomment
|
88
|
-
|
89
|
-
* In `lib/comment.rb` uncomment the line [`acts_as_votable`][L9].
|
88
|
+
sure to uncomment the line [`acts_as_votable`][L9] in `lib/comment.rb`.
|
90
89
|
|
91
90
|
[L9]: https://github.com/elight/acts_as_commentable_with_threading/blob/master/lib/generators/acts_as_commentable_with_threading_migration/templates/comment.rb#L9
|
92
91
|
|
@@ -1,20 +1,20 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "acts_as_commentable_with_threading"
|
3
|
-
s.version = "
|
4
|
-
s.date = "2014-
|
5
|
-
s.summary = "Polymorphic comments Rails gem - Rails
|
3
|
+
s.version = "2.0.0"
|
4
|
+
s.date = "2014-09-15"
|
5
|
+
s.summary = "Polymorphic comments Rails gem - Rails 4+ only"
|
6
6
|
s.email = "evan@tripledogdare.net"
|
7
7
|
s.homepage = "http://github.com/elight/acts_as_commentable_with_threading"
|
8
|
-
s.description = "Polymorphic threaded comments Rails gem for Rails
|
8
|
+
s.description = "Polymorphic threaded comments Rails gem for Rails 4+"
|
9
9
|
s.authors = ["Evan Light", "Jack Dempsey", "Xelipe", "xxx"]
|
10
10
|
s.files = `git ls-files`.split("\n")
|
11
|
-
s.test_files =
|
11
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
12
12
|
|
13
13
|
s.add_development_dependency 'rake'
|
14
|
-
s.add_development_dependency 'rspec', '
|
15
|
-
s.add_development_dependency 'rails', '>=
|
14
|
+
s.add_development_dependency 'rspec', '>= 3.0'
|
15
|
+
s.add_development_dependency 'rails', '>= 4.0'
|
16
16
|
|
17
|
-
s.add_dependency 'activerecord', '>=
|
18
|
-
s.add_dependency 'activesupport', '>=
|
19
|
-
s.add_dependency 'awesome_nested_set', '>=
|
17
|
+
s.add_dependency 'activerecord', '>= 4.0'
|
18
|
+
s.add_dependency 'activesupport', '>= 4.0'
|
19
|
+
s.add_dependency 'awesome_nested_set', '>= 3.0'
|
20
20
|
end
|
data/gemfiles/Gemfile.rails-4.0
CHANGED
@@ -1,24 +1,9 @@
|
|
1
|
-
source '
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec path: '..'
|
4
4
|
|
5
|
-
gem 'activerecord', '~> 4.0.0'
|
6
|
-
gem 'activesupport', '~> 4.0.0'
|
7
|
-
gem 'awesome_nested_set','~> 3.0.0.rc.2'
|
8
|
-
|
9
|
-
platforms :rbx do
|
10
|
-
gem 'rubysl', '~> 2.0'
|
11
|
-
gem 'rubinius-developer_tools'
|
12
|
-
end
|
13
|
-
|
14
5
|
group :development do
|
15
|
-
gem 'rake'
|
16
6
|
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
17
7
|
gem 'sqlite3', :platforms => :ruby
|
18
8
|
gem 'rails', '~> 4.0.0'
|
19
9
|
end
|
20
|
-
|
21
|
-
group :development, :test do
|
22
|
-
gem 'rspec', '~> 2.4'
|
23
|
-
gem 'rspec-rails', '~> 2.4'
|
24
|
-
end
|
data/gemfiles/Gemfile.rails-4.1
CHANGED
@@ -1,24 +1,9 @@
|
|
1
|
-
source '
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec path: '..'
|
4
4
|
|
5
|
-
gem 'activerecord', '~> 4.1.0.beta1'
|
6
|
-
gem 'activesupport', '~> 4.1.0.beta1'
|
7
|
-
gem 'awesome_nested_set','~> 3.0.0.rc.2'
|
8
|
-
|
9
|
-
platforms :rbx do
|
10
|
-
gem 'rubysl', '~> 2.0'
|
11
|
-
gem 'rubinius-developer_tools'
|
12
|
-
end
|
13
|
-
|
14
5
|
group :development do
|
15
|
-
gem 'rake'
|
16
6
|
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
17
7
|
gem 'sqlite3', :platforms => :ruby
|
18
|
-
gem 'rails', '~> 4.1.0
|
19
|
-
end
|
20
|
-
|
21
|
-
group :development, :test do
|
22
|
-
gem 'rspec', '~> 2.4'
|
23
|
-
gem 'rspec-rails', '~> 2.4'
|
8
|
+
gem 'rails', '~> 4.1.0'
|
24
9
|
end
|
@@ -13,7 +13,7 @@ class ActsAsCommentableUpgradeMigrationGenerator < Rails::Generators::Base
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def manifest
|
16
|
-
migration_template 'migration.rb', 'db/migrate/acts_as_commentable_upgrade_migration'
|
16
|
+
migration_template 'migration.rb', 'db/migrate/acts_as_commentable_upgrade_migration.rb'
|
17
17
|
copy_file 'comment.rb', 'app/models/comment.rb'
|
18
18
|
end
|
19
19
|
end
|
@@ -13,7 +13,7 @@ class ActsAsCommentableWithThreadingMigrationGenerator < Rails::Generators::Base
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def manifest
|
16
|
-
migration_template 'migration.rb', 'db/migrate/acts_as_commentable_with_threading_migration'
|
16
|
+
migration_template 'migration.rb', 'db/migrate/acts_as_commentable_with_threading_migration.rb'
|
17
17
|
copy_file 'comment.rb', 'app/models/comment.rb'
|
18
18
|
end
|
19
19
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
class ActsAsCommentableWithThreadingMigration < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
create_table :comments, :force => true do |t|
|
4
|
-
t.integer :commentable_id
|
4
|
+
t.integer :commentable_id
|
5
5
|
t.string :commentable_type
|
6
6
|
t.string :title
|
7
7
|
t.text :body
|
8
8
|
t.string :subject
|
9
|
-
t.integer :user_id, :
|
9
|
+
t.integer :user_id, :null => false
|
10
10
|
t.integer :parent_id, :lft, :rgt
|
11
11
|
t.timestamps
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
add_index :comments, :user_id
|
15
15
|
add_index :comments, [:commentable_id, :commentable_type]
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def self.down
|
19
19
|
drop_table :comments
|
20
20
|
end
|
data/spec/comment_spec.rb
CHANGED
@@ -9,27 +9,27 @@ describe Comment do
|
|
9
9
|
|
10
10
|
describe "that is valid" do
|
11
11
|
it "should have a user" do
|
12
|
-
@comment.user.
|
12
|
+
expect(@comment.user).not_to be_nil
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should have a body" do
|
16
|
-
@comment.body.
|
16
|
+
expect(@comment.body).not_to be_nil
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should not have a parent if it is a root Comment" do
|
21
|
-
@comment.parent.
|
21
|
+
expect(@comment.parent).to be_nil
|
22
22
|
end
|
23
23
|
|
24
24
|
it "can have see how child Comments it has" do
|
25
|
-
@comment.children.size.
|
25
|
+
expect(@comment.children.size).to eq(0)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "can add child Comments" do
|
29
29
|
grandchild = Comment.new(:body => "This is a grandchild", :user => @user)
|
30
30
|
grandchild.save!
|
31
31
|
grandchild.move_to_child_of(@comment)
|
32
|
-
@comment.children.size.
|
32
|
+
expect(@comment.children.size).to eq(1)
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "after having a child added" do
|
@@ -39,11 +39,11 @@ describe Comment do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "can be referenced by its child" do
|
42
|
-
@child.parent.
|
42
|
+
expect(@child.parent).to eq(@comment)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "can see its child" do
|
46
|
-
@comment.children.first.
|
46
|
+
expect(@comment.children.first).to eq(@child)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -57,11 +57,11 @@ describe Comment do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should return all the comments created by the passed user" do
|
60
|
-
@comments.
|
60
|
+
expect(@comments).to include(@user_comment)
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should not return comments created by non-passed users" do
|
64
|
-
@comments.
|
64
|
+
expect(@comments).not_to include(@non_user_comment)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -76,11 +76,11 @@ describe Comment do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should return the comments for the passed commentable" do
|
79
|
-
@comments.
|
79
|
+
expect(@comments).to include(@user_comment)
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should not return the comments for non-passed commentables" do
|
83
|
-
@comments.
|
83
|
+
expect(@comments).not_to include(@other_comment)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
data/spec/commentable_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path('./spec_helper', File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
describe "A class that is commentable" do
|
4
4
|
it "can have many root comments" do
|
5
|
-
Commentable.new.comment_threads.respond_to?(:each).
|
5
|
+
expect(Commentable.new.comment_threads.respond_to?(:each)).to eq(true)
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "when is destroyed" do
|
@@ -14,7 +14,7 @@ describe "A class that is commentable" do
|
|
14
14
|
|
15
15
|
it "also destroys its root comments" do
|
16
16
|
@commentable.destroy
|
17
|
-
Comment.all.
|
17
|
+
expect(Comment.all).not_to include(@comment)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "also destroys its nested comments" do
|
@@ -23,8 +23,8 @@ describe "A class that is commentable" do
|
|
23
23
|
child.move_to_child_of(@comment)
|
24
24
|
|
25
25
|
@commentable.destroy
|
26
|
-
Comment.all.
|
27
|
-
Comment.all.
|
26
|
+
expect(Comment.all).not_to include(@comment)
|
27
|
+
expect(Comment.all).not_to include(child)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -45,11 +45,11 @@ describe "A class that is commentable" do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should return the comments for the passed commentable" do
|
48
|
-
@comments.
|
48
|
+
expect(@comments).to include(@comment)
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should not return the comments for other commentables" do
|
52
|
-
@comments.
|
52
|
+
expect(@comments).not_to include(@other_comment)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -65,12 +65,12 @@ describe "A class that is commentable" do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should return comments by the passed user" do
|
68
|
-
@comments.all? { |c| c.user == @user }.
|
68
|
+
expect(@comments.all? { |c| c.user == @user }).to eq(true)
|
69
69
|
end
|
70
70
|
|
71
71
|
|
72
72
|
it "should not return comments by other users" do
|
73
|
-
@comments.any? { |c| c.user != @user }.
|
73
|
+
expect(@comments.any? { |c| c.user != @user }).to eq(false)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -89,12 +89,12 @@ describe "A class that is commentable" do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should return its own comments, ordered with the newest first" do
|
92
|
-
@comments.all? { |c| c.commentable_type == @commentable.class.to_s and c.commentable_id == @commentable.id }.
|
93
|
-
@comments.each_cons(2) { |c, c2| c.created_at.
|
92
|
+
expect(@comments.all? { |c| c.commentable_type == @commentable.class.to_s and c.commentable_id == @commentable.id }).to eq(true)
|
93
|
+
@comments.each_cons(2) { |c, c2| expect(c.created_at).to be > c2.created_at }
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should not include comments for other commentables" do
|
97
|
-
@comments.any? { |c| c.commentable_type != @commentable.class.to_s or c.commentable_id != @commentable.id }.
|
97
|
+
expect(@comments.any? { |c| c.commentable_type != @commentable.class.to_s or c.commentable_id != @commentable.id }).to eq(false)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
data/spec/db/schema.rb
CHANGED
@@ -2,18 +2,18 @@ ActiveRecord::Schema.define(:version => 1) do
|
|
2
2
|
create_table "users", :force => true do |t|
|
3
3
|
t.timestamps
|
4
4
|
end
|
5
|
-
|
5
|
+
|
6
6
|
create_table "commentables", :force => true do |t|
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
9
|
|
10
10
|
create_table "comments", :force => true do |t|
|
11
|
-
t.integer "commentable_id"
|
11
|
+
t.integer "commentable_id"
|
12
12
|
t.string "commentable_type", :limit => 15, :default => ""
|
13
13
|
t.string "title", :default => ""
|
14
14
|
t.text "body", :default => ""
|
15
15
|
t.string "subject", :default => ""
|
16
|
-
t.integer "user_id", :
|
16
|
+
t.integer "user_id", :null => false
|
17
17
|
t.integer "parent_id"
|
18
18
|
t.integer "lft"
|
19
19
|
t.integer "rgt"
|
data/spec/spec_helper.rb
CHANGED
@@ -7,7 +7,7 @@ plugin_test_dir = File.dirname(__FILE__)
|
|
7
7
|
ActiveRecord::Base.logger = Logger.new(File.join(plugin_test_dir, "debug.log"))
|
8
8
|
|
9
9
|
ActiveRecord::Base.configurations = YAML::load_file(File.join(plugin_test_dir, "db", "database.yml"))
|
10
|
-
ActiveRecord::Base.establish_connection(ENV["DB"] || "sqlite3mem")
|
10
|
+
ActiveRecord::Base.establish_connection((ENV["DB"] || "sqlite3mem").to_sym)
|
11
11
|
ActiveRecord::Migration.verbose = false
|
12
12
|
load(File.join(plugin_test_dir, "db", "schema.rb"))
|
13
13
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_commentable_with_threading
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Light
|
@@ -11,110 +11,107 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rspec
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '3.0'
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '3.0'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: rails
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
50
|
+
version: '4.0'
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
57
|
+
version: '4.0'
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: activerecord
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: '
|
64
|
+
version: '4.0'
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- -
|
69
|
+
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
71
|
+
version: '4.0'
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: activesupport
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ">="
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: '
|
78
|
+
version: '4.0'
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
85
|
+
version: '4.0'
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: awesome_nested_set
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
|
-
- -
|
90
|
+
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
92
|
+
version: '3.0'
|
93
93
|
type: :runtime
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
100
|
-
description: Polymorphic threaded comments Rails gem for Rails
|
99
|
+
version: '3.0'
|
100
|
+
description: Polymorphic threaded comments Rails gem for Rails 4+
|
101
101
|
email: evan@tripledogdare.net
|
102
102
|
executables: []
|
103
103
|
extensions: []
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
|
-
- .gitignore
|
107
|
-
- .travis.yml
|
108
|
-
- CHANGELOG
|
106
|
+
- ".gitignore"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CHANGELOG.md
|
109
109
|
- Gemfile
|
110
110
|
- Gemfile.lock
|
111
111
|
- MIT-LICENSE
|
112
112
|
- README.md
|
113
113
|
- Rakefile
|
114
114
|
- acts_as_commentable_with_threading.gemspec
|
115
|
-
- gemfiles/Gemfile.rails-3.0
|
116
|
-
- gemfiles/Gemfile.rails-3.1
|
117
|
-
- gemfiles/Gemfile.rails-3.2
|
118
115
|
- gemfiles/Gemfile.rails-4.0
|
119
116
|
- gemfiles/Gemfile.rails-4.1
|
120
117
|
- init.rb
|
@@ -143,24 +140,23 @@ require_paths:
|
|
143
140
|
- lib
|
144
141
|
required_ruby_version: !ruby/object:Gem::Requirement
|
145
142
|
requirements:
|
146
|
-
- -
|
143
|
+
- - ">="
|
147
144
|
- !ruby/object:Gem::Version
|
148
145
|
version: '0'
|
149
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
147
|
requirements:
|
151
|
-
- -
|
148
|
+
- - ">="
|
152
149
|
- !ruby/object:Gem::Version
|
153
150
|
version: '0'
|
154
151
|
requirements: []
|
155
152
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.4.2
|
157
154
|
signing_key:
|
158
155
|
specification_version: 4
|
159
|
-
summary: Polymorphic comments Rails gem - Rails
|
156
|
+
summary: Polymorphic comments Rails gem - Rails 4+ only
|
160
157
|
test_files:
|
161
|
-
- spec/commentable_spec.rb
|
162
158
|
- spec/comment_spec.rb
|
163
|
-
- spec/
|
159
|
+
- spec/commentable_spec.rb
|
164
160
|
- spec/db/database.yml
|
165
161
|
- spec/db/schema.rb
|
166
|
-
|
162
|
+
- spec/spec_helper.rb
|
data/CHANGELOG
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
v0.1.0
|
2
|
-
------
|
3
|
-
Initial Release
|
4
|
-
|
5
|
-
v0.1.1
|
6
|
-
------
|
7
|
-
Fixes to gemspec
|
8
|
-
|
9
|
-
v0.1.2
|
10
|
-
------
|
11
|
-
|
12
|
-
Added new documentation in README that should better help users understand this plugin
|
13
|
-
Added new instance method "root_comments" that will return all comments belonging to a model except child comments
|
14
|
-
Added new class method for Comment: "self.build_from(object, user_id, comment_text:string)"
|
15
|
-
- This method cleans up the code inside the controllers.
|
16
|
-
Added new class method for Comment: "has_children?" that will return true or false depending on if a comment has children
|
17
|
-
Updated deprecated code in instance method "comments_ordered_by_submitted"
|
18
|
-
- changed "self.type.name" to "self.class.name"
|
19
|
-
|
20
|
-
v0.1.2
|
21
|
-
|
22
|
-
fixed a problem that arises when trying to use the acts_as_voteable plugin with your comments
|
data/gemfiles/Gemfile.rails-3.0
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gemspec path: '..'
|
4
|
-
|
5
|
-
gem 'activerecord', '~> 3.0.0'
|
6
|
-
gem 'activesupport', '~> 3.0.0'
|
7
|
-
gem "awesome_nested_set", "~> 2.0.0"
|
8
|
-
|
9
|
-
platforms :rbx do
|
10
|
-
gem 'rubysl', '~> 2.0'
|
11
|
-
gem 'rubinius-developer_tools'
|
12
|
-
end
|
13
|
-
|
14
|
-
group :development do
|
15
|
-
gem 'rake'
|
16
|
-
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
17
|
-
gem 'sqlite3', :platforms => :ruby
|
18
|
-
gem 'rails', '~> 3.0.0'
|
19
|
-
end
|
20
|
-
|
21
|
-
group :development, :test do
|
22
|
-
gem 'rspec', '~> 2.4'
|
23
|
-
gem 'rspec-rails', '~> 2.4'
|
24
|
-
end
|
data/gemfiles/Gemfile.rails-3.1
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gemspec path: '..'
|
4
|
-
|
5
|
-
gem 'activerecord', '~> 3.1.0'
|
6
|
-
gem 'activesupport', '~> 3.1.0'
|
7
|
-
gem "awesome_nested_set", "~> 2.0.0"
|
8
|
-
|
9
|
-
platforms :rbx do
|
10
|
-
gem 'rubysl', '~> 2.0'
|
11
|
-
gem 'rubinius-developer_tools'
|
12
|
-
end
|
13
|
-
|
14
|
-
group :development do
|
15
|
-
gem 'rake'
|
16
|
-
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
17
|
-
gem 'sqlite3', :platforms => :ruby
|
18
|
-
gem 'rails', '~> 3.1.0'
|
19
|
-
end
|
20
|
-
|
21
|
-
group :development, :test do
|
22
|
-
gem 'rspec', '~> 2.4'
|
23
|
-
gem 'rspec-rails', '~> 2.4'
|
24
|
-
end
|
data/gemfiles/Gemfile.rails-3.2
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gemspec path: '..'
|
4
|
-
|
5
|
-
gem 'activerecord', '~> 3.2.0'
|
6
|
-
gem 'activesupport', '~> 3.2.0'
|
7
|
-
gem "awesome_nested_set", "~> 2.1.0"
|
8
|
-
|
9
|
-
platforms :rbx do
|
10
|
-
gem 'rubysl', '~> 2.0'
|
11
|
-
gem 'rubinius-developer_tools'
|
12
|
-
end
|
13
|
-
|
14
|
-
group :development do
|
15
|
-
gem 'rake'
|
16
|
-
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
17
|
-
gem 'sqlite3', :platforms => :ruby
|
18
|
-
gem 'rails', '~> 3.2.0'
|
19
|
-
end
|
20
|
-
|
21
|
-
group :development, :test do
|
22
|
-
gem 'rspec', '~> 2.4'
|
23
|
-
gem 'rspec-rails', '~> 2.4'
|
24
|
-
end
|