acts_as_commentable_more 1.0.0 → 1.1.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 +0 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/README.md +125 -0
- data/lib/acts_as_commentable_more/version.rb +1 -1
- data/lib/comment_methods.rb +1 -2
- data/lib/commentable_methods.rb +69 -19
- data/lib/generators/commentable/templates/comment.rb +1 -1
- data/lib/generators/commentable/templates/create_comments.rb +1 -1
- data/test/dummy/app/models/note.rb +1 -1
- data/test/dummy/app/models/note_custom_asso_name.rb +3 -0
- data/test/dummy/app/models/post_custom_asso_name.rb +5 -0
- data/test/dummy/db/migrate/20150115094241_create_post_custom_asso_names.rb +9 -0
- data/test/dummy/db/migrate/20150115100013_create_note_custom_asso_names.rb +9 -0
- data/test/dummy/db/schema.rb +13 -1
- data/test/dummy/spec/acts_as_commentable_more_spec.rb +84 -14
- data/test/dummy/spec/factories/note_custom_asso_names.rb +7 -0
- data/test/dummy/spec/factories/post_custom_asso_names.rb +7 -0
- data/test/dummy/spec/models/note_custom_asso_name_spec.rb +5 -0
- data/test/dummy/spec/models/post_custom_asso_name_spec.rb +5 -0
- metadata +99 -6
- data/CHANGELOG.rdoc +0 -5
- data/README.rdoc +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34e7a65a0d3d92ad12ccf057b91b1090ac644f84
|
4
|
+
data.tar.gz: 914e9ff328dbf6f67d1e017ce3654aea22301473
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d5fd53004b6b185a0fe1db4dcdee001cb3a71977adfcaf2fb2bed1c7227d53407c1a860b5022ec34743fa9b372cc2a3754e12f665f75d91f3ab2b2a29e1c13d
|
7
|
+
data.tar.gz: 2fb62454d83a02a86545161f2063eaf6152ff28a0642f454a74f5da7e8e9878f6e593f91ce74d6bed71ee01221993ef1be2f8a8b80f70f4b312d5a9531bdb29c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
data/README.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# ActsAsCommentableMore
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/acts_as_commentable_more.svg)](http://badge.fury.io/rb/acts_as_commentable_more)
|
4
|
+
[![Build Status](https://travis-ci.org/piya23300/acts_as_commentable_more.svg)](https://travis-ci.org/piya23300/acts_as_commentable_more)
|
5
|
+
[![Dependency Status](https://gemnasium.com/piya23300/acts_as_commentable_more.svg)](https://gemnasium.com/piya23300/acts_as_commentable_more)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/piya23300/acts_as_commentable_more/badge.svg)](https://coveralls.io/r/piya23300/acts_as_commentable_more)
|
7
|
+
|
8
|
+
---
|
9
|
+
## Thank you
|
10
|
+
acts_as_commentable_more develops from [acts_as_commentable](https://github.com/jackdempsey/acts_as_commentable).
|
11
|
+
|
12
|
+
Thank you very much for way and inspiration.
|
13
|
+
|
14
|
+
### Generator
|
15
|
+
|
16
|
+
Generate model and migration
|
17
|
+
```ruby
|
18
|
+
rails generate commentable your_model_name
|
19
|
+
```
|
20
|
+
---
|
21
|
+
|
22
|
+
### Basic Usege
|
23
|
+
### Setting
|
24
|
+
Model would like to have commentable.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
class Post < ActiveRecord::Base
|
28
|
+
acts_as_commentable # default options types: [:comment], options: { class_name: 'Comment', as: :commentable }, as: :comments
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
post = Post.create #<Post>
|
34
|
+
|
35
|
+
#get all comments of post
|
36
|
+
comments = post.comments #<ActiveRecord::Associations::CollectionProxy []>
|
37
|
+
|
38
|
+
#create comment of post
|
39
|
+
comment = post.creates_comments(message: 'new message') #<Comment>
|
40
|
+
comment = post.comments.create(message: 'new message') #<Comment>
|
41
|
+
|
42
|
+
#get owner comment
|
43
|
+
user = User.create
|
44
|
+
|
45
|
+
comment = post.creates_comments(message: 'I am user', user: user)
|
46
|
+
comment.user #<User>
|
47
|
+
|
48
|
+
```
|
49
|
+
|
50
|
+
### Any type of user in the same table
|
51
|
+
```ruby
|
52
|
+
post = Post.create #<Post>
|
53
|
+
|
54
|
+
admin = Admin.create
|
55
|
+
user = User.create
|
56
|
+
|
57
|
+
comment = post.creates_comments(message: 'I am user', user: user)
|
58
|
+
comment.user #<User>
|
59
|
+
|
60
|
+
comment = post.creates_comments(message: 'I am admin', user: admin)
|
61
|
+
comment.user #<Admin>
|
62
|
+
|
63
|
+
```
|
64
|
+
|
65
|
+
### Many type of comment
|
66
|
+
Setting Model
|
67
|
+
```ruby
|
68
|
+
class Post < ActiveRecord::Base
|
69
|
+
acts_as_commentable types: [:private, :public] # default options: { class_name: 'Comment', as: :commentable }, as: :comments
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
usage
|
74
|
+
```ruby
|
75
|
+
post = Post.create #<Post>
|
76
|
+
|
77
|
+
#get all private comments of post
|
78
|
+
private_comments = post.private_comments #[<Comment role: 'private'>]
|
79
|
+
|
80
|
+
#get all public comments of post
|
81
|
+
public_comments = post.public_comments #[<Comment role: 'public'>]
|
82
|
+
|
83
|
+
#get all comment of post
|
84
|
+
comments = post.all_comments #[<Comment>]
|
85
|
+
|
86
|
+
#create private comments
|
87
|
+
private_comment = post.creates_private_comments(message: 'private message') #<Comment role: 'private'>
|
88
|
+
|
89
|
+
#create public comments
|
90
|
+
public_comment = post.creates_public_comments(message: 'public message') #<Comment role: 'public'>
|
91
|
+
|
92
|
+
```
|
93
|
+
|
94
|
+
### Helper Method
|
95
|
+
|
96
|
+
#### For many types of comment
|
97
|
+
```ruby
|
98
|
+
post = Post.create #<Post>
|
99
|
+
|
100
|
+
private_comment = post.creates_private_comments #<Comment>
|
101
|
+
|
102
|
+
#Checked type of comment
|
103
|
+
private_comment.is_private? #true
|
104
|
+
private_comment.is_public? #false
|
105
|
+
|
106
|
+
#Changed type of comment
|
107
|
+
private_comment.to_public #not save
|
108
|
+
private_comment.to_public! #save
|
109
|
+
```
|
110
|
+
|
111
|
+
### Options
|
112
|
+
```ruby
|
113
|
+
acts_as_commentable types: [:show, :hide], options: { class_name: 'CustomComment', as: :custom_commentable }, as: notes
|
114
|
+
```
|
115
|
+
|
116
|
+
- type : type of comment #array
|
117
|
+
- options : association options #hash
|
118
|
+
- class_name : class name of comment
|
119
|
+
- as : polymorephic name
|
120
|
+
- as : name of association
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
## LICENSE
|
125
|
+
This project rocks and uses MIT-LICENSE.
|
data/lib/comment_methods.rb
CHANGED
data/lib/commentable_methods.rb
CHANGED
@@ -4,57 +4,107 @@ module Happio
|
|
4
4
|
module Commentable #:nodoc:
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
|
-
included do
|
8
|
-
mattr_accessor :comment_roles
|
9
|
-
end
|
10
|
-
|
11
7
|
module HelperMethods
|
12
8
|
private
|
13
|
-
def define_role_based_inflection(role, join_options)
|
14
|
-
|
9
|
+
def define_role_based_inflection(role, association_base_name, join_options)
|
10
|
+
association_name = "#{role.to_s}_#{association_base_name.to_s}"
|
11
|
+
send("define_role_based_inflection_#{Rails.version.first}", role, association_name,join_options)
|
15
12
|
end
|
16
13
|
|
17
|
-
def define_role_based_inflection_3(role,
|
18
|
-
has_many "#{
|
14
|
+
def define_role_based_inflection_3(role, association_name, join_options)
|
15
|
+
has_many "#{association_name.to_s}".to_sym,
|
19
16
|
has_many_options(role, join_options).merge(:conditions => { role: role.to_s })
|
20
17
|
end
|
21
18
|
|
22
|
-
def define_role_based_inflection_4(role, join_options)
|
23
|
-
has_many "#{
|
19
|
+
def define_role_based_inflection_4(role, association_name, join_options)
|
20
|
+
has_many "#{association_name.to_s}".to_sym,
|
24
21
|
-> { where(role: role.to_s) },
|
25
22
|
has_many_options(role, join_options)
|
23
|
+
define_create_role_comments(association_name)
|
26
24
|
end
|
27
25
|
|
28
26
|
def has_many_options(role, join_options)
|
29
27
|
{ :before_add => Proc.new { |x, c| c.role = role.to_s } }.merge(join_options)
|
30
28
|
end
|
29
|
+
|
30
|
+
def define_create_role_comments(association_name)
|
31
|
+
class_eval %{
|
32
|
+
def creates_#{association_name.to_s.pluralize}(attributes = nil)
|
33
|
+
#{association_name.to_s}.create(attributes)
|
34
|
+
end
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
31
38
|
end
|
32
39
|
|
33
40
|
module ClassMethods
|
34
41
|
include HelperMethods
|
35
42
|
|
36
|
-
def acts_as_commentable(types: [], options: {})
|
43
|
+
def acts_as_commentable(types: [], options: {}, as: nil)
|
44
|
+
mattr_accessor :comment_roles
|
45
|
+
|
37
46
|
default_options = {as: :commentable, dependent: :destroy, class_name: 'Comment'}
|
38
|
-
|
47
|
+
default_as = :comments
|
48
|
+
default_roles = [default_as.to_s.singularize.to_sym]
|
49
|
+
|
50
|
+
types = types.flatten.compact.map(&:to_sym)
|
51
|
+
|
39
52
|
|
40
53
|
association_options = default_options.merge(options.compact)
|
41
|
-
self.comment_roles =
|
42
|
-
|
43
|
-
|
44
|
-
|
54
|
+
self.comment_roles = types.present? ? types : default_roles
|
55
|
+
association_base_name = (as || default_as).to_s.pluralize
|
56
|
+
|
57
|
+
if comment_roles == [default_as.to_s.singularize.to_sym]
|
58
|
+
has_many association_base_name.to_sym, has_many_options(association_base_name.singularize, association_options)
|
59
|
+
define_create_role_comments(association_base_name)
|
45
60
|
else
|
46
61
|
comment_roles.each do |role|
|
47
|
-
define_role_based_inflection(role, association_options)
|
62
|
+
define_role_based_inflection(role, association_base_name, association_options)
|
48
63
|
end
|
64
|
+
|
65
|
+
association_class = association_options[:class_name].classify.constantize
|
66
|
+
|
49
67
|
class_eval %{
|
50
|
-
def
|
51
|
-
#{
|
68
|
+
def all_#{association_base_name.to_s}
|
69
|
+
#{association_class}
|
52
70
|
.where(
|
53
71
|
#{association_options[:as].to_s + '_id'}: self.id,
|
54
72
|
#{association_options[:as].to_s + '_type'}: self.class.base_class.name
|
55
73
|
).order(created_at: :desc)
|
56
74
|
end
|
57
75
|
}
|
76
|
+
|
77
|
+
association_class.class_eval %{
|
78
|
+
private
|
79
|
+
|
80
|
+
def can_change_role?(role)
|
81
|
+
commentable_object = #{association_options[:as]}
|
82
|
+
limit_role = commentable_object.class.comment_roles
|
83
|
+
# p limit_role
|
84
|
+
# p role
|
85
|
+
limit_role.include?(role.to_sym)
|
86
|
+
end
|
87
|
+
|
88
|
+
}
|
89
|
+
|
90
|
+
comment_roles.each do |role|
|
91
|
+
association_class.class_eval %{
|
92
|
+
def is_#{role}?
|
93
|
+
role == "#{role.to_s}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def to_#{role}
|
97
|
+
raise TypeError, "Can not change to " + role.to_s unless can_change_role?("#{role.to_s}")
|
98
|
+
self.role = "#{role.to_s}"
|
99
|
+
end
|
100
|
+
|
101
|
+
def to_#{role}!
|
102
|
+
to_#{role}
|
103
|
+
self.save
|
104
|
+
end
|
105
|
+
|
106
|
+
}
|
107
|
+
end
|
58
108
|
end
|
59
109
|
|
60
110
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
class <%= class_name %> < ActiveRecord::Base
|
3
3
|
###################################################################
|
4
4
|
### To implement commentable add the following line to your model
|
5
|
-
### acts_as_commentable types: [:hide, :show], options: { class_name: '<%= class_name %>', as: :<%= class_name.demodulize.underscore + "able" %> }
|
5
|
+
### acts_as_commentable types: [:hide, :show], options: { class_name: '<%= class_name %>', as: :<%= class_name.demodulize.underscore + "able" %> }, as: :<%= class_name.demodulize.downcase.pluralize %>
|
6
6
|
|
7
7
|
### types is an array of possible comment type
|
8
8
|
### for example if you have public and private comment
|
@@ -13,6 +13,6 @@ class <%= migration_class_name %> < ActiveRecord::Migration
|
|
13
13
|
end
|
14
14
|
|
15
15
|
add_index :<%= table_name %>, [:<%= class_name.demodulize.underscore + "able" %>_type, :<%= class_name.demodulize.underscore + "able" %>_id],
|
16
|
-
name: :index_<%=
|
16
|
+
name: :index_<%= table_name %>_on_<%= class_name.demodulize.underscore %>able_type_and_<%= class_name.demodulize.underscore %>able_id
|
17
17
|
end
|
18
18
|
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20150115100013) do
|
15
15
|
|
16
16
|
# These are extensions that must be enabled in order to support this database
|
17
17
|
enable_extension "plpgsql"
|
@@ -59,12 +59,24 @@ ActiveRecord::Schema.define(version: 20150114100422) do
|
|
59
59
|
t.datetime "updated_at"
|
60
60
|
end
|
61
61
|
|
62
|
+
create_table "note_custom_asso_names", force: true do |t|
|
63
|
+
t.string "title"
|
64
|
+
t.datetime "created_at"
|
65
|
+
t.datetime "updated_at"
|
66
|
+
end
|
67
|
+
|
62
68
|
create_table "notes", force: true do |t|
|
63
69
|
t.string "title"
|
64
70
|
t.datetime "created_at"
|
65
71
|
t.datetime "updated_at"
|
66
72
|
end
|
67
73
|
|
74
|
+
create_table "post_custom_asso_names", force: true do |t|
|
75
|
+
t.string "title"
|
76
|
+
t.datetime "created_at"
|
77
|
+
t.datetime "updated_at"
|
78
|
+
end
|
79
|
+
|
68
80
|
create_table "posts", force: true do |t|
|
69
81
|
t.string "title"
|
70
82
|
t.datetime "created_at"
|
@@ -71,10 +71,12 @@ RSpec.describe ActsAsCommentableMore do
|
|
71
71
|
|
72
72
|
end
|
73
73
|
|
74
|
-
describe "managed comments with association options
|
74
|
+
describe "managed comments with association options(:class_name and :as)" do
|
75
75
|
it "add a comment" do
|
76
76
|
topic = create(:topic)
|
77
|
-
|
77
|
+
comment = topic.comments.build(message: 'my message')
|
78
|
+
expect{comment.save}.to change(CustomComment, :count).by(1)
|
79
|
+
expect(comment.role).to eq 'comment'
|
78
80
|
end
|
79
81
|
it "gets all comment" do
|
80
82
|
topics = create_list(:topic, 2)
|
@@ -101,7 +103,7 @@ RSpec.describe ActsAsCommentableMore do
|
|
101
103
|
it "default association options" do
|
102
104
|
note = create(:note)
|
103
105
|
5.times { |i| note.private_comments.create(message: 'private message') }
|
104
|
-
3.times { |i| note.
|
106
|
+
3.times { |i| note.public_comments.create(message: 'public message') }
|
105
107
|
|
106
108
|
other_note = create(:note)
|
107
109
|
5.times { |i| other_note.private_comments.create(message: 'private message') }
|
@@ -130,9 +132,9 @@ RSpec.describe ActsAsCommentableMore do
|
|
130
132
|
it "gets comment specific role by {role}_comments method" do
|
131
133
|
note = create(:note)
|
132
134
|
5.times { |i| note.private_comments.create(message: 'private message') }
|
133
|
-
3.times { |i| note.
|
135
|
+
3.times { |i| note.public_comments.create(message: 'public message') }
|
134
136
|
expect(note.private_comments.count).to eq 5
|
135
|
-
expect(note.
|
137
|
+
expect(note.public_comments.count).to eq 3
|
136
138
|
end
|
137
139
|
|
138
140
|
it "add comment specific role" do
|
@@ -142,11 +144,47 @@ RSpec.describe ActsAsCommentableMore do
|
|
142
144
|
expect{private_note.save}.to change(Comment, :count).by(1)
|
143
145
|
expect(private_note.role).to eq 'private'
|
144
146
|
|
145
|
-
|
146
|
-
expect{
|
147
|
-
expect(
|
147
|
+
public_note = note.public_comments.build(message: 'public message')
|
148
|
+
expect{public_note.save}.to change(Comment, :count).by(1)
|
149
|
+
expect(public_note.role).to eq 'public'
|
148
150
|
end
|
149
151
|
|
152
|
+
describe "creates_{role}_{as}s method for adding comment of role" do
|
153
|
+
it "creates_private_comments" do
|
154
|
+
note = create(:note)
|
155
|
+
expect{note.creates_private_comments(message: 'new comment')}.to change(Comment, :count).by(1)
|
156
|
+
end
|
157
|
+
it "creates_public_comments" do
|
158
|
+
note = create(:note)
|
159
|
+
expect{note.creates_public_comments(message: 'new comment')}.to change(Comment, :count).by(1)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
it "#to_role to change only" do
|
164
|
+
note = create(:note)
|
165
|
+
private_comment = note.private_comments.create(message: 'private message')
|
166
|
+
private_comment.to_public
|
167
|
+
expect(private_comment.role).to eq 'public'
|
168
|
+
private_comment.reload
|
169
|
+
expect(private_comment.role).to eq 'private'
|
170
|
+
end
|
171
|
+
it "#to_role! to change and update" do
|
172
|
+
note = create(:note)
|
173
|
+
private_comment = note.private_comments.create(message: 'private message')
|
174
|
+
private_comment.to_public!
|
175
|
+
expect(private_comment.role).to eq 'public'
|
176
|
+
private_comment.reload
|
177
|
+
expect(private_comment.role).to eq 'public'
|
178
|
+
end
|
179
|
+
|
180
|
+
it "#is_role? to check role value" do
|
181
|
+
note = create(:note)
|
182
|
+
private_comment = note.private_comments.create(message: 'private message')
|
183
|
+
expect(private_comment.is_private?).to eq true
|
184
|
+
expect(private_comment.is_public?).to eq false
|
185
|
+
end
|
186
|
+
|
187
|
+
|
150
188
|
describe "class helper" do
|
151
189
|
context "self.find_comments_by_user(user, role: nil)" do
|
152
190
|
before do
|
@@ -155,18 +193,18 @@ RSpec.describe ActsAsCommentableMore do
|
|
155
193
|
@admin = create(:admin)
|
156
194
|
@user = create(:user)
|
157
195
|
user_private_comment_note_1 = note_1.private_comments.create(message: 'private message user', user: @user)
|
158
|
-
|
159
|
-
admin_comment_note_1 = note_1.
|
196
|
+
user_public_comment_note_2 = note_2.public_comments.create(message: 'public message user', user: @user)
|
197
|
+
admin_comment_note_1 = note_1.public_comments.create(message: 'public message admin', user: @admin)
|
160
198
|
end
|
161
199
|
|
162
200
|
it "findby user and role=nil" do
|
163
201
|
Comment.find_comments_by_user(@user).each do |comment|
|
164
202
|
expect(comment.user).to eq @user
|
165
|
-
expect(comment.role).to eq('private').or eq('
|
203
|
+
expect(comment.role).to eq('private').or eq('public')
|
166
204
|
end
|
167
205
|
Comment.find_comments_by_user(@admin).each do |comment|
|
168
206
|
expect(comment.user).to eq @admin
|
169
|
-
expect(comment.role).to eq('private').or eq('
|
207
|
+
expect(comment.role).to eq('private').or eq('public')
|
170
208
|
end
|
171
209
|
end
|
172
210
|
|
@@ -175,9 +213,9 @@ RSpec.describe ActsAsCommentableMore do
|
|
175
213
|
expect(comment.user).to eq @user
|
176
214
|
expect(comment.role).to eq 'private'
|
177
215
|
end
|
178
|
-
Comment.find_comments_by_user(@admin, :
|
216
|
+
Comment.find_comments_by_user(@admin, :public).each do |comment|
|
179
217
|
expect(comment.user).to eq @admin
|
180
|
-
expect(comment.role).to eq '
|
218
|
+
expect(comment.role).to eq 'public'
|
181
219
|
end
|
182
220
|
end
|
183
221
|
|
@@ -202,4 +240,36 @@ RSpec.describe ActsAsCommentableMore do
|
|
202
240
|
|
203
241
|
end
|
204
242
|
|
243
|
+
describe "setting :as to custom association name" do
|
244
|
+
it "role= :as.singulize" do
|
245
|
+
post_custom = create(:post_custom_asso_name)
|
246
|
+
comment = post_custom.creates_custom_comments
|
247
|
+
expect(comment.role).to eq 'custom_comment'
|
248
|
+
end
|
249
|
+
it "doen't have any roles" do
|
250
|
+
post_custom = create(:post_custom_asso_name)
|
251
|
+
expect{post_custom.custom_comments}.not_to raise_error
|
252
|
+
expect{post_custom.creates_custom_comments()}.not_to raise_error
|
253
|
+
|
254
|
+
expect{post_custom.comments}.to raise_error(NoMethodError)
|
255
|
+
expect{post_custom.creates_comments()}.to raise_error(NoMethodError)
|
256
|
+
end
|
257
|
+
|
258
|
+
it "has roles" do
|
259
|
+
note_custom = create(:note_custom_asso_name)
|
260
|
+
expect{note_custom.all_custom_comments}.not_to raise_error
|
261
|
+
expect{note_custom.private_custom_comments}.not_to raise_error
|
262
|
+
expect{note_custom.public_custom_comments}.not_to raise_error
|
263
|
+
expect{note_custom.creates_public_custom_comments()}.not_to raise_error
|
264
|
+
expect{note_custom.creates_private_custom_comments()}.not_to raise_error
|
265
|
+
|
266
|
+
expect{note_custom.all_comments}.to raise_error(NoMethodError)
|
267
|
+
expect{note_custom.private_comments}.to raise_error(NoMethodError)
|
268
|
+
expect{note_custom.public_comments()}.to raise_error(NoMethodError)
|
269
|
+
expect{note_custom.creates_public_comments()}.to raise_error(NoMethodError)
|
270
|
+
expect{note_custom.creates_private_comments()}.to raise_error(NoMethodError)
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
274
|
+
|
205
275
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_commentable_more
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piya23300
|
8
8
|
autorequire: acts_as_commentable_more
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -76,12 +76,12 @@ files:
|
|
76
76
|
- .coveralls.yml
|
77
77
|
- .gitignore
|
78
78
|
- .travis.yml
|
79
|
-
- CHANGELOG.
|
79
|
+
- CHANGELOG.md
|
80
80
|
- Gemfile
|
81
81
|
- Gemfile.lock
|
82
82
|
- LICENSE
|
83
83
|
- MIT-LICENSE
|
84
|
-
- README.
|
84
|
+
- README.md
|
85
85
|
- Rakefile
|
86
86
|
- acts_as_commentable_more.gemspec
|
87
87
|
- lib/acts_as_commentable_more.rb
|
@@ -110,7 +110,9 @@ files:
|
|
110
110
|
- test/dummy/app/models/custom_comment.rb
|
111
111
|
- test/dummy/app/models/letter.rb
|
112
112
|
- test/dummy/app/models/note.rb
|
113
|
+
- test/dummy/app/models/note_custom_asso_name.rb
|
113
114
|
- test/dummy/app/models/post.rb
|
115
|
+
- test/dummy/app/models/post_custom_asso_name.rb
|
114
116
|
- test/dummy/app/models/topic.rb
|
115
117
|
- test/dummy/app/models/user.rb
|
116
118
|
- test/dummy/app/views/layouts/application.html.erb
|
@@ -144,6 +146,8 @@ files:
|
|
144
146
|
- test/dummy/db/migrate/20150114052120_create_letters.rb
|
145
147
|
- test/dummy/db/migrate/20150114100411_create_comments.rb
|
146
148
|
- test/dummy/db/migrate/20150114100422_create_custom_comments.rb
|
149
|
+
- test/dummy/db/migrate/20150115094241_create_post_custom_asso_names.rb
|
150
|
+
- test/dummy/db/migrate/20150115100013_create_note_custom_asso_names.rb
|
147
151
|
- test/dummy/db/schema.rb
|
148
152
|
- test/dummy/lib/assets/.keep
|
149
153
|
- test/dummy/log/.keep
|
@@ -156,14 +160,18 @@ files:
|
|
156
160
|
- test/dummy/spec/factories/comments.rb
|
157
161
|
- test/dummy/spec/factories/custom_comments.rb
|
158
162
|
- test/dummy/spec/factories/letters.rb
|
163
|
+
- test/dummy/spec/factories/note_custom_asso_names.rb
|
159
164
|
- test/dummy/spec/factories/notes.rb
|
165
|
+
- test/dummy/spec/factories/post_custom_asso_names.rb
|
160
166
|
- test/dummy/spec/factories/posts.rb
|
161
167
|
- test/dummy/spec/factories/topics.rb
|
162
168
|
- test/dummy/spec/factories/users.rb
|
163
169
|
- test/dummy/spec/models/admin_spec.rb
|
164
170
|
- test/dummy/spec/models/custom_comment_spec.rb
|
165
171
|
- test/dummy/spec/models/letter_spec.rb
|
172
|
+
- test/dummy/spec/models/note_custom_asso_name_spec.rb
|
166
173
|
- test/dummy/spec/models/note_spec.rb
|
174
|
+
- test/dummy/spec/models/post_custom_asso_name_spec.rb
|
167
175
|
- test/dummy/spec/models/post_spec.rb
|
168
176
|
- test/dummy/spec/models/topic_spec.rb
|
169
177
|
- test/dummy/spec/models/user_spec.rb
|
@@ -190,8 +198,93 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
198
|
version: '0'
|
191
199
|
requirements: []
|
192
200
|
rubyforge_project:
|
193
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.2.2
|
194
202
|
signing_key:
|
195
203
|
specification_version: 4
|
196
204
|
summary: gem that provides comment functionality.
|
197
|
-
test_files:
|
205
|
+
test_files:
|
206
|
+
- test/acts_as_commentable_more_test.rb
|
207
|
+
- test/dummy/README.rdoc
|
208
|
+
- test/dummy/Rakefile
|
209
|
+
- test/dummy/app/assets/images/.keep
|
210
|
+
- test/dummy/app/assets/javascripts/application.js
|
211
|
+
- test/dummy/app/assets/stylesheets/application.css
|
212
|
+
- test/dummy/app/controllers/application_controller.rb
|
213
|
+
- test/dummy/app/controllers/concerns/.keep
|
214
|
+
- test/dummy/app/helpers/application_helper.rb
|
215
|
+
- test/dummy/app/mailers/.keep
|
216
|
+
- test/dummy/app/models/.keep
|
217
|
+
- test/dummy/app/models/admin.rb
|
218
|
+
- test/dummy/app/models/comment.rb
|
219
|
+
- test/dummy/app/models/concerns/.keep
|
220
|
+
- test/dummy/app/models/custom_comment.rb
|
221
|
+
- test/dummy/app/models/letter.rb
|
222
|
+
- test/dummy/app/models/note.rb
|
223
|
+
- test/dummy/app/models/note_custom_asso_name.rb
|
224
|
+
- test/dummy/app/models/post.rb
|
225
|
+
- test/dummy/app/models/post_custom_asso_name.rb
|
226
|
+
- test/dummy/app/models/topic.rb
|
227
|
+
- test/dummy/app/models/user.rb
|
228
|
+
- test/dummy/app/views/layouts/application.html.erb
|
229
|
+
- test/dummy/bin/bundle
|
230
|
+
- test/dummy/bin/rails
|
231
|
+
- test/dummy/bin/rake
|
232
|
+
- test/dummy/config.ru
|
233
|
+
- test/dummy/config/application.rb
|
234
|
+
- test/dummy/config/boot.rb
|
235
|
+
- test/dummy/config/database.travis.yml
|
236
|
+
- test/dummy/config/environment.rb
|
237
|
+
- test/dummy/config/environments/development.rb
|
238
|
+
- test/dummy/config/environments/production.rb
|
239
|
+
- test/dummy/config/environments/test.rb
|
240
|
+
- test/dummy/config/initializers/assets.rb
|
241
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
242
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
243
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
244
|
+
- test/dummy/config/initializers/inflections.rb
|
245
|
+
- test/dummy/config/initializers/mime_types.rb
|
246
|
+
- test/dummy/config/initializers/session_store.rb
|
247
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
248
|
+
- test/dummy/config/locales/en.yml
|
249
|
+
- test/dummy/config/routes.rb
|
250
|
+
- test/dummy/config/secrets.yml
|
251
|
+
- test/dummy/db/migrate/20150113045806_create_posts.rb
|
252
|
+
- test/dummy/db/migrate/20150113045817_create_admins.rb
|
253
|
+
- test/dummy/db/migrate/20150113045831_create_users.rb
|
254
|
+
- test/dummy/db/migrate/20150113065948_create_notes.rb
|
255
|
+
- test/dummy/db/migrate/20150113074249_create_topics.rb
|
256
|
+
- test/dummy/db/migrate/20150114052120_create_letters.rb
|
257
|
+
- test/dummy/db/migrate/20150114100411_create_comments.rb
|
258
|
+
- test/dummy/db/migrate/20150114100422_create_custom_comments.rb
|
259
|
+
- test/dummy/db/migrate/20150115094241_create_post_custom_asso_names.rb
|
260
|
+
- test/dummy/db/migrate/20150115100013_create_note_custom_asso_names.rb
|
261
|
+
- test/dummy/db/schema.rb
|
262
|
+
- test/dummy/lib/assets/.keep
|
263
|
+
- test/dummy/log/.keep
|
264
|
+
- test/dummy/public/404.html
|
265
|
+
- test/dummy/public/422.html
|
266
|
+
- test/dummy/public/500.html
|
267
|
+
- test/dummy/public/favicon.ico
|
268
|
+
- test/dummy/spec/acts_as_commentable_more_spec.rb
|
269
|
+
- test/dummy/spec/factories/admins.rb
|
270
|
+
- test/dummy/spec/factories/comments.rb
|
271
|
+
- test/dummy/spec/factories/custom_comments.rb
|
272
|
+
- test/dummy/spec/factories/letters.rb
|
273
|
+
- test/dummy/spec/factories/note_custom_asso_names.rb
|
274
|
+
- test/dummy/spec/factories/notes.rb
|
275
|
+
- test/dummy/spec/factories/post_custom_asso_names.rb
|
276
|
+
- test/dummy/spec/factories/posts.rb
|
277
|
+
- test/dummy/spec/factories/topics.rb
|
278
|
+
- test/dummy/spec/factories/users.rb
|
279
|
+
- test/dummy/spec/models/admin_spec.rb
|
280
|
+
- test/dummy/spec/models/custom_comment_spec.rb
|
281
|
+
- test/dummy/spec/models/letter_spec.rb
|
282
|
+
- test/dummy/spec/models/note_custom_asso_name_spec.rb
|
283
|
+
- test/dummy/spec/models/note_spec.rb
|
284
|
+
- test/dummy/spec/models/post_custom_asso_name_spec.rb
|
285
|
+
- test/dummy/spec/models/post_spec.rb
|
286
|
+
- test/dummy/spec/models/topic_spec.rb
|
287
|
+
- test/dummy/spec/models/user_spec.rb
|
288
|
+
- test/dummy/spec/rails_helper.rb
|
289
|
+
- test/dummy/spec/spec_helper.rb
|
290
|
+
- test/test_helper.rb
|
data/CHANGELOG.rdoc
DELETED
data/README.rdoc
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
= ActsAsCommentableMore
|
2
|
-
|
3
|
-
{<img src="https://gemnasium.com/piya23300/acts_as_commentable_more.svg" alt="Dependency Status" />}[https://gemnasium.com/piya23300/acts_as_commentable_more]
|
4
|
-
{<img src="https://coveralls.io/repos/piya23300/acts_as_commentable_more/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/piya23300/acts_as_commentable_more]
|
5
|
-
|
6
|
-
---
|
7
|
-
|
8
|
-
== Generate
|
9
|
-
|
10
|
-
rails generate commentable your_model_name
|
11
|
-
or
|
12
|
-
{read more about generate}[https://github.com/piya23300/acts_as_commentable_more/tree/develop/lib/generators/commentable/USAGE]
|
13
|
-
|
14
|
-
---
|
15
|
-
|
16
|
-
This project rocks and uses MIT-LICENSE.
|