timeful 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/app/models/timeful/activity.rb +4 -4
- data/db/migrate/20160928114427_rename_object_to_target_in_activities.rb +6 -0
- data/lib/timeful/model/actor.rb +4 -4
- data/lib/timeful/version.rb +1 -1
- data/spec/dummy/db/migrate/20160928114457_rename_object_to_target_in_activities.timeful.rb +7 -0
- data/spec/dummy/db/schema.rb +4 -4
- data/spec/dummy/log/development.log +70 -0
- data/spec/dummy/log/test.log +180 -0
- data/spec/examples.txt +10 -10
- data/spec/factories/timeful/activities.rb +1 -1
- data/spec/timeful/model/actor_spec.rb +2 -2
- data/spec/timeful/relation_proxy_spec.rb +7 -7
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e68198dc675d58a7bf9c9fff272d3eb0b6a7670
|
4
|
+
data.tar.gz: 29213ad0187262a0ccd839c71bcb7b23fdc4ef62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb31c2e9c51d929afcf1e652ed8c13daef738941fe307acca90f190b44e87c27eaf4a093d7f7d6f7ffc57bd850e8f30c7629ee5bb1856808d7f125f843e559ee
|
7
|
+
data.tar.gz: b5ccba267919bb207acd5fa7b6d33102e58c4c831cc69adeca920c4ec85e389b9accd52fec54597436f28c9f29532e18e1dd53fae12e0c775a6624a0fec2f8c4
|
data/README.md
CHANGED
@@ -65,8 +65,8 @@ end
|
|
65
65
|
|
66
66
|
Timeful revolves around three core concepts:
|
67
67
|
|
68
|
-
- **Activity**: An _action_ taken by an _actor_ on an
|
69
|
-
activities. An example would be "John Doe (actor) wrote (action) a comment (
|
68
|
+
- **Activity**: An _action_ taken by an _actor_ on an _target_. _Metadata_ can also be attached to
|
69
|
+
activities. An example would be "John Doe (actor) wrote (action) a comment (target)."
|
70
70
|
- **Feed**: A collection of activities that should be accessible by a specific user.
|
71
71
|
- **Feed item**: The instance of an activity in a user's feed.
|
72
72
|
|
@@ -81,7 +81,7 @@ Here's an example activity:
|
|
81
81
|
```ruby
|
82
82
|
class CommentActivity < Timeful::Activity
|
83
83
|
def subscribers
|
84
|
-
[
|
84
|
+
[target.post.author]
|
85
85
|
end
|
86
86
|
end
|
87
87
|
```
|
@@ -89,7 +89,7 @@ end
|
|
89
89
|
Now, you can publish the `comment` activity:
|
90
90
|
|
91
91
|
```ruby
|
92
|
-
user.publish_activity :comment,
|
92
|
+
user.publish_activity :comment, target: comment
|
93
93
|
```
|
94
94
|
|
95
95
|
This will create an `Activity` and link it to the author's feed through a `FeedItem`:
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Timeful
|
3
3
|
# An activity is something that happens in your application. It's comprised of an actor, an
|
4
|
-
# action and an
|
4
|
+
# action and an target.
|
5
5
|
#
|
6
|
-
# An example activity might be: "John Doe (actor) published (action) a new post (
|
6
|
+
# An example activity might be: "John Doe (actor) published (action) a new post (target)."
|
7
7
|
#
|
8
8
|
# @author Alessandro Desantis
|
9
9
|
#
|
@@ -12,12 +12,12 @@ module Timeful
|
|
12
12
|
# @example
|
13
13
|
# class CommentCreatedActivity < Timeful::Activity
|
14
14
|
# def subscribers
|
15
|
-
# [
|
15
|
+
# [target.post.author]
|
16
16
|
# end
|
17
17
|
# end
|
18
18
|
class Activity < ApplicationRecord
|
19
19
|
belongs_to :actor, polymorphic: true
|
20
|
-
belongs_to :
|
20
|
+
belongs_to :target, polymorphic: true
|
21
21
|
|
22
22
|
# Returns the users that subscribe to this activity. A {FeedItem} linked to the activity will
|
23
23
|
# be created for these users.
|
data/lib/timeful/model/actor.rb
CHANGED
@@ -13,14 +13,14 @@ module Timeful
|
|
13
13
|
# Publishes an activity and creates a feed item for each subscriber.
|
14
14
|
#
|
15
15
|
# @param action [Symbol] the action (or activity type) to create
|
16
|
-
# @param
|
16
|
+
# @param target [ActiveRecord::Base] the target the action was taken upon
|
17
17
|
#
|
18
18
|
# @return [Activity] the created activity
|
19
19
|
#
|
20
20
|
# @example
|
21
|
-
# actor.publish_activity :post_created,
|
22
|
-
def publish_activity(action,
|
23
|
-
activity = activity_klass(action).create!
|
21
|
+
# actor.publish_activity :post_created, target: post # => #<PostCreatedActivity>
|
22
|
+
def publish_activity(action, target:)
|
23
|
+
activity = activity_klass(action).create! target: target, actor: self
|
24
24
|
DeliverActivityToSubscribersJob.perform_later activity
|
25
25
|
end
|
26
26
|
|
data/lib/timeful/version.rb
CHANGED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This migration comes from timeful (originally 20160928114427)
|
2
|
+
class RenameObjectToTargetInActivities < ActiveRecord::Migration[5.0]
|
3
|
+
def change
|
4
|
+
rename_column :timeful_activities, :object_id, :target_id
|
5
|
+
rename_column :timeful_activities, :object_type, :target_type
|
6
|
+
end
|
7
|
+
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20160928114457) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
@@ -22,14 +22,14 @@ ActiveRecord::Schema.define(version: 20160928113645) do
|
|
22
22
|
|
23
23
|
create_table "timeful_activities", force: :cascade do |t|
|
24
24
|
t.string "type", null: false
|
25
|
-
t.string "
|
26
|
-
t.string "
|
25
|
+
t.string "target_type", null: false
|
26
|
+
t.string "target_id", null: false
|
27
27
|
t.string "actor_type", null: false
|
28
28
|
t.string "actor_id", null: false
|
29
29
|
t.datetime "created_at", null: false
|
30
30
|
t.datetime "updated_at", null: false
|
31
31
|
t.index ["actor_type", "actor_id"], name: "index_timeful_activities_on_actor_type_and_actor_id", using: :btree
|
32
|
-
t.index ["
|
32
|
+
t.index ["target_type", "target_id"], name: "index_timeful_activities_on_target_type_and_target_id", using: :btree
|
33
33
|
end
|
34
34
|
|
35
35
|
create_table "timeful_feed_items", force: :cascade do |t|
|
@@ -496,4 +496,74 @@ WHERE c.contype = 'f'
|
|
496
496
|
AND t1.relname = 'users'
|
497
497
|
AND t3.nspname = ANY (current_schemas(false))
|
498
498
|
ORDER BY c.conname
|
499
|
+
[0m
|
500
|
+
[1m[35m (0.5ms)[0m [1m[34mSELECT pg_try_advisory_lock(339456620476877820);[0m
|
501
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
502
|
+
Migrating to RenameObjectToTargetInActivities (20160928114457)
|
503
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
504
|
+
[1m[35m (0.6ms)[0m [1m[35mALTER TABLE "activities" RENAME COLUMN "object_id" TO "target_id"[0m
|
505
|
+
[1m[35m (0.2ms)[0m [1m[31mROLLBACK[0m
|
506
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT pg_advisory_unlock(339456620476877820)[0m
|
507
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT pg_try_advisory_lock(339456620476877820);[0m
|
508
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
509
|
+
Migrating to RenameObjectToTargetInActivities (20160928114457)
|
510
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
511
|
+
[1m[35m (0.3ms)[0m [1m[35mALTER TABLE "timeful_activities" RENAME COLUMN "object_id" TO "target_id"[0m
|
512
|
+
[1m[35m (0.2ms)[0m [1m[35mALTER INDEX "index_timeful_activities_on_object_type_and_object_id" RENAME TO "index_timeful_activities_on_object_type_and_target_id"[0m
|
513
|
+
[1m[35m (0.3ms)[0m [1m[35mALTER TABLE "timeful_activities" RENAME COLUMN "object_type" TO "target_type"[0m
|
514
|
+
[1m[35m (0.2ms)[0m [1m[35mALTER INDEX "index_timeful_activities_on_object_type_and_target_id" RENAME TO "index_timeful_activities_on_target_type_and_target_id"[0m
|
515
|
+
[1m[35mSQL (0.6ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"[0m [["version", "20160928114457"]]
|
516
|
+
[1m[35m (2.6ms)[0m [1m[35mCOMMIT[0m
|
517
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.5ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", :environment], ["LIMIT", 1]]
|
518
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
519
|
+
[1m[35m (0.2ms)[0m [1m[35mCOMMIT[0m
|
520
|
+
[1m[35m (0.3ms)[0m [1m[34mSELECT pg_advisory_unlock(339456620476877820)[0m
|
521
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
522
|
+
[1m[35m (2.0ms)[0m [1m[34mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
523
|
+
FROM pg_constraint c
|
524
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
525
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
526
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
527
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
528
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
529
|
+
WHERE c.contype = 'f'
|
530
|
+
AND t1.relname = 'posts'
|
531
|
+
AND t3.nspname = ANY (current_schemas(false))
|
532
|
+
ORDER BY c.conname
|
533
|
+
[0m
|
534
|
+
[1m[35m (1.8ms)[0m [1m[34mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
535
|
+
FROM pg_constraint c
|
536
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
537
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
538
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
539
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
540
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
541
|
+
WHERE c.contype = 'f'
|
542
|
+
AND t1.relname = 'timeful_activities'
|
543
|
+
AND t3.nspname = ANY (current_schemas(false))
|
544
|
+
ORDER BY c.conname
|
545
|
+
[0m
|
546
|
+
[1m[35m (1.8ms)[0m [1m[34mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
547
|
+
FROM pg_constraint c
|
548
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
549
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
550
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
551
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
552
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
553
|
+
WHERE c.contype = 'f'
|
554
|
+
AND t1.relname = 'timeful_feed_items'
|
555
|
+
AND t3.nspname = ANY (current_schemas(false))
|
556
|
+
ORDER BY c.conname
|
557
|
+
[0m
|
558
|
+
[1m[35m (1.8ms)[0m [1m[34mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
559
|
+
FROM pg_constraint c
|
560
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
561
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
562
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
563
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
564
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
565
|
+
WHERE c.contype = 'f'
|
566
|
+
AND t1.relname = 'users'
|
567
|
+
AND t3.nspname = ANY (current_schemas(false))
|
568
|
+
ORDER BY c.conname
|
499
569
|
[0m
|
data/spec/dummy/log/test.log
CHANGED
@@ -4267,3 +4267,183 @@ FOREIGN KEY ("activity_id")
|
|
4267
4267
|
[1m[35m (0.6ms)[0m [1m[35mBEGIN[0m
|
4268
4268
|
[1m[35m (0.9ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4269
4269
|
[1m[35m (3.6ms)[0m [1m[35mCOMMIT[0m
|
4270
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4271
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4272
|
+
[1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", :environment]]
|
4273
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4274
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", :environment], ["LIMIT", 1]]
|
4275
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
4276
|
+
[1m[35mSQL (0.7ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "test"], ["created_at", 2016-09-28 11:48:06 UTC], ["updated_at", 2016-09-28 11:48:06 UTC]]
|
4277
|
+
[1m[35m (2.4ms)[0m [1m[35mCOMMIT[0m
|
4278
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.7ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4279
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4280
|
+
[1m[35m (0.4ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", :environment]]
|
4281
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4282
|
+
[1m[35m (0.3ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", :environment]]
|
4283
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4284
|
+
[1m[35m (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1[0m [["key", :environment]]
|
4285
|
+
[1m[35m (118.8ms)[0m [1m[35mDROP DATABASE IF EXISTS "timeful_test"[0m
|
4286
|
+
[1m[35m (359.6ms)[0m [1m[35mCREATE DATABASE "timeful_test" ENCODING = 'utf8'[0m
|
4287
|
+
[1m[35mSQL (0.3ms)[0m [1m[35mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
4288
|
+
[1m[35m (7.3ms)[0m [1m[35mCREATE TABLE "posts" ("id" serial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
4289
|
+
[1m[35m (7.4ms)[0m [1m[35mCREATE TABLE "timeful_activities" ("id" serial primary key, "type" character varying NOT NULL, "target_type" character varying NOT NULL, "target_id" character varying NOT NULL, "actor_type" character varying NOT NULL, "actor_id" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
4290
|
+
[1m[35m (3.5ms)[0m [1m[35mCREATE INDEX "index_timeful_activities_on_actor_type_and_actor_id" ON "timeful_activities" USING btree ("actor_type", "actor_id")[0m
|
4291
|
+
[1m[35m (3.3ms)[0m [1m[35mCREATE INDEX "index_timeful_activities_on_target_type_and_target_id" ON "timeful_activities" USING btree ("target_type", "target_id")[0m
|
4292
|
+
[1m[35m (6.4ms)[0m [1m[35mCREATE TABLE "timeful_feed_items" ("id" serial primary key, "subscriber_type" character varying NOT NULL, "subscriber_id" character varying NOT NULL, "activity_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
4293
|
+
[1m[35m (3.6ms)[0m [1m[35mCREATE INDEX "index_timeful_feed_items_on_subscriber_type_and_subscriber_id" ON "timeful_feed_items" USING btree ("subscriber_type", "subscriber_id")[0m
|
4294
|
+
[1m[35m (4.4ms)[0m [1m[35mCREATE TABLE "users" ("id" serial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
4295
|
+
[1m[35m (2.9ms)[0m [1m[35mALTER TABLE "timeful_feed_items" ADD CONSTRAINT "fk_rails_9bc442415c"
|
4296
|
+
FOREIGN KEY ("activity_id")
|
4297
|
+
REFERENCES "timeful_activities" ("id")
|
4298
|
+
ON DELETE CASCADE[0m
|
4299
|
+
[1m[35m (5.9ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" character varying PRIMARY KEY)[0m
|
4300
|
+
[1m[35m (0.6ms)[0m [1m[34mSELECT version FROM "schema_migrations"[0m
|
4301
|
+
[1m[35m (1.3ms)[0m [1m[32mINSERT INTO "schema_migrations" (version) VALUES ('20160928114457')[0m
|
4302
|
+
[1m[35m (1.2ms)[0m [1m[32mINSERT INTO schema_migrations (version) VALUES ('20160927160031'), ('20160928113645'), ('20160928104634'), ('20160927141815'), ('20160927155215'), ('20160927160026');
|
4303
|
+
|
4304
|
+
[0m
|
4305
|
+
[1m[35m (6.6ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)[0m
|
4306
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.7ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", :environment], ["LIMIT", 1]]
|
4307
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
4308
|
+
[1m[35mSQL (0.7ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"[0m [["key", "environment"], ["value", "test"], ["created_at", 2016-09-28 11:48:12 UTC], ["updated_at", 2016-09-28 11:48:12 UTC]]
|
4309
|
+
[1m[35m (1.3ms)[0m [1m[35mCOMMIT[0m
|
4310
|
+
[1m[36mActiveRecord::InternalMetadata Load (0.5ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m [["key", :environment], ["LIMIT", 1]]
|
4311
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
4312
|
+
[1m[35m (0.3ms)[0m [1m[35mCOMMIT[0m
|
4313
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.8ms)[0m [1m[34mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4314
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4315
|
+
[1m[35m (0.8ms)[0m [1m[35mALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4316
|
+
[1m[35m (5.1ms)[0m [1m[35mCOMMIT[0m
|
4317
|
+
[1m[35m (3.0ms)[0m [1m[34m SELECT schemaname || '.' || tablename
|
4318
|
+
FROM pg_tables
|
4319
|
+
WHERE
|
4320
|
+
tablename !~ '_prt_' AND
|
4321
|
+
tablename <> 'schema_migrations' AND
|
4322
|
+
schemaname = ANY (current_schemas(false))
|
4323
|
+
[0m
|
4324
|
+
[1m[35m (1.8ms)[0m [1m[34mselect table_name from information_schema.views where table_schema = 'timeful_test'[0m
|
4325
|
+
[1m[35m (24.5ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4326
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4327
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4328
|
+
[1m[35m (0.9ms)[0m [1m[35mCOMMIT[0m
|
4329
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4330
|
+
[1m[35m (0.6ms)[0m [1m[35mALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4331
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4332
|
+
[1m[35m (19.0ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4333
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4334
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4335
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4336
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4337
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4338
|
+
[1m[35m (0.9ms)[0m [1m[35mCOMMIT[0m
|
4339
|
+
[1m[35m (20.7ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4340
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4341
|
+
[1m[35m (1.0ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4342
|
+
[1m[35m (1.1ms)[0m [1m[35mCOMMIT[0m
|
4343
|
+
[ActiveJob] [Timeful::DeliverActivityToSubscribersJob] [528c147b-fc35-4d57-910c-8d1b1279d621] Performing Timeful::DeliverActivityToSubscribersJob from Test(default) with arguments: #<GlobalID:0x00000003a95378 @uri=#<URI::GID gid://dummy/Timeful::Activity/1003>>
|
4344
|
+
[ActiveJob] [Timeful::DeliverActivityToSubscribersJob] [528c147b-fc35-4d57-910c-8d1b1279d621] Performed Timeful::DeliverActivityToSubscribersJob from Test(default) in 0.45ms
|
4345
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4346
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4347
|
+
[1m[35m (2.1ms)[0m [1m[35mCOMMIT[0m
|
4348
|
+
[1m[35m (19.8ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4349
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4350
|
+
[1m[35m (0.6ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4351
|
+
[1m[35m (1.1ms)[0m [1m[35mCOMMIT[0m
|
4352
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4353
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4354
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4355
|
+
[1m[35m (19.5ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4356
|
+
[1m[35m (0.6ms)[0m [1m[35mBEGIN[0m
|
4357
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4358
|
+
[1m[35m (10.0ms)[0m [1m[35mCOMMIT[0m
|
4359
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
4360
|
+
[1m[35m (0.6ms)[0m [1m[35mALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4361
|
+
[1m[35m (1.2ms)[0m [1m[35mCOMMIT[0m
|
4362
|
+
[1m[35m (34.5ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4363
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
4364
|
+
[1m[35m (0.6ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4365
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4366
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4367
|
+
[1m[35mSQL (0.9ms)[0m [1m[32mINSERT INTO "users" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4368
|
+
[1m[35m (1.1ms)[0m [1m[35mCOMMIT[0m
|
4369
|
+
[1m[35m (0.8ms)[0m [1m[35mBEGIN[0m
|
4370
|
+
[1m[35mSQL (4.8ms)[0m [1m[32mINSERT INTO "users" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4371
|
+
[1m[35mSQL (1.6ms)[0m [1m[32mINSERT INTO "posts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4372
|
+
[1m[35mSQL (0.8ms)[0m [1m[32mINSERT INTO "timeful_activities" ("type", "target_type", "target_id", "actor_type", "actor_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"[0m [["type", "PostActivity"], ["target_type", "Post"], ["target_id", "1"], ["actor_type", "User"], ["actor_id", "2"], ["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4373
|
+
[1m[35mSQL (1.1ms)[0m [1m[32mINSERT INTO "timeful_feed_items" ("subscriber_type", "subscriber_id", "activity_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["subscriber_type", "User"], ["subscriber_id", "1"], ["activity_id", 1], ["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4374
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4375
|
+
[1m[36mTimeful::FeedItem Load (0.5ms)[0m [1m[34mSELECT "timeful_feed_items".* FROM "timeful_feed_items" WHERE "timeful_feed_items"."subscriber_id" = $1 AND "timeful_feed_items"."subscriber_type" = $2 ORDER BY "timeful_feed_items"."created_at" DESC[0m [["subscriber_id", "1"], ["subscriber_type", "User"]]
|
4376
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4377
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4378
|
+
[1m[35m (1.1ms)[0m [1m[35mCOMMIT[0m
|
4379
|
+
[1m[35m (20.5ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4380
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4381
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4382
|
+
[1m[35m (0.8ms)[0m [1m[35mCOMMIT[0m
|
4383
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4384
|
+
[1m[35mSQL (0.5ms)[0m [1m[32mINSERT INTO "users" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4385
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4386
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4387
|
+
[1m[35mSQL (0.4ms)[0m [1m[32mINSERT INTO "users" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4388
|
+
[1m[35mSQL (0.6ms)[0m [1m[32mINSERT INTO "posts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4389
|
+
[1m[35mSQL (0.9ms)[0m [1m[32mINSERT INTO "timeful_activities" ("type", "target_type", "target_id", "actor_type", "actor_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"[0m [["type", "PostActivity"], ["target_type", "Post"], ["target_id", "1"], ["actor_type", "User"], ["actor_id", "2"], ["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4390
|
+
[1m[35mSQL (0.9ms)[0m [1m[32mINSERT INTO "timeful_feed_items" ("subscriber_type", "subscriber_id", "activity_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["subscriber_type", "User"], ["subscriber_id", "1"], ["activity_id", 1], ["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4391
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4392
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4393
|
+
[1m[35mSQL (0.4ms)[0m [1m[32mINSERT INTO "users" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4394
|
+
[1m[35mSQL (0.5ms)[0m [1m[32mINSERT INTO "posts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4395
|
+
[1m[35mSQL (0.4ms)[0m [1m[32mINSERT INTO "timeful_activities" ("type", "target_type", "target_id", "actor_type", "actor_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"[0m [["type", "PostActivity"], ["target_type", "Post"], ["target_id", "2"], ["actor_type", "User"], ["actor_id", "3"], ["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4396
|
+
[1m[35mSQL (0.5ms)[0m [1m[32mINSERT INTO "timeful_feed_items" ("subscriber_type", "subscriber_id", "activity_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["subscriber_type", "User"], ["subscriber_id", "1"], ["activity_id", 2], ["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4397
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4398
|
+
[1m[36mTimeful::FeedItem Load (1.3ms)[0m [1m[34mSELECT "timeful_feed_items".* FROM "timeful_feed_items" WHERE "timeful_feed_items"."subscriber_id" = $1 AND "timeful_feed_items"."subscriber_type" = $2 ORDER BY "timeful_feed_items"."created_at" DESC[0m [["subscriber_id", "1"], ["subscriber_type", "User"]]
|
4399
|
+
[1m[35m (1.9ms)[0m [1m[35mBEGIN[0m
|
4400
|
+
[1m[35m (3.2ms)[0m [1m[35mALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4401
|
+
[1m[35m (1.1ms)[0m [1m[35mCOMMIT[0m
|
4402
|
+
[1m[35m (24.1ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4403
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4404
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4405
|
+
[1m[35m (0.9ms)[0m [1m[35mCOMMIT[0m
|
4406
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4407
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4408
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4409
|
+
[1m[35m (20.3ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4410
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4411
|
+
[1m[35m (0.9ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4412
|
+
[1m[35m (6.6ms)[0m [1m[35mCOMMIT[0m
|
4413
|
+
[1m[35m (1.4ms)[0m [1m[34mSELECT COUNT(*) FROM "timeful_activities" WHERE "timeful_activities"."type" IN ('PostActivity')[0m
|
4414
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4415
|
+
[1m[35mSQL (0.6ms)[0m [1m[32mINSERT INTO "users" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4416
|
+
[1m[35m (1.1ms)[0m [1m[35mCOMMIT[0m
|
4417
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
4418
|
+
[1m[35mSQL (0.6ms)[0m [1m[32mINSERT INTO "posts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4419
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4420
|
+
[1m[35m (0.9ms)[0m [1m[35mBEGIN[0m
|
4421
|
+
[1m[35mSQL (0.8ms)[0m [1m[32mINSERT INTO "timeful_activities" ("type", "target_type", "target_id", "actor_type", "actor_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"[0m [["type", "PostActivity"], ["target_type", "Post"], ["target_id", "1"], ["actor_type", "User"], ["actor_id", "1"], ["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4422
|
+
[1m[35m (2.6ms)[0m [1m[35mCOMMIT[0m
|
4423
|
+
[ActiveJob] Enqueued Timeful::DeliverActivityToSubscribersJob (Job ID: 12a3117f-a187-40ef-9efa-01a9f2e7d2a8) to Test(timeful) with arguments: #<GlobalID:0x00000003aec6f0 @uri=#<URI::GID gid://dummy/PostActivity/1>>
|
4424
|
+
[1m[35m (2.6ms)[0m [1m[34mSELECT COUNT(*) FROM "timeful_activities" WHERE "timeful_activities"."type" IN ('PostActivity')[0m
|
4425
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
4426
|
+
[1m[35m (1.2ms)[0m [1m[35mALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4427
|
+
[1m[35m (3.1ms)[0m [1m[35mCOMMIT[0m
|
4428
|
+
[1m[35m (24.4ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4429
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4430
|
+
[1m[35m (0.5ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4431
|
+
[1m[35m (0.9ms)[0m [1m[35mCOMMIT[0m
|
4432
|
+
[1m[35m (0.2ms)[0m [1m[35mBEGIN[0m
|
4433
|
+
[1m[35mSQL (0.6ms)[0m [1m[32mINSERT INTO "users" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4434
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4435
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4436
|
+
[1m[35mSQL (0.8ms)[0m [1m[32mINSERT INTO "posts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"[0m [["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4437
|
+
[1m[35m (1.1ms)[0m [1m[35mCOMMIT[0m
|
4438
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4439
|
+
[1m[35mSQL (0.8ms)[0m [1m[32mINSERT INTO "timeful_activities" ("type", "target_type", "target_id", "actor_type", "actor_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"[0m [["type", "PostActivity"], ["target_type", "Post"], ["target_id", "1"], ["actor_type", "User"], ["actor_id", "1"], ["created_at", 2016-09-28 11:48:13 UTC], ["updated_at", 2016-09-28 11:48:13 UTC]]
|
4440
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4441
|
+
[ActiveJob] Enqueued Timeful::DeliverActivityToSubscribersJob (Job ID: 96eef781-0577-413d-8d0a-012a9baf7f0f) to Test(timeful) with arguments: #<GlobalID:0x00000003a61690 @uri=#<URI::GID gid://dummy/PostActivity/1>>
|
4442
|
+
[1m[36mPostActivity Load (0.6ms)[0m [1m[34mSELECT "timeful_activities".* FROM "timeful_activities" WHERE "timeful_activities"."type" IN ('PostActivity') AND "timeful_activities"."id" = $1 LIMIT $2[0m [["id", 1], ["LIMIT", 1]]
|
4443
|
+
[1m[35m (0.3ms)[0m [1m[35mBEGIN[0m
|
4444
|
+
[1m[35m (0.6ms)[0m [1m[35mALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "posts" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "timeful_activities" DISABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" DISABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" DISABLE TRIGGER ALL[0m
|
4445
|
+
[1m[35m (1.0ms)[0m [1m[35mCOMMIT[0m
|
4446
|
+
[1m[35m (33.9ms)[0m [1m[35mTRUNCATE TABLE "public"."posts", "public"."users", "public"."timeful_activities", "public"."timeful_feed_items", "public"."ar_internal_metadata" RESTART IDENTITY CASCADE;[0m
|
4447
|
+
[1m[35m (0.4ms)[0m [1m[35mBEGIN[0m
|
4448
|
+
[1m[35m (0.8ms)[0m [1m[35mALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "posts" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "timeful_activities" ENABLE TRIGGER ALL;ALTER TABLE "timeful_feed_items" ENABLE TRIGGER ALL;ALTER TABLE "ar_internal_metadata" ENABLE TRIGGER ALL[0m
|
4449
|
+
[1m[35m (0.9ms)[0m [1m[35mCOMMIT[0m
|
data/spec/examples.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
-------------------------------------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/jobs/timeful/deliver_activity_to_subscribers_job_spec.rb[1:1] | passed | 0.
|
4
|
-
./spec/models/timeful/activity_spec.rb[1:1] | passed | 0.
|
5
|
-
./spec/models/timeful/feed_item_spec.rb[1:1] | passed | 0.
|
6
|
-
./spec/timeful/model/actor_spec.rb[1:1:1] | passed | 0.
|
7
|
-
./spec/timeful/model/actor_spec.rb[1:1:2] | passed | 0.
|
8
|
-
./spec/timeful/model/subscriber_spec.rb[1:1:1] | passed | 0.
|
9
|
-
./spec/timeful/model/subscriber_spec.rb[1:1:2] | passed | 0.
|
10
|
-
./spec/timeful/relation_proxy_spec.rb[1:1:1:1] | passed | 0.
|
11
|
-
./spec/timeful/relation_proxy_spec.rb[1:1:2:1] | passed | 0.
|
12
|
-
./spec/timeful/timeful_spec.rb[1:1:1] | passed | 0.
|
3
|
+
./spec/jobs/timeful/deliver_activity_to_subscribers_job_spec.rb[1:1] | passed | 0.11858 seconds |
|
4
|
+
./spec/models/timeful/activity_spec.rb[1:1] | passed | 0.03826 seconds |
|
5
|
+
./spec/models/timeful/feed_item_spec.rb[1:1] | passed | 0.03574 seconds |
|
6
|
+
./spec/timeful/model/actor_spec.rb[1:1:1] | passed | 0.06665 seconds |
|
7
|
+
./spec/timeful/model/actor_spec.rb[1:1:2] | passed | 0.06035 seconds |
|
8
|
+
./spec/timeful/model/subscriber_spec.rb[1:1:1] | passed | 0.07969 seconds |
|
9
|
+
./spec/timeful/model/subscriber_spec.rb[1:1:2] | passed | 0.0681 seconds |
|
10
|
+
./spec/timeful/relation_proxy_spec.rb[1:1:1:1] | passed | 0.02877 seconds |
|
11
|
+
./spec/timeful/relation_proxy_spec.rb[1:1:2:1] | passed | 0.02981 seconds |
|
12
|
+
./spec/timeful/timeful_spec.rb[1:1:1] | passed | 0.04947 seconds |
|
@@ -3,6 +3,6 @@ FactoryGirl.define do
|
|
3
3
|
factory :activity, class: 'Timeful::Activity' do
|
4
4
|
type 'PostActivity'
|
5
5
|
association :actor, strategy: :build, factory: :user
|
6
|
-
association :
|
6
|
+
association :target, strategy: :build, factory: :post
|
7
7
|
end
|
8
8
|
end
|
@@ -7,13 +7,13 @@ RSpec.describe Timeful::Model::Actor do
|
|
7
7
|
describe '#publish_activity' do
|
8
8
|
it 'creates a new activity' do
|
9
9
|
expect {
|
10
|
-
subject.publish_activity :post,
|
10
|
+
subject.publish_activity :post, target: post
|
11
11
|
}.to change(PostActivity, :count).by(1)
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'creates a feed item for subscribers' do
|
15
15
|
expect {
|
16
|
-
subject.publish_activity :post,
|
16
|
+
subject.publish_activity :post, target: post
|
17
17
|
}.to enqueue_job(Timeful::DeliverActivityToSubscribersJob)
|
18
18
|
end
|
19
19
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
RSpec.describe Timeful::RelationProxy do
|
3
|
-
subject { described_class.new(
|
3
|
+
subject { described_class.new(target) }
|
4
4
|
|
5
5
|
describe '#find_each' do
|
6
|
-
context 'when the
|
7
|
-
let(:
|
6
|
+
context 'when the target responds to #find_each' do
|
7
|
+
let(:target) do
|
8
8
|
Class.new do
|
9
9
|
def find_each
|
10
10
|
yield 1
|
@@ -12,13 +12,13 @@ RSpec.describe Timeful::RelationProxy do
|
|
12
12
|
end.new
|
13
13
|
end
|
14
14
|
|
15
|
-
it 'calls #find_each on the
|
15
|
+
it 'calls #find_each on the target' do
|
16
16
|
expect { |block| subject.find_each(&block) }.to yield_with_args(1)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
context 'when the
|
21
|
-
let(:
|
20
|
+
context 'when the target does not respond to #find_each' do
|
21
|
+
let(:target) do
|
22
22
|
Class.new do
|
23
23
|
def each
|
24
24
|
yield 1
|
@@ -26,7 +26,7 @@ RSpec.describe Timeful::RelationProxy do
|
|
26
26
|
end.new
|
27
27
|
end
|
28
28
|
|
29
|
-
it 'calls #each on the
|
29
|
+
it 'calls #each on the target' do
|
30
30
|
expect { |block| subject.find_each(&block) }.to yield_with_args(1)
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Desantis
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- db/migrate/20160927154912_create_timeful_feed_items.rb
|
176
176
|
- db/migrate/20160928104602_rename_feedable_to_subscriber_in_feed_items.rb
|
177
177
|
- db/migrate/20160928113515_change_foreign_ids_to_string.rb
|
178
|
+
- db/migrate/20160928114427_rename_object_to_target_in_activities.rb
|
178
179
|
- lib/generators/timeful/install_generator.rb
|
179
180
|
- lib/timeful.rb
|
180
181
|
- lib/timeful/engine.rb
|
@@ -223,6 +224,7 @@ files:
|
|
223
224
|
- spec/dummy/db/migrate/20160927160031_create_posts.rb
|
224
225
|
- spec/dummy/db/migrate/20160928104634_rename_feedable_to_subscriber_in_feed_items.timeful.rb
|
225
226
|
- spec/dummy/db/migrate/20160928113645_change_foreign_ids_to_string.timeful.rb
|
227
|
+
- spec/dummy/db/migrate/20160928114457_rename_object_to_target_in_activities.timeful.rb
|
226
228
|
- spec/dummy/db/schema.rb
|
227
229
|
- spec/dummy/log/development.log
|
228
230
|
- spec/dummy/log/test.log
|
@@ -296,6 +298,7 @@ test_files:
|
|
296
298
|
- spec/dummy/db/migrate/20160927160031_create_posts.rb
|
297
299
|
- spec/dummy/db/migrate/20160928113645_change_foreign_ids_to_string.timeful.rb
|
298
300
|
- spec/dummy/db/migrate/20160928104634_rename_feedable_to_subscriber_in_feed_items.timeful.rb
|
301
|
+
- spec/dummy/db/migrate/20160928114457_rename_object_to_target_in_activities.timeful.rb
|
299
302
|
- spec/dummy/db/migrate/20160927141815_create_timeful_activities.timeful.rb
|
300
303
|
- spec/dummy/db/migrate/20160927155215_create_timeful_feed_items.timeful.rb
|
301
304
|
- spec/dummy/db/migrate/20160927160026_create_users.rb
|