we_bridge_rails_engine_orgs 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/models/org_member.rb +1 -1
- data/lib/we_bridge_rails_engine_orgs/version.rb +1 -1
- data/spec/dummy/log/test.log +35 -0
- data/spec/models/org_member_spec.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb35709684f5ec87c992adc48f770df73f9134ce
|
4
|
+
data.tar.gz: 8960cfd168c44207dc5a9546d697ec38e405ff4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3507084bffa0e03517c01ef9aefad93e869545853978e1cfc0e0f77470a99f0e8ba0a48ec20aebbef303270a9cfd826478b9d171de3786c893dfa6860c493ba6
|
7
|
+
data.tar.gz: b36bf6df0eb6dfec57e02600a005d167ec51867a88de6d47760cfe107b724091cf3ba4a549ecab3cc8cc0d2519a61fd4e1b2dae52fb2b31602b7c27f6301dde9
|
data/Gemfile.lock
CHANGED
data/app/models/org_member.rb
CHANGED
@@ -25,7 +25,7 @@ class OrgMember < ActiveRecord::Base
|
|
25
25
|
set_input_options :sex, min: -1, max: 1
|
26
26
|
|
27
27
|
default_scope ->(){ where(retired_on: nil) }
|
28
|
-
scope :without_secret, ->(){ where(
|
28
|
+
scope :without_secret, ->(){ where(private: false) }
|
29
29
|
|
30
30
|
def others
|
31
31
|
self.class.where(org_id: self.org_id).where.not(id: self.id)
|
data/spec/dummy/log/test.log
CHANGED
@@ -5432,3 +5432,38 @@ Completed 200 OK in 38ms (Views: 24.8ms | ActiveRecord: 0.8ms)
|
|
5432
5432
|
[1m[35m (0.0ms)[0m SELECT MIN("org_director_types"."position") FROM "org_director_types" WHERE "org_director_types"."org_id" = ? [["org_id", 1]]
|
5433
5433
|
[1m[36mOrgMember Load (0.1ms)[0m [1mSELECT DISTINCT "org_members".* FROM "org_members" INNER JOIN "org_director_types" "org_director_types_org_members" ON "org_director_types_org_members"."id" = "org_members"."org_director_type_id" INNER JOIN "org_director_types" ON "org_members"."org_director_type_id" = "org_director_types"."id" WHERE "org_members"."retired_on" IS NULL AND "org_director_types"."org_id" = ? AND "org_director_types"."position" = 0 ORDER BY "org_members"."id" ASC LIMIT 1[0m [["org_id", 1]]
|
5434
5434
|
[1m[35m (0.8ms)[0m rollback transaction
|
5435
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
5436
|
+
[1m[35m (0.1ms)[0m begin transaction
|
5437
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
5438
|
+
[1m[35mSQL (1.4ms)[0m INSERT INTO "orgs" ("lang_id", "created_at", "updated_at") VALUES (?, ?, ?) [["lang_id", 1], ["created_at", "2015-12-16 16:06:30.100442"], ["updated_at", "2015-12-16 16:06:30.100442"]]
|
5439
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5440
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
5441
|
+
[1m[36mSQL (0.9ms)[0m [1mINSERT INTO "org_members" ("org_id", "entried_on", "retired_on", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["org_id", 1], ["entried_on", "2015-12-17"], ["retired_on", "2015-12-17"], ["created_at", "2015-12-16 16:06:30.130039"], ["updated_at", "2015-12-16 16:06:30.130039"]]
|
5442
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
5443
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
5444
|
+
[1m[35mSQL (0.2ms)[0m UPDATE "org_members" SET "retired_on" = ?, "updated_at" = ? WHERE "org_members"."id" = ? [["retired_on", nil], ["updated_at", "2015-12-16 16:06:30.133913"], ["id", 1]]
|
5445
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5446
|
+
[1m[35mOrgMember Load (0.2ms)[0m SELECT "org_members".* FROM "org_members" WHERE "org_members"."retired_on" IS NULL AND "org_members"."org_id" = ? ORDER BY "org_members"."id" ASC LIMIT 1 [["org_id", 1]]
|
5447
|
+
[1m[36m (0.6ms)[0m [1mrollback transaction[0m
|
5448
|
+
[1m[35m (0.1ms)[0m begin transaction
|
5449
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
5450
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "orgs" ("lang_id", "created_at", "updated_at") VALUES (?, ?, ?) [["lang_id", 1], ["created_at", "2015-12-16 16:06:30.175519"], ["updated_at", "2015-12-16 16:06:30.175519"]]
|
5451
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5452
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
5453
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "org_members" ("org_id", "entried_on", "retired_on", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["org_id", 1], ["entried_on", "2015-12-17"], ["retired_on", "2015-12-17"], ["created_at", "2015-12-16 16:06:30.178472"], ["updated_at", "2015-12-16 16:06:30.178472"]]
|
5454
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
5455
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "org_members" WHERE "org_members"."retired_on" IS NULL AND "org_members"."org_id" = ?[0m [["org_id", 1]]
|
5456
|
+
[1m[35m (0.9ms)[0m rollback transaction
|
5457
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5458
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
5459
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "orgs" ("lang_id", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["lang_id", 1], ["created_at", "2015-12-16 16:06:30.184716"], ["updated_at", "2015-12-16 16:06:30.184716"]]
|
5460
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
5461
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
5462
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "org_members" ("org_id", "entried_on", "private", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?) [["org_id", 1], ["entried_on", "2015-12-17"], ["private", "t"], ["created_at", "2015-12-16 16:06:30.188526"], ["updated_at", "2015-12-16 16:06:30.188526"]]
|
5463
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
5464
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
5465
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "org_members" ("org_id", "entried_on", "created_at", "updated_at") VALUES (?, ?, ?, ?)[0m [["org_id", 1], ["entried_on", "2015-12-17"], ["created_at", "2015-12-16 16:06:30.190992"], ["updated_at", "2015-12-16 16:06:30.190992"]]
|
5466
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
5467
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "org_members" WHERE "org_members"."retired_on" IS NULL AND "org_members"."org_id" = ? AND "org_members"."private" = ?[0m [["org_id", 1], ["private", "f"]]
|
5468
|
+
[1m[35mOrgMember Load (0.1ms)[0m SELECT "org_members".* FROM "org_members" WHERE "org_members"."retired_on" IS NULL AND "org_members"."org_id" = ? AND "org_members"."private" = ? ORDER BY "org_members"."id" ASC LIMIT 1 [["org_id", 1], ["private", "f"]]
|
5469
|
+
[1m[36m (0.8ms)[0m [1mrollback transaction[0m
|
@@ -19,4 +19,16 @@ RSpec.describe OrgMember, type: :model do
|
|
19
19
|
expect(@org.members.count).to eq(0)
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
context ".without_secret" do
|
24
|
+
before do
|
25
|
+
@member = OrgMember.create!(org_id: @org.id, entried_on: Time.now-10, private: true)
|
26
|
+
@member2 = OrgMember.create!(org_id: @org.id, entried_on: Time.now-10, private: false)
|
27
|
+
end
|
28
|
+
it "hit only one user" do
|
29
|
+
res = @org.members.without_secret
|
30
|
+
expect(res.count).to eq(1)
|
31
|
+
expect(res.first.id).to eq(@member2.id)
|
32
|
+
end
|
33
|
+
end
|
22
34
|
end
|