inkwell 0.0.3 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/app/models/inkwell/comment.rb +23 -3
  2. data/lib/acts_as_inkwell_post/base.rb +23 -3
  3. data/lib/acts_as_inkwell_user/base.rb +26 -15
  4. data/lib/inkwell/version.rb +1 -1
  5. data/test/dummy/db/test.sqlite3 +0 -0
  6. data/test/dummy/log/development.log +5 -0
  7. data/test/dummy/log/test.log +28689 -0
  8. data/test/dummy/spec/functional/blogline_spec.rb +1 -1
  9. data/test/dummy/spec/functional/comments_spec.rb +34 -13
  10. data/test/dummy/spec/functional/favorite_spec.rb +26 -3
  11. data/test/dummy/spec/functional/reblog_spec.rb +27 -1
  12. data/test/dummy/spec/functional/timeline_spec.rb +2 -2
  13. data/test/dummy_without_community/Rakefile +7 -0
  14. data/test/dummy_without_community/app/assets/javascripts/application.js +9 -0
  15. data/test/dummy_without_community/app/assets/stylesheets/application.css +7 -0
  16. data/test/dummy_without_community/app/controllers/application_controller.rb +3 -0
  17. data/test/dummy_without_community/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy_without_community/app/models/post.rb +6 -0
  19. data/test/dummy_without_community/app/models/user.rb +7 -0
  20. data/test/dummy_without_community/app/views/layouts/application.html.erb +14 -0
  21. data/test/dummy_without_community/config.ru +4 -0
  22. data/test/dummy_without_community/config/application.rb +51 -0
  23. data/test/dummy_without_community/config/boot.rb +10 -0
  24. data/test/dummy_without_community/config/database.yml +25 -0
  25. data/test/dummy_without_community/config/environment.rb +5 -0
  26. data/test/dummy_without_community/config/environments/development.rb +30 -0
  27. data/test/dummy_without_community/config/environments/production.rb +60 -0
  28. data/test/dummy_without_community/config/environments/test.rb +42 -0
  29. data/test/dummy_without_community/config/initializers/backtrace_silencers.rb +7 -0
  30. data/test/dummy_without_community/config/initializers/inflections.rb +10 -0
  31. data/test/dummy_without_community/config/initializers/inkwell.rb +6 -0
  32. data/test/dummy_without_community/config/initializers/mime_types.rb +5 -0
  33. data/test/dummy_without_community/config/initializers/secret_token.rb +7 -0
  34. data/test/dummy_without_community/config/initializers/session_store.rb +8 -0
  35. data/test/dummy_without_community/config/initializers/wrap_parameters.rb +14 -0
  36. data/test/dummy_without_community/config/locales/en.yml +5 -0
  37. data/test/dummy_without_community/config/routes.rb +4 -0
  38. data/test/dummy_without_community/db/migrate/20121202111750_create_posts.rb +11 -0
  39. data/test/dummy_without_community/db/migrate/20121202112556_create_users.rb +9 -0
  40. data/test/dummy_without_community/db/migrate/20130120124010_create_inkwell_timeline_items.rb +13 -0
  41. data/test/dummy_without_community/db/migrate/20130120124011_add_columns_to_posts.rb +7 -0
  42. data/test/dummy_without_community/db/migrate/20130120124012_create_inkwell_blog_items.rb +12 -0
  43. data/test/dummy_without_community/db/migrate/20130120124013_create_inkwell_favorite_items.rb +11 -0
  44. data/test/dummy_without_community/db/migrate/20130120124014_add_columns_to_users.rb +6 -0
  45. data/test/dummy_without_community/db/migrate/20130120124015_create_inkwell_comments.rb +16 -0
  46. data/test/dummy_without_community/db/schema.rb +75 -0
  47. data/test/dummy_without_community/db/seeds.rb +7 -0
  48. data/test/dummy_without_community/public/404.html +26 -0
  49. data/test/dummy_without_community/public/422.html +26 -0
  50. data/test/dummy_without_community/public/500.html +26 -0
  51. data/test/dummy_without_community/public/favicon.ico +0 -0
  52. data/test/dummy_without_community/script/rails +6 -0
  53. data/test/dummy_without_community/spec/functional/blogline_spec.rb +70 -0
  54. data/test/dummy_without_community/spec/functional/comments_spec.rb +416 -0
  55. data/test/dummy_without_community/spec/functional/favorite_spec.rb +259 -0
  56. data/test/dummy_without_community/spec/functional/following_spec.rb +120 -0
  57. data/test/dummy_without_community/spec/functional/reblog_spec.rb +179 -0
  58. data/test/dummy_without_community/spec/functional/timeline_spec.rb +68 -0
  59. data/test/dummy_without_community/spec/spec_helper.rb +52 -0
  60. metadata +96 -2
@@ -0,0 +1,68 @@
1
+ require "spec_helper"
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(:for_user => @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(:last_shown_obj_id => nil, :limit => 10,:for_user => @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 CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inkwell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-27 00:00:00.000000000 Z
12
+ date: 2013-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -190,6 +190,53 @@ files:
190
190
  - test/dummy/spec/functional/reblog_spec.rb
191
191
  - test/dummy/spec/functional/timeline_spec.rb
192
192
  - test/dummy/spec/spec_helper.rb
193
+ - test/dummy_without_community/app/assets/javascripts/application.js
194
+ - test/dummy_without_community/app/assets/stylesheets/application.css
195
+ - test/dummy_without_community/app/controllers/application_controller.rb
196
+ - test/dummy_without_community/app/helpers/application_helper.rb
197
+ - test/dummy_without_community/app/models/post.rb
198
+ - test/dummy_without_community/app/models/user.rb
199
+ - test/dummy_without_community/app/views/layouts/application.html.erb
200
+ - test/dummy_without_community/config/application.rb
201
+ - test/dummy_without_community/config/boot.rb
202
+ - test/dummy_without_community/config/database.yml
203
+ - test/dummy_without_community/config/environment.rb
204
+ - test/dummy_without_community/config/environments/development.rb
205
+ - test/dummy_without_community/config/environments/production.rb
206
+ - test/dummy_without_community/config/environments/test.rb
207
+ - test/dummy_without_community/config/initializers/backtrace_silencers.rb
208
+ - test/dummy_without_community/config/initializers/inflections.rb
209
+ - test/dummy_without_community/config/initializers/inkwell.rb
210
+ - test/dummy_without_community/config/initializers/mime_types.rb
211
+ - test/dummy_without_community/config/initializers/secret_token.rb
212
+ - test/dummy_without_community/config/initializers/session_store.rb
213
+ - test/dummy_without_community/config/initializers/wrap_parameters.rb
214
+ - test/dummy_without_community/config/locales/en.yml
215
+ - test/dummy_without_community/config/routes.rb
216
+ - test/dummy_without_community/config.ru
217
+ - test/dummy_without_community/db/migrate/20121202111750_create_posts.rb
218
+ - test/dummy_without_community/db/migrate/20121202112556_create_users.rb
219
+ - test/dummy_without_community/db/migrate/20130120124010_create_inkwell_timeline_items.rb
220
+ - test/dummy_without_community/db/migrate/20130120124011_add_columns_to_posts.rb
221
+ - test/dummy_without_community/db/migrate/20130120124012_create_inkwell_blog_items.rb
222
+ - test/dummy_without_community/db/migrate/20130120124013_create_inkwell_favorite_items.rb
223
+ - test/dummy_without_community/db/migrate/20130120124014_add_columns_to_users.rb
224
+ - test/dummy_without_community/db/migrate/20130120124015_create_inkwell_comments.rb
225
+ - test/dummy_without_community/db/schema.rb
226
+ - test/dummy_without_community/db/seeds.rb
227
+ - test/dummy_without_community/public/404.html
228
+ - test/dummy_without_community/public/422.html
229
+ - test/dummy_without_community/public/500.html
230
+ - test/dummy_without_community/public/favicon.ico
231
+ - test/dummy_without_community/Rakefile
232
+ - test/dummy_without_community/script/rails
233
+ - test/dummy_without_community/spec/functional/blogline_spec.rb
234
+ - test/dummy_without_community/spec/functional/comments_spec.rb
235
+ - test/dummy_without_community/spec/functional/favorite_spec.rb
236
+ - test/dummy_without_community/spec/functional/following_spec.rb
237
+ - test/dummy_without_community/spec/functional/reblog_spec.rb
238
+ - test/dummy_without_community/spec/functional/timeline_spec.rb
239
+ - test/dummy_without_community/spec/spec_helper.rb
193
240
  homepage: https://github.com/salkar/inkwell#inkwell
194
241
  licenses: []
195
242
  post_install_message:
@@ -267,3 +314,50 @@ test_files:
267
314
  - test/dummy/spec/functional/reblog_spec.rb
268
315
  - test/dummy/spec/functional/timeline_spec.rb
269
316
  - test/dummy/spec/spec_helper.rb
317
+ - test/dummy_without_community/app/assets/javascripts/application.js
318
+ - test/dummy_without_community/app/assets/stylesheets/application.css
319
+ - test/dummy_without_community/app/controllers/application_controller.rb
320
+ - test/dummy_without_community/app/helpers/application_helper.rb
321
+ - test/dummy_without_community/app/models/post.rb
322
+ - test/dummy_without_community/app/models/user.rb
323
+ - test/dummy_without_community/app/views/layouts/application.html.erb
324
+ - test/dummy_without_community/config/application.rb
325
+ - test/dummy_without_community/config/boot.rb
326
+ - test/dummy_without_community/config/database.yml
327
+ - test/dummy_without_community/config/environment.rb
328
+ - test/dummy_without_community/config/environments/development.rb
329
+ - test/dummy_without_community/config/environments/production.rb
330
+ - test/dummy_without_community/config/environments/test.rb
331
+ - test/dummy_without_community/config/initializers/backtrace_silencers.rb
332
+ - test/dummy_without_community/config/initializers/inflections.rb
333
+ - test/dummy_without_community/config/initializers/inkwell.rb
334
+ - test/dummy_without_community/config/initializers/mime_types.rb
335
+ - test/dummy_without_community/config/initializers/secret_token.rb
336
+ - test/dummy_without_community/config/initializers/session_store.rb
337
+ - test/dummy_without_community/config/initializers/wrap_parameters.rb
338
+ - test/dummy_without_community/config/locales/en.yml
339
+ - test/dummy_without_community/config/routes.rb
340
+ - test/dummy_without_community/config.ru
341
+ - test/dummy_without_community/db/migrate/20121202111750_create_posts.rb
342
+ - test/dummy_without_community/db/migrate/20121202112556_create_users.rb
343
+ - test/dummy_without_community/db/migrate/20130120124010_create_inkwell_timeline_items.rb
344
+ - test/dummy_without_community/db/migrate/20130120124011_add_columns_to_posts.rb
345
+ - test/dummy_without_community/db/migrate/20130120124012_create_inkwell_blog_items.rb
346
+ - test/dummy_without_community/db/migrate/20130120124013_create_inkwell_favorite_items.rb
347
+ - test/dummy_without_community/db/migrate/20130120124014_add_columns_to_users.rb
348
+ - test/dummy_without_community/db/migrate/20130120124015_create_inkwell_comments.rb
349
+ - test/dummy_without_community/db/schema.rb
350
+ - test/dummy_without_community/db/seeds.rb
351
+ - test/dummy_without_community/public/404.html
352
+ - test/dummy_without_community/public/422.html
353
+ - test/dummy_without_community/public/500.html
354
+ - test/dummy_without_community/public/favicon.ico
355
+ - test/dummy_without_community/Rakefile
356
+ - test/dummy_without_community/script/rails
357
+ - test/dummy_without_community/spec/functional/blogline_spec.rb
358
+ - test/dummy_without_community/spec/functional/comments_spec.rb
359
+ - test/dummy_without_community/spec/functional/favorite_spec.rb
360
+ - test/dummy_without_community/spec/functional/following_spec.rb
361
+ - test/dummy_without_community/spec/functional/reblog_spec.rb
362
+ - test/dummy_without_community/spec/functional/timeline_spec.rb
363
+ - test/dummy_without_community/spec/spec_helper.rb