inkwell 1.0.5 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/inkwell/blog_item.rb +1 -1
- data/app/models/inkwell/comment.rb +22 -24
- data/app/models/inkwell/favorite_item.rb +1 -2
- data/app/models/inkwell/timeline_item.rb +1 -2
- data/db/migrate/20130202130030_change_is_comment_to_item_type.rb +18 -0
- data/db/migrate/20130202130040_add_owner_type_to_lines.rb +16 -0
- data/db/migrate/20130212130858_refactor_comment_table.rb +7 -0
- data/db/migrate/20130212130868_rename_parent_id_to_parent_comment_id_in_comment_table.rb +5 -0
- data/lib/acts_as_inkwell_community/base.rb +16 -16
- data/lib/acts_as_inkwell_post/base.rb +15 -14
- data/lib/acts_as_inkwell_user/base.rb +41 -34
- data/lib/common/base.rb +28 -4
- data/lib/inkwell/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130210231424_change_is_comment_to_item_type.inkwell.rb +19 -0
- data/test/dummy/db/migrate/20130212130848_add_owner_type_to_lines.inkwell.rb +17 -0
- data/test/dummy/db/migrate/20130213101736_refactor_comment_table.inkwell.rb +8 -0
- data/test/dummy/db/migrate/20130213121414_rename_parent_id_to_parent_comment_id_in_comment_table.inkwell.rb +6 -0
- data/test/dummy/db/schema.rb +14 -11
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +699 -0
- data/test/dummy/log/test.log +0 -0
- data/test/dummy/spec/functional/blogline_spec.rb +7 -7
- data/test/dummy/spec/functional/comments_spec.rb +129 -132
- data/test/dummy/spec/functional/community_spec.rb +119 -120
- data/test/dummy/spec/functional/favorite_spec.rb +27 -27
- data/test/dummy/spec/functional/following_spec.rb +26 -26
- data/test/dummy/spec/functional/reblog_spec.rb +32 -32
- data/test/dummy/spec/functional/timeline_spec.rb +1 -1
- data/test/dummy_without_community/db/development.sqlite3 +0 -0
- data/test/dummy_without_community/db/migrate/20130213115833_change_is_comment_to_item_type.inkwell.rb +19 -0
- data/test/dummy_without_community/db/migrate/20130213115834_add_owner_type_to_lines.inkwell.rb +17 -0
- data/test/dummy_without_community/db/migrate/20130213115835_refactor_comment_table.inkwell.rb +8 -0
- data/test/dummy_without_community/db/schema.rb +13 -10
- data/test/dummy_without_community/db/test.sqlite3 +0 -0
- data/test/dummy_without_community/log/development.log +111 -0
- data/test/dummy_without_community/log/test.log +11393 -0
- data/test/dummy_without_community/spec/functional/blogline_spec.rb +7 -7
- data/test/dummy_without_community/spec/functional/comments_spec.rb +128 -131
- data/test/dummy_without_community/spec/functional/favorite_spec.rb +27 -27
- data/test/dummy_without_community/spec/functional/following_spec.rb +26 -26
- data/test/dummy_without_community/spec/functional/reblog_spec.rb +32 -32
- data/test/dummy_without_community/spec/functional/timeline_spec.rb +1 -1
- metadata +32 -14
@@ -6,7 +6,7 @@ describe "Following" do
|
|
6
6
|
@salkar = User.create :nick => "Salkar"
|
7
7
|
@morozovm = User.create :nick => "Morozovm"
|
8
8
|
@salkar_post = @salkar.posts.create :body => "salkar_post_test_body"
|
9
|
-
@salkar_comment = @salkar.
|
9
|
+
@salkar_comment = @salkar.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
|
10
10
|
@salkar_post1 = @salkar.posts.create :body => "salkar_post_test_body"
|
11
11
|
@salkar_post2 = @salkar.posts.create :body => "salkar_post_test_body"
|
12
12
|
@salkar_post3 = @salkar.posts.create :body => "salkar_post_test_body"
|
@@ -14,7 +14,7 @@ describe "Following" do
|
|
14
14
|
@morozovm_post1 = @morozovm.posts.create :body => "salkar_post_test_body"
|
15
15
|
@morozovm_post2 = @morozovm.posts.create :body => "salkar_post_test_body"
|
16
16
|
@morozovm_post3 = @morozovm.posts.create :body => "salkar_post_test_body"
|
17
|
-
@morozovm_comment = @morozovm.
|
17
|
+
@morozovm_comment = @morozovm.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
|
18
18
|
end
|
19
19
|
|
20
20
|
it "user should follow another user" do
|
@@ -26,18 +26,18 @@ describe "Following" do
|
|
26
26
|
@salkar.followers_ids.should == "[]"
|
27
27
|
@salkar.followers_row.should == []
|
28
28
|
|
29
|
-
@salkar.
|
30
|
-
@salkar.
|
31
|
-
@salkar.
|
32
|
-
@salkar.
|
33
|
-
@salkar.
|
34
|
-
@salkar.
|
35
|
-
@salkar.
|
29
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 4
|
30
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post.id, ::Inkwell::Constants::ItemTypes::POST).should be
|
31
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post1.id, ::Inkwell::Constants::ItemTypes::POST).should be
|
32
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post2.id, ::Inkwell::Constants::ItemTypes::POST).should be
|
33
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post3.id, ::Inkwell::Constants::ItemTypes::POST).should be
|
34
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_comment.id, ::Inkwell::Constants::ItemTypes::COMMENT).should == nil
|
35
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).each do |item|
|
36
36
|
item.has_many_sources.should == false
|
37
37
|
ActiveSupport::JSON.decode(item.from_source).should == [Hash['user_id' => @morozovm.id, 'type' => 'following']]
|
38
38
|
end
|
39
39
|
|
40
|
-
@morozovm.
|
40
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
|
41
41
|
@morozovm.followers_ids.should == "[#{@salkar.id}]"
|
42
42
|
@morozovm.followers_row.should == [@salkar.id]
|
43
43
|
@morozovm.followings_ids.should == "[]"
|
@@ -46,10 +46,10 @@ describe "Following" do
|
|
46
46
|
|
47
47
|
it "created_at from blog_item should transferred to timeline_item for follower when he follow this user" do
|
48
48
|
@salkar.follow @morozovm
|
49
|
-
@salkar.
|
50
|
-
@salkar.
|
51
|
-
@salkar.
|
52
|
-
@salkar.
|
49
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post.id, ::Inkwell::Constants::ItemTypes::POST).created_at.to_s.should == @morozovm_post.created_at.to_s
|
50
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post1.id, ::Inkwell::Constants::ItemTypes::POST).created_at.to_s.should == @morozovm_post1.created_at.to_s
|
51
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post2.id, ::Inkwell::Constants::ItemTypes::POST).created_at.to_s.should == @morozovm_post2.created_at.to_s
|
52
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post3.id, ::Inkwell::Constants::ItemTypes::POST).created_at.to_s.should == @morozovm_post3.created_at.to_s
|
53
53
|
end
|
54
54
|
|
55
55
|
it "user should follow another user (follow?)" do
|
@@ -70,10 +70,10 @@ describe "Following" do
|
|
70
70
|
it "user should unfollow another user" do
|
71
71
|
@salkar.follow @morozovm
|
72
72
|
@salkar.reload
|
73
|
-
@salkar.
|
73
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 4
|
74
74
|
@salkar.unfollow @morozovm
|
75
75
|
@salkar.reload
|
76
|
-
@salkar.
|
76
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
|
77
77
|
|
78
78
|
end
|
79
79
|
|
@@ -81,11 +81,11 @@ describe "Following" do
|
|
81
81
|
@talisman = User.create :nick => "Talisman"
|
82
82
|
@talisman.reblog @salkar_post
|
83
83
|
@morozovm.follow @talisman
|
84
|
-
@morozovm.
|
85
|
-
item = @morozovm.
|
84
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
|
85
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
|
86
86
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @talisman.id, 'type' => 'reblog'}])
|
87
87
|
item.item_id.should == @salkar_post.id
|
88
|
-
item.
|
88
|
+
item.item_type.should == ::Inkwell::Constants::ItemTypes::POST
|
89
89
|
end
|
90
90
|
|
91
91
|
it "timeline item should not delete if has many sources when unfollow" do
|
@@ -93,25 +93,25 @@ describe "Following" do
|
|
93
93
|
@talisman.reblog @salkar_post
|
94
94
|
@morozovm.follow @talisman
|
95
95
|
@morozovm.follow @salkar
|
96
|
-
@morozovm.
|
97
|
-
item = @morozovm.
|
96
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
97
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
|
98
98
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @talisman.id, 'type' => 'reblog'},{'user_id' => @salkar.id, 'type' => 'following'}])
|
99
99
|
item.has_many_sources.should == true
|
100
100
|
|
101
101
|
@morozovm.unfollow @salkar
|
102
|
-
@morozovm.
|
103
|
-
item = @morozovm.
|
102
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
103
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
|
104
104
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @talisman.id, 'type' => 'reblog'}])
|
105
105
|
item.has_many_sources.should == false
|
106
106
|
|
107
107
|
@morozovm.follow @salkar
|
108
|
-
item = @morozovm.
|
108
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
|
109
109
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @talisman.id, 'type' => 'reblog'},{'user_id' => @salkar.id, 'type' => 'following'}])
|
110
110
|
item.has_many_sources.should == true
|
111
111
|
|
112
112
|
@morozovm.unfollow @talisman
|
113
|
-
@morozovm.
|
114
|
-
item = @morozovm.
|
113
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
114
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
|
115
115
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @salkar.id, 'type' => 'following'}])
|
116
116
|
item.has_many_sources.should == false
|
117
117
|
end
|
@@ -7,20 +7,20 @@ describe "Reblog" do
|
|
7
7
|
@morozovm = User.create :nick => "Morozovm"
|
8
8
|
@talisman = User.create :nick => "Talisman"
|
9
9
|
@salkar_post = @salkar.posts.create :body => "salkar_post_test_body"
|
10
|
-
@salkar_comment = @salkar.
|
10
|
+
@salkar_comment = @salkar.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "user should reblog post" do
|
14
14
|
@morozovm.reblog @salkar_post
|
15
|
-
::Inkwell::BlogItem.where(:item_id => @salkar_post.id, :
|
16
|
-
::Inkwell::BlogItem.where(:item_id => @salkar_post.id, :
|
15
|
+
::Inkwell::BlogItem.where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 2
|
16
|
+
::Inkwell::BlogItem.where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER, :is_reblog => true).size.should == 1
|
17
17
|
@salkar_post.reload
|
18
18
|
@salkar_post.users_ids_who_reblog_it.should == "[#{@morozovm.id}]"
|
19
19
|
end
|
20
20
|
|
21
21
|
it "user should reblog comment" do
|
22
22
|
@morozovm.reblog @salkar_comment
|
23
|
-
::Inkwell::BlogItem.where(:item_id => @salkar_comment.id, :
|
23
|
+
::Inkwell::BlogItem.where(:item_id => @salkar_comment.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER, :is_reblog => true).size.should == 1
|
24
24
|
@salkar_comment.reload
|
25
25
|
@salkar_comment.users_ids_who_reblog_it.should == "[#{@morozovm.id}]"
|
26
26
|
end
|
@@ -28,38 +28,38 @@ describe "Reblog" do
|
|
28
28
|
it "timeline item should been created for followers when user reblog post" do
|
29
29
|
@talisman.follow @morozovm
|
30
30
|
@morozovm.reblog @salkar_post
|
31
|
-
@talisman.
|
32
|
-
item = @talisman.
|
31
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
|
32
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
|
33
33
|
item.item_id.should == @salkar_post.id
|
34
34
|
item.created_at.to_i.should == @salkar_post.created_at.to_i
|
35
35
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @morozovm.id, 'type' => 'reblog'}])
|
36
|
-
item.
|
36
|
+
item.item_type.should == ::Inkwell::Constants::ItemTypes::POST
|
37
37
|
end
|
38
38
|
|
39
39
|
it "timeline item should been created for followers when user reblog comment" do
|
40
40
|
@talisman.follow @morozovm
|
41
41
|
@morozovm.reblog @salkar_comment
|
42
|
-
@talisman.
|
43
|
-
item = @talisman.
|
42
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
|
43
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
|
44
44
|
item.item_id.should == @salkar_comment.id
|
45
45
|
item.created_at.to_i.should == @salkar_comment.created_at.to_i
|
46
46
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @morozovm.id, 'type' => 'reblog'}])
|
47
|
-
item.
|
47
|
+
item.item_type.should == ::Inkwell::Constants::ItemTypes::COMMENT
|
48
48
|
end
|
49
49
|
|
50
50
|
it "timeline item should not been created for follower's post/comment" do
|
51
51
|
@salkar.follow @morozovm
|
52
52
|
@morozovm.reblog @salkar_post
|
53
53
|
@morozovm.reblog @salkar_comment
|
54
|
-
@salkar.
|
54
|
+
::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
|
55
55
|
end
|
56
56
|
|
57
57
|
it "one timeline item should created for one post with two sources" do
|
58
58
|
@talisman.follow @morozovm
|
59
59
|
@morozovm.reblog @salkar_post
|
60
60
|
@talisman.follow @salkar
|
61
|
-
@talisman.
|
62
|
-
item = @talisman.
|
61
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
62
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
|
63
63
|
item.has_many_sources.should == true
|
64
64
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @morozovm.id, 'type' => 'reblog'},{'user_id' => @salkar.id, 'type' => 'following'}])
|
65
65
|
end
|
@@ -68,8 +68,8 @@ describe "Reblog" do
|
|
68
68
|
@talisman.follow @morozovm
|
69
69
|
@talisman.follow @salkar
|
70
70
|
@morozovm.reblog @salkar_post
|
71
|
-
@talisman.
|
72
|
-
item = @talisman.
|
71
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
72
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
|
73
73
|
item.has_many_sources.should == true
|
74
74
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @salkar.id, 'type' => 'following'}, {'user_id' => @morozovm.id, 'type' => 'reblog'}])
|
75
75
|
end
|
@@ -91,8 +91,8 @@ describe "Reblog" do
|
|
91
91
|
it "user should unreblog post" do
|
92
92
|
@morozovm.reblog @salkar_post
|
93
93
|
@morozovm.unreblog @salkar_post
|
94
|
-
::Inkwell::BlogItem.where(:item_id => @salkar_post.id, :
|
95
|
-
::Inkwell::BlogItem.where(:item_id => @salkar_post.id, :
|
94
|
+
::Inkwell::BlogItem.where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
95
|
+
::Inkwell::BlogItem.where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER, :is_reblog => true).size.should == 0
|
96
96
|
@salkar_post.reload
|
97
97
|
@salkar_post.users_ids_who_reblog_it.should == "[]"
|
98
98
|
end
|
@@ -100,7 +100,7 @@ describe "Reblog" do
|
|
100
100
|
it "user should unreblog comment" do
|
101
101
|
@morozovm.reblog @salkar_comment
|
102
102
|
@morozovm.unreblog @salkar_comment
|
103
|
-
::Inkwell::BlogItem.where(:item_id => @salkar_comment.id, :
|
103
|
+
::Inkwell::BlogItem.where(:item_id => @salkar_comment.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER, :is_reblog => true).size.should == 0
|
104
104
|
@salkar_comment.reload
|
105
105
|
@salkar_comment.users_ids_who_reblog_it.should == "[]"
|
106
106
|
end
|
@@ -111,15 +111,15 @@ describe "Reblog" do
|
|
111
111
|
@morozovm_post = @morozovm.posts.create :body => "morozovm_post_test_body"
|
112
112
|
@morozovm.reblog @salkar_post
|
113
113
|
|
114
|
-
@talisman.
|
115
|
-
@talisman.
|
116
|
-
item = @talisman.
|
114
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 2
|
115
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
116
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
|
117
117
|
item.has_many_sources.should == false
|
118
118
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @morozovm.id, 'type' => 'reblog'}])
|
119
119
|
|
120
120
|
@morozovm.unreblog @salkar_post
|
121
|
-
@talisman.
|
122
|
-
@talisman.
|
121
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 0
|
122
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
|
123
123
|
end
|
124
124
|
|
125
125
|
it "timeline items should delete for followers when user unreblog comment" do
|
@@ -127,13 +127,13 @@ describe "Reblog" do
|
|
127
127
|
@talisman.follow @morozovm
|
128
128
|
@morozovm.reblog @salkar_comment
|
129
129
|
|
130
|
-
@talisman.
|
131
|
-
item = @talisman.
|
130
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_comment, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT).size.should == 1
|
131
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
|
132
132
|
item.has_many_sources.should == false
|
133
133
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @morozovm.id, 'type' => 'reblog'}])
|
134
134
|
|
135
135
|
@morozovm.unreblog @salkar_comment
|
136
|
-
@talisman.
|
136
|
+
::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_comment, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT).size.should == 0
|
137
137
|
end
|
138
138
|
|
139
139
|
it "timeline item should not been delete if post has many sources and unreblogged by following" do
|
@@ -142,18 +142,18 @@ describe "Reblog" do
|
|
142
142
|
@morozovm.follow @talisman
|
143
143
|
@morozovm.follow @salkar
|
144
144
|
@talisman_post = @talisman.posts.create :body => "talisman_post_test_body"
|
145
|
-
@morozovm.
|
146
|
-
@morozovm.
|
147
|
-
item = @morozovm.
|
145
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size == 2
|
146
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
147
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
|
148
148
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @talisman.id, 'type' => 'reblog'}, {'user_id' => @salkar.id, 'type' => 'following'}])
|
149
149
|
item.has_many_sources.should == true
|
150
150
|
|
151
151
|
@talisman.unreblog @salkar_post
|
152
|
-
@morozovm.
|
153
|
-
item = @morozovm.
|
152
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
|
153
|
+
item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
|
154
154
|
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @salkar.id, 'type' => 'following'}])
|
155
155
|
item.has_many_sources.should == false
|
156
|
-
@morozovm.
|
156
|
+
::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size == 2
|
157
157
|
end
|
158
158
|
|
159
159
|
it "reblog count should been received for post" do
|
@@ -53,7 +53,7 @@ describe "Timeline" do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "comment should been in timeline" do
|
56
|
-
@salkar_comment = @salkar.
|
56
|
+
@salkar_comment = @salkar.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
|
57
57
|
@talisman.follow @morozovm
|
58
58
|
@morozovm.reblog @salkar_comment
|
59
59
|
@morozovm.favorite @salkar_comment
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inkwell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement: &
|
16
|
+
requirement: &79187780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *79187780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activerecord
|
27
|
-
requirement: &
|
27
|
+
requirement: &79185940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.1.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *79185940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec-rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &79184480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *79184480
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: database_cleaner
|
49
|
-
requirement: &
|
49
|
+
requirement: &79183940 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *79183940
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sqlite3
|
60
|
-
requirement: &
|
60
|
+
requirement: &79201300 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *79201300
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rails
|
71
|
-
requirement: &
|
71
|
+
requirement: &79200320 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 3.1.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *79200320
|
80
80
|
description: Inkwell provides simple way to add social networking features like comments,
|
81
81
|
reblogs, favorites, following/followers, communities and timelines to your Ruby
|
82
82
|
on Rails application.
|
@@ -98,12 +98,16 @@ files:
|
|
98
98
|
- config/routes.rb
|
99
99
|
- db/migrate/20121209121955_create_inkwell_blog_items.rb
|
100
100
|
- db/migrate/20121209124743_create_inkwell_comments.rb
|
101
|
+
- db/migrate/20130202130030_change_is_comment_to_item_type.rb
|
101
102
|
- db/migrate/20121202140816_add_columns_to_posts.rb
|
102
103
|
- db/migrate/20121202140510_create_inkwell_timeline_items.rb
|
103
104
|
- db/migrate/20130202130010_change_tables_for_communities.rb
|
104
105
|
- db/migrate/20121209124435_add_columns_to_users.rb
|
106
|
+
- db/migrate/20130212130868_rename_parent_id_to_parent_comment_id_in_comment_table.rb
|
105
107
|
- db/migrate/20121209123557_create_inkwell_favorite_items.rb
|
108
|
+
- db/migrate/20130212130858_refactor_comment_table.rb
|
106
109
|
- db/migrate/20130202130020_add_community_ids_to_post.rb
|
110
|
+
- db/migrate/20130202130040_add_owner_type_to_lines.rb
|
107
111
|
- lib/inkwell/version.rb
|
108
112
|
- lib/inkwell/engine.rb
|
109
113
|
- lib/common/base.rb
|
@@ -164,10 +168,13 @@ files:
|
|
164
168
|
- test/dummy_without_community/db/seeds.rb
|
165
169
|
- test/dummy_without_community/db/test.sqlite3
|
166
170
|
- test/dummy_without_community/db/migrate/20130208134749_change_tables_for_communities.inkwell.rb
|
171
|
+
- test/dummy_without_community/db/migrate/20130213115835_refactor_comment_table.inkwell.rb
|
167
172
|
- test/dummy_without_community/db/migrate/20130208134745_create_inkwell_blog_items.inkwell.rb
|
168
173
|
- test/dummy_without_community/db/migrate/20121202112556_create_users.rb
|
169
174
|
- test/dummy_without_community/db/migrate/20130208134743_create_inkwell_timeline_items.inkwell.rb
|
170
175
|
- test/dummy_without_community/db/migrate/20130208134748_create_inkwell_comments.inkwell.rb
|
176
|
+
- test/dummy_without_community/db/migrate/20130213115834_add_owner_type_to_lines.inkwell.rb
|
177
|
+
- test/dummy_without_community/db/migrate/20130213115833_change_is_comment_to_item_type.inkwell.rb
|
171
178
|
- test/dummy_without_community/db/migrate/20130208134744_add_columns_to_posts.inkwell.rb
|
172
179
|
- test/dummy_without_community/db/migrate/20130208134746_create_inkwell_favorite_items.inkwell.rb
|
173
180
|
- test/dummy_without_community/db/migrate/20121202111750_create_posts.rb
|
@@ -234,12 +241,16 @@ files:
|
|
234
241
|
- test/dummy/db/migrate/20130208134951_create_inkwell_favorite_items.inkwell.rb
|
235
242
|
- test/dummy/db/migrate/20130208134949_add_columns_to_posts.inkwell.rb
|
236
243
|
- test/dummy/db/migrate/20130208134955_add_community_ids_to_post.inkwell.rb
|
244
|
+
- test/dummy/db/migrate/20130213101736_refactor_comment_table.inkwell.rb
|
237
245
|
- test/dummy/db/migrate/20121202112556_create_users.rb
|
238
246
|
- test/dummy/db/migrate/20130208134952_add_columns_to_users.inkwell.rb
|
247
|
+
- test/dummy/db/migrate/20130212130848_add_owner_type_to_lines.inkwell.rb
|
248
|
+
- test/dummy/db/migrate/20130213121414_rename_parent_id_to_parent_comment_id_in_comment_table.inkwell.rb
|
239
249
|
- test/dummy/db/migrate/20130208134954_change_tables_for_communities.inkwell.rb
|
240
250
|
- test/dummy/db/migrate/20130201155147_create_communities.rb
|
241
251
|
- test/dummy/db/migrate/20130208134950_create_inkwell_blog_items.inkwell.rb
|
242
252
|
- test/dummy/db/migrate/20130208134953_create_inkwell_comments.inkwell.rb
|
253
|
+
- test/dummy/db/migrate/20130210231424_change_is_comment_to_item_type.inkwell.rb
|
243
254
|
- test/dummy/db/migrate/20130208134948_create_inkwell_timeline_items.inkwell.rb
|
244
255
|
- test/dummy/db/migrate/20121202111750_create_posts.rb
|
245
256
|
- test/dummy/log/development.log
|
@@ -326,10 +337,13 @@ test_files:
|
|
326
337
|
- test/dummy_without_community/db/seeds.rb
|
327
338
|
- test/dummy_without_community/db/test.sqlite3
|
328
339
|
- test/dummy_without_community/db/migrate/20130208134749_change_tables_for_communities.inkwell.rb
|
340
|
+
- test/dummy_without_community/db/migrate/20130213115835_refactor_comment_table.inkwell.rb
|
329
341
|
- test/dummy_without_community/db/migrate/20130208134745_create_inkwell_blog_items.inkwell.rb
|
330
342
|
- test/dummy_without_community/db/migrate/20121202112556_create_users.rb
|
331
343
|
- test/dummy_without_community/db/migrate/20130208134743_create_inkwell_timeline_items.inkwell.rb
|
332
344
|
- test/dummy_without_community/db/migrate/20130208134748_create_inkwell_comments.inkwell.rb
|
345
|
+
- test/dummy_without_community/db/migrate/20130213115834_add_owner_type_to_lines.inkwell.rb
|
346
|
+
- test/dummy_without_community/db/migrate/20130213115833_change_is_comment_to_item_type.inkwell.rb
|
333
347
|
- test/dummy_without_community/db/migrate/20130208134744_add_columns_to_posts.inkwell.rb
|
334
348
|
- test/dummy_without_community/db/migrate/20130208134746_create_inkwell_favorite_items.inkwell.rb
|
335
349
|
- test/dummy_without_community/db/migrate/20121202111750_create_posts.rb
|
@@ -396,12 +410,16 @@ test_files:
|
|
396
410
|
- test/dummy/db/migrate/20130208134951_create_inkwell_favorite_items.inkwell.rb
|
397
411
|
- test/dummy/db/migrate/20130208134949_add_columns_to_posts.inkwell.rb
|
398
412
|
- test/dummy/db/migrate/20130208134955_add_community_ids_to_post.inkwell.rb
|
413
|
+
- test/dummy/db/migrate/20130213101736_refactor_comment_table.inkwell.rb
|
399
414
|
- test/dummy/db/migrate/20121202112556_create_users.rb
|
400
415
|
- test/dummy/db/migrate/20130208134952_add_columns_to_users.inkwell.rb
|
416
|
+
- test/dummy/db/migrate/20130212130848_add_owner_type_to_lines.inkwell.rb
|
417
|
+
- test/dummy/db/migrate/20130213121414_rename_parent_id_to_parent_comment_id_in_comment_table.inkwell.rb
|
401
418
|
- test/dummy/db/migrate/20130208134954_change_tables_for_communities.inkwell.rb
|
402
419
|
- test/dummy/db/migrate/20130201155147_create_communities.rb
|
403
420
|
- test/dummy/db/migrate/20130208134950_create_inkwell_blog_items.inkwell.rb
|
404
421
|
- test/dummy/db/migrate/20130208134953_create_inkwell_comments.inkwell.rb
|
422
|
+
- test/dummy/db/migrate/20130210231424_change_is_comment_to_item_type.inkwell.rb
|
405
423
|
- test/dummy/db/migrate/20130208134948_create_inkwell_timeline_items.inkwell.rb
|
406
424
|
- test/dummy/db/migrate/20121202111750_create_posts.rb
|
407
425
|
- test/dummy/log/development.log
|