inkwell 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. data/Rakefile +39 -0
  2. data/app/assets/javascripts/inkwell/application.js +9 -0
  3. data/app/assets/stylesheets/inkwell/application.css +7 -0
  4. data/app/controllers/inkwell/application_controller.rb +4 -0
  5. data/app/helpers/inkwell/application_helper.rb +4 -0
  6. data/app/models/inkwell/blog_item.rb +5 -0
  7. data/app/models/inkwell/comment.rb +125 -0
  8. data/app/models/inkwell/favorite_item.rb +5 -0
  9. data/app/models/inkwell/timeline_item.rb +5 -0
  10. data/app/views/layouts/inkwell/application.html.erb +14 -0
  11. data/config/routes.rb +3 -0
  12. data/db/migrate/20121202140510_create_inkwell_timeline_items.rb +13 -0
  13. data/db/migrate/20121202140816_add_columns_to_posts.rb +7 -0
  14. data/db/migrate/20121209121955_create_inkwell_blog_items.rb +12 -0
  15. data/db/migrate/20121209123557_create_inkwell_favorite_items.rb +11 -0
  16. data/db/migrate/20121209124435_add_columns_to_users.rb +6 -0
  17. data/db/migrate/20121209124743_create_inkwell_comments.rb +16 -0
  18. data/lib/acts_as_inkwell_post/base.rb +79 -0
  19. data/lib/acts_as_inkwell_user/base.rb +286 -0
  20. data/lib/common/base.rb +16 -0
  21. data/lib/inkwell.rb +7 -0
  22. data/lib/inkwell/engine.rb +5 -0
  23. data/lib/inkwell/version.rb +3 -0
  24. data/lib/tasks/inkwell_tasks.rake +4 -0
  25. data/test/dummy/Rakefile +7 -0
  26. data/test/dummy/app/assets/javascripts/application.js +9 -0
  27. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  28. data/test/dummy/app/controllers/application_controller.rb +3 -0
  29. data/test/dummy/app/helpers/application_helper.rb +2 -0
  30. data/test/dummy/app/models/post.rb +5 -0
  31. data/test/dummy/app/models/user.rb +6 -0
  32. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  33. data/test/dummy/config.ru +4 -0
  34. data/test/dummy/config/application.rb +45 -0
  35. data/test/dummy/config/boot.rb +10 -0
  36. data/test/dummy/config/database.yml +25 -0
  37. data/test/dummy/config/environment.rb +5 -0
  38. data/test/dummy/config/environments/development.rb +30 -0
  39. data/test/dummy/config/environments/production.rb +60 -0
  40. data/test/dummy/config/environments/test.rb +39 -0
  41. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  42. data/test/dummy/config/initializers/inflections.rb +10 -0
  43. data/test/dummy/config/initializers/inkwell.rb +6 -0
  44. data/test/dummy/config/initializers/mime_types.rb +5 -0
  45. data/test/dummy/config/initializers/secret_token.rb +7 -0
  46. data/test/dummy/config/initializers/session_store.rb +8 -0
  47. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  48. data/test/dummy/config/locales/en.yml +5 -0
  49. data/test/dummy/config/routes.rb +4 -0
  50. data/test/dummy/db/migrate/20121202111750_create_posts.rb +11 -0
  51. data/test/dummy/db/migrate/20121202112556_create_users.rb +9 -0
  52. data/test/dummy/db/migrate/20130120124010_create_inkwell_timeline_items.rb +13 -0
  53. data/test/dummy/db/migrate/20130120124011_add_columns_to_posts.rb +7 -0
  54. data/test/dummy/db/migrate/20130120124012_create_inkwell_blog_items.rb +12 -0
  55. data/test/dummy/db/migrate/20130120124013_create_inkwell_favorite_items.rb +11 -0
  56. data/test/dummy/db/migrate/20130120124014_add_columns_to_users.rb +6 -0
  57. data/test/dummy/db/migrate/20130120124015_create_inkwell_comments.rb +16 -0
  58. data/test/dummy/db/schema.rb +75 -0
  59. data/test/dummy/db/seeds.rb +7 -0
  60. data/test/dummy/public/404.html +26 -0
  61. data/test/dummy/public/422.html +26 -0
  62. data/test/dummy/public/500.html +26 -0
  63. data/test/dummy/public/favicon.ico +0 -0
  64. data/test/dummy/script/rails +6 -0
  65. data/test/dummy/spec/functional/blogline_spec.rb +70 -0
  66. data/test/dummy/spec/functional/comments_spec.rb +396 -0
  67. data/test/dummy/spec/functional/favorite_spec.rb +236 -0
  68. data/test/dummy/spec/functional/following_spec.rb +120 -0
  69. data/test/dummy/spec/functional/reblog_spec.rb +153 -0
  70. data/test/dummy/spec/functional/timeline_spec.rb +68 -0
  71. data/test/dummy/spec/spec_helper.rb +52 -0
  72. metadata +229 -0
@@ -0,0 +1,68 @@
1
+ require "rspec"
2
+
3
+ describe "Timeline" do
4
+ before(:each) do
5
+ @salkar = User.create :nick => "Salkar"
6
+ @morozovm = User.create :nick => "Morozovm"
7
+ @talisman = User.create :nick => "Talisman"
8
+ @salkar_post = @salkar.posts.create :body => "salkar_post_test_body"
9
+ end
10
+
11
+ it "user should has timeline" do
12
+ @salkar_post1 = @salkar.posts.create :body => "salkar_post_test_body_1"
13
+ @salkar_post2 = @salkar.posts.create :body => "salkar_post_test_body_2"
14
+ @salkar_post3 = @salkar.posts.create :body => "salkar_post_test_body_3"
15
+ @morozovm_post = @morozovm.posts.create :body => "morozovm_post_test_body"
16
+ @salkar_post4 = @salkar.posts.create :body => "salkar_post_test_body_4"
17
+ @salkar_post5 = @salkar.posts.create :body => "salkar_post_test_body_5"
18
+ @salkar.reblog @morozovm_post
19
+ @morozovm_post1 = @morozovm.posts.create :body => "morozovm_post_test_body_1"
20
+ @salkar_post6 = @salkar.posts.create :body => "salkar_post_test_body_6"
21
+ @salkar_post7 = @salkar.posts.create :body => "salkar_post_test_body_7"
22
+ @salkar_post8 = @salkar.posts.create :body => "salkar_post_test_body_8"
23
+ @morozovm_post2 = @morozovm.posts.create :body => "morozovm_post_test_body_2"
24
+ @salkar_post9 = @salkar.posts.create :body => "salkar_post_test_body_9"
25
+ @morozovm_post3 = @morozovm.posts.create :body => "morozovm_post_test_body_3"
26
+ @salkar.reblog @morozovm_post1
27
+ @salkar.reblog @morozovm_post2
28
+ @salkar.favorite @morozovm_post1
29
+
30
+ @talisman.follow @salkar
31
+ @talisman.reload
32
+ @talisman.follow @morozovm
33
+ @talisman.reload
34
+
35
+ tline = @talisman.timeline(nil, 10, @salkar)
36
+ tline.size.should == 10
37
+ tline[0].should == @morozovm_post2
38
+ tline[1].should == @morozovm_post1
39
+ tline[1].from_sources_in_timeline.should == ActiveSupport::JSON.encode([{'user_id' => @salkar.id, 'type' => 'reblog'}, {'user_id' => @morozovm.id, 'type' => 'following'}])
40
+ tline[1].is_reblogged.should == true
41
+ tline[1].is_favorited.should == true
42
+ tline[2].should == @morozovm_post3
43
+ tline[3].should == @salkar_post9
44
+ tline[3].from_sources_in_timeline.should == ActiveSupport::JSON.encode([{'user_id' => @salkar.id, 'type' => 'following'}])
45
+ tline[3].is_reblogged.should == false
46
+ tline[3].is_favorited.should == false
47
+ tline[4].should == @salkar_post8
48
+ tline[5].should == @salkar_post7
49
+ tline[6].should == @salkar_post6
50
+ tline[7].should == @morozovm_post
51
+ tline[8].should == @salkar_post5
52
+ tline[9].should == @salkar_post4
53
+ end
54
+
55
+ it "comment should been in timeline" do
56
+ @salkar_comment = @salkar.comments.create :post_id => @salkar_post.id, :body => "salkar_comment_body"
57
+ @talisman.follow @morozovm
58
+ @morozovm.reblog @salkar_comment
59
+ @morozovm.favorite @salkar_comment
60
+ @talisman.reload
61
+ tline = @talisman.timeline(nil, 10, @morozovm)
62
+ tline.size.should == 1
63
+ tline[0].should == @salkar_comment
64
+ tline[0].is_reblogged.should == true
65
+ tline[0].is_favorited.should == true
66
+ tline[0].from_sources_in_timeline.should == ActiveSupport::JSON.encode([{'user_id' => @morozovm.id, 'type' => 'reblog'}])
67
+ end
68
+ end
@@ -0,0 +1,52 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+ require 'database_cleaner'
7
+
8
+ # Requires supporting ruby files with custom matchers and macros, etc,
9
+ # in spec/support/ and its subdirectories.
10
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
11
+
12
+ RSpec.configure do |config|
13
+ # ## Mock Framework
14
+ #
15
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
16
+ #
17
+ # config.mock_with :mocha
18
+ # config.mock_with :flexmock
19
+ # config.mock_with :rr
20
+
21
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
22
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
23
+
24
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
25
+ # examples within a transaction, remove the following line or assign false
26
+ # instead of true.
27
+ config.use_transactional_fixtures = true
28
+
29
+ # If true, the base class of anonymous controllers will be inferred
30
+ # automatically. This will be the default behavior in future versions of
31
+ # rspec-rails.
32
+ config.infer_base_class_for_anonymous_controllers = false
33
+
34
+ # Run specs in random order to surface order dependencies. If you find an
35
+ # order dependency and want to debug it, you can fix the order by providing
36
+ # the seed, which is printed after each run.
37
+ # --seed 1234
38
+ config.order = "random"
39
+
40
+ config.before(:suite) do
41
+ DatabaseCleaner.strategy = :truncation
42
+ end
43
+
44
+ config.before(:each) do
45
+ DatabaseCleaner.clean
46
+ DatabaseCleaner.start
47
+ end
48
+
49
+ config.after(:each) do
50
+ DatabaseCleaner.clean
51
+ end
52
+ end
metadata ADDED
@@ -0,0 +1,229 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inkwell
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Salkar
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>'
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>'
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: database_cleaner
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: sqlite3
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Inkwell adds social networking features – comments, reblogs, favorites,
79
+ ability to follow other people and view their timeline.
80
+ email:
81
+ - sokolov.sergey.a@gmail.com
82
+ executables: []
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - app/assets/javascripts/inkwell/application.js
87
+ - app/assets/stylesheets/inkwell/application.css
88
+ - app/controllers/inkwell/application_controller.rb
89
+ - app/helpers/inkwell/application_helper.rb
90
+ - app/models/inkwell/blog_item.rb
91
+ - app/models/inkwell/comment.rb
92
+ - app/models/inkwell/favorite_item.rb
93
+ - app/models/inkwell/timeline_item.rb
94
+ - app/views/layouts/inkwell/application.html.erb
95
+ - config/routes.rb
96
+ - db/migrate/20121202140510_create_inkwell_timeline_items.rb
97
+ - db/migrate/20121202140816_add_columns_to_posts.rb
98
+ - db/migrate/20121209121955_create_inkwell_blog_items.rb
99
+ - db/migrate/20121209123557_create_inkwell_favorite_items.rb
100
+ - db/migrate/20121209124435_add_columns_to_users.rb
101
+ - db/migrate/20121209124743_create_inkwell_comments.rb
102
+ - lib/acts_as_inkwell_post/base.rb
103
+ - lib/acts_as_inkwell_user/base.rb
104
+ - lib/common/base.rb
105
+ - lib/inkwell/engine.rb
106
+ - lib/inkwell/version.rb
107
+ - lib/inkwell.rb
108
+ - lib/tasks/inkwell_tasks.rake
109
+ - Rakefile
110
+ - test/dummy/app/assets/javascripts/application.js
111
+ - test/dummy/app/assets/stylesheets/application.css
112
+ - test/dummy/app/controllers/application_controller.rb
113
+ - test/dummy/app/helpers/application_helper.rb
114
+ - test/dummy/app/models/post.rb
115
+ - test/dummy/app/models/user.rb
116
+ - test/dummy/app/views/layouts/application.html.erb
117
+ - test/dummy/config/application.rb
118
+ - test/dummy/config/boot.rb
119
+ - test/dummy/config/database.yml
120
+ - test/dummy/config/environment.rb
121
+ - test/dummy/config/environments/development.rb
122
+ - test/dummy/config/environments/production.rb
123
+ - test/dummy/config/environments/test.rb
124
+ - test/dummy/config/initializers/backtrace_silencers.rb
125
+ - test/dummy/config/initializers/inflections.rb
126
+ - test/dummy/config/initializers/inkwell.rb
127
+ - test/dummy/config/initializers/mime_types.rb
128
+ - test/dummy/config/initializers/secret_token.rb
129
+ - test/dummy/config/initializers/session_store.rb
130
+ - test/dummy/config/initializers/wrap_parameters.rb
131
+ - test/dummy/config/locales/en.yml
132
+ - test/dummy/config/routes.rb
133
+ - test/dummy/config.ru
134
+ - test/dummy/db/migrate/20121202111750_create_posts.rb
135
+ - test/dummy/db/migrate/20121202112556_create_users.rb
136
+ - test/dummy/db/migrate/20130120124010_create_inkwell_timeline_items.rb
137
+ - test/dummy/db/migrate/20130120124011_add_columns_to_posts.rb
138
+ - test/dummy/db/migrate/20130120124012_create_inkwell_blog_items.rb
139
+ - test/dummy/db/migrate/20130120124013_create_inkwell_favorite_items.rb
140
+ - test/dummy/db/migrate/20130120124014_add_columns_to_users.rb
141
+ - test/dummy/db/migrate/20130120124015_create_inkwell_comments.rb
142
+ - test/dummy/db/schema.rb
143
+ - test/dummy/db/seeds.rb
144
+ - test/dummy/public/404.html
145
+ - test/dummy/public/422.html
146
+ - test/dummy/public/500.html
147
+ - test/dummy/public/favicon.ico
148
+ - test/dummy/Rakefile
149
+ - test/dummy/script/rails
150
+ - test/dummy/spec/functional/blogline_spec.rb
151
+ - test/dummy/spec/functional/comments_spec.rb
152
+ - test/dummy/spec/functional/favorite_spec.rb
153
+ - test/dummy/spec/functional/following_spec.rb
154
+ - test/dummy/spec/functional/reblog_spec.rb
155
+ - test/dummy/spec/functional/timeline_spec.rb
156
+ - test/dummy/spec/spec_helper.rb
157
+ homepage: https://github.com/salkar/inkwell
158
+ licenses: []
159
+ post_install_message:
160
+ rdoc_options: []
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - ! '>='
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubyforge_project:
177
+ rubygems_version: 1.8.24
178
+ signing_key:
179
+ specification_version: 3
180
+ summary: Inkwell adds social networking features – comments, reblogs, favorites, ability
181
+ to follow other people and view their timeline.
182
+ test_files:
183
+ - test/dummy/app/assets/javascripts/application.js
184
+ - test/dummy/app/assets/stylesheets/application.css
185
+ - test/dummy/app/controllers/application_controller.rb
186
+ - test/dummy/app/helpers/application_helper.rb
187
+ - test/dummy/app/models/post.rb
188
+ - test/dummy/app/models/user.rb
189
+ - test/dummy/app/views/layouts/application.html.erb
190
+ - test/dummy/config/application.rb
191
+ - test/dummy/config/boot.rb
192
+ - test/dummy/config/database.yml
193
+ - test/dummy/config/environment.rb
194
+ - test/dummy/config/environments/development.rb
195
+ - test/dummy/config/environments/production.rb
196
+ - test/dummy/config/environments/test.rb
197
+ - test/dummy/config/initializers/backtrace_silencers.rb
198
+ - test/dummy/config/initializers/inflections.rb
199
+ - test/dummy/config/initializers/inkwell.rb
200
+ - test/dummy/config/initializers/mime_types.rb
201
+ - test/dummy/config/initializers/secret_token.rb
202
+ - test/dummy/config/initializers/session_store.rb
203
+ - test/dummy/config/initializers/wrap_parameters.rb
204
+ - test/dummy/config/locales/en.yml
205
+ - test/dummy/config/routes.rb
206
+ - test/dummy/config.ru
207
+ - test/dummy/db/migrate/20121202111750_create_posts.rb
208
+ - test/dummy/db/migrate/20121202112556_create_users.rb
209
+ - test/dummy/db/migrate/20130120124010_create_inkwell_timeline_items.rb
210
+ - test/dummy/db/migrate/20130120124011_add_columns_to_posts.rb
211
+ - test/dummy/db/migrate/20130120124012_create_inkwell_blog_items.rb
212
+ - test/dummy/db/migrate/20130120124013_create_inkwell_favorite_items.rb
213
+ - test/dummy/db/migrate/20130120124014_add_columns_to_users.rb
214
+ - test/dummy/db/migrate/20130120124015_create_inkwell_comments.rb
215
+ - test/dummy/db/schema.rb
216
+ - test/dummy/db/seeds.rb
217
+ - test/dummy/public/404.html
218
+ - test/dummy/public/422.html
219
+ - test/dummy/public/500.html
220
+ - test/dummy/public/favicon.ico
221
+ - test/dummy/Rakefile
222
+ - test/dummy/script/rails
223
+ - test/dummy/spec/functional/blogline_spec.rb
224
+ - test/dummy/spec/functional/comments_spec.rb
225
+ - test/dummy/spec/functional/favorite_spec.rb
226
+ - test/dummy/spec/functional/following_spec.rb
227
+ - test/dummy/spec/functional/reblog_spec.rb
228
+ - test/dummy/spec/functional/timeline_spec.rb
229
+ - test/dummy/spec/spec_helper.rb