punk 0.3.6 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.rubocop.yml +1091 -93
- data/.standard.yml +2 -0
- data/Gemfile +60 -60
- data/Gemfile.lock +22 -17
- data/README.md +7 -3
- data/Rakefile +9 -7
- data/VERSION +1 -1
- data/app/migrations/001_lets_punk.rb +1 -1
- data/app/routes/hello.rb +1 -1
- data/bin/punk +5 -5
- data/lib/punk.rb +7 -7
- data/lib/punk/actions/sessions/create.rb +3 -3
- data/lib/punk/actions/sessions/verify.rb +2 -2
- data/lib/punk/commands/auth.rb +4 -4
- data/lib/punk/commands/generate.rb +5 -5
- data/lib/punk/commands/http.rb +4 -4
- data/lib/punk/commands/list.rb +10 -10
- data/lib/punk/core/app.rb +41 -41
- data/lib/punk/core/boot.rb +5 -5
- data/lib/punk/core/cli.rb +3 -3
- data/lib/punk/core/commander.rb +28 -28
- data/lib/punk/core/commands.rb +8 -8
- data/lib/punk/core/env.rb +27 -27
- data/lib/punk/core/exec.rb +8 -8
- data/lib/punk/core/interface.rb +19 -19
- data/lib/punk/core/load.rb +2 -2
- data/lib/punk/core/logger.rb +3 -3
- data/lib/punk/core/monkey.rb +1 -1
- data/lib/punk/core/pry.rb +2 -2
- data/lib/punk/core/settings.rb +4 -4
- data/lib/punk/core/version.rb +1 -1
- data/lib/punk/core/worker.rb +6 -6
- data/lib/punk/framework/all.rb +8 -8
- data/lib/punk/framework/model.rb +6 -5
- data/lib/punk/framework/plugins/all.rb +1 -1
- data/lib/punk/framework/plugins/validation.rb +8 -8
- data/lib/punk/framework/service.rb +5 -3
- data/lib/punk/framework/worker.rb +3 -3
- data/lib/punk/helpers/all.rb +5 -5
- data/lib/punk/helpers/loggable.rb +3 -3
- data/lib/punk/helpers/publishable.rb +1 -1
- data/lib/punk/helpers/renderable.rb +10 -10
- data/lib/punk/helpers/validatable.rb +7 -6
- data/lib/punk/migrations/001_punk.rb +12 -12
- data/lib/punk/models/group.rb +1 -1
- data/lib/punk/models/identity.rb +1 -1
- data/lib/punk/models/session.rb +7 -7
- data/lib/punk/models/tenant.rb +1 -1
- data/lib/punk/models/user.rb +2 -2
- data/lib/punk/plugins/all.rb +2 -2
- data/lib/punk/plugins/cors.rb +2 -2
- data/lib/punk/plugins/ssl.rb +1 -1
- data/lib/punk/routes/groups.rb +1 -1
- data/lib/punk/routes/plivo.rb +1 -1
- data/lib/punk/routes/sessions.rb +2 -2
- data/lib/punk/routes/swagger.rb +2 -2
- data/lib/punk/routes/tenants.rb +1 -1
- data/lib/punk/routes/users.rb +1 -1
- data/lib/punk/services/challenge_claim.rb +5 -5
- data/lib/punk/services/generate_swagger.rb +6 -6
- data/lib/punk/services/prove_claim.rb +1 -1
- data/lib/punk/startup/cache.rb +3 -3
- data/lib/punk/startup/database.rb +4 -4
- data/lib/punk/startup/environment.rb +6 -6
- data/lib/punk/startup/logger.rb +2 -2
- data/lib/punk/startup/task.rb +5 -5
- data/lib/punk/views/fail.rb +2 -2
- data/lib/punk/views/groups/list.rb +2 -2
- data/lib/punk/views/info.rb +2 -2
- data/lib/punk/views/plivo_store.rb +2 -2
- data/lib/punk/views/sessions/list.rb +2 -2
- data/lib/punk/views/sessions/pending.rb +2 -2
- data/lib/punk/views/tenants/list.rb +2 -2
- data/lib/punk/views/users/list.rb +2 -2
- data/lib/punk/views/users/show.rb +2 -2
- data/lib/punk/workers/geocode_session_worker.rb +3 -3
- data/lib/punk/workers/identify_session_worker.rb +1 -1
- data/lib/punk/workers/send_email_worker.rb +3 -3
- data/lib/punk/workers/send_sms_worker.rb +3 -3
- data/punk.gemspec +8 -4
- data/spec/actions/groups/punk/list_groups_action_spec.rb +9 -9
- data/spec/actions/sessions/punk/clear_session_action_spec.rb +11 -11
- data/spec/actions/sessions/punk/create_session_action_spec.rb +9 -9
- data/spec/actions/sessions/punk/list_sessions_action_spec.rb +8 -8
- data/spec/actions/sessions/punk/verify_session_action_spec.rb +24 -24
- data/spec/actions/tenants/punk/list_tenants_action_spec.rb +6 -6
- data/spec/actions/users/punk/list_group_users_action_spec.rb +6 -6
- data/spec/actions/users/punk/list_tenant_users_action_spec.rb +6 -6
- data/spec/factories/group.rb +1 -1
- data/spec/factories/group_user_metadata.rb +1 -1
- data/spec/factories/identity.rb +4 -4
- data/spec/factories/session.rb +1 -1
- data/spec/factories/tenant.rb +1 -1
- data/spec/factories/tenant_user_metadata.rb +1 -1
- data/spec/factories/user.rb +1 -1
- data/spec/lib/commands/generate_spec.rb +2 -2
- data/spec/lib/commands/list_spec.rb +2 -2
- data/spec/lib/commands/swagger_spec.rb +2 -2
- data/spec/lib/engine/punk_env_spec.rb +4 -4
- data/spec/lib/engine/punk_exec_spec.rb +2 -2
- data/spec/lib/engine/punk_init_spec.rb +2 -2
- data/spec/lib/engine/punk_store_spec.rb +2 -2
- data/spec/models/punk/group_spec.rb +4 -4
- data/spec/models/punk/group_user_metadata_spec.rb +2 -2
- data/spec/models/punk/identity_spec.rb +17 -17
- data/spec/models/punk/session_spec.rb +4 -4
- data/spec/models/punk/tenant_spec.rb +3 -3
- data/spec/models/punk/tenant_user_metadata_spec.rb +2 -2
- data/spec/models/punk/user_spec.rb +9 -9
- data/spec/routes/groups/get_groups_spec.rb +4 -4
- data/spec/routes/plivo/get_plivo_spec.rb +1 -1
- data/spec/routes/sessions/delete_session_spec.rb +1 -1
- data/spec/routes/sessions/get_sessions_spec.rb +5 -5
- data/spec/routes/sessions/patch_session_spec.rb +1 -1
- data/spec/routes/sessions/post_session_spec.rb +1 -1
- data/spec/routes/swagger/get_swagger_spec.rb +1 -1
- data/spec/routes/tenants/get_tenants_spec.rb +5 -5
- data/spec/routes/users/get_users_spec.rb +6 -6
- data/spec/services/punk/challenge_claim_service_spec.rb +2 -2
- data/spec/services/punk/create_identities_service_spec.rb +1 -1
- data/spec/services/punk/generate_swagger_service_spec.rb +2 -2
- data/spec/services/punk/prove_claim_service_spec.rb +2 -2
- data/spec/services/punk/secret_service_spec.rb +2 -2
- data/spec/spec_helper.rb +27 -27
- data/spec/views/punk/plivo_store_spec.rb +2 -2
- data/spec/views/sessions/punk/list_sessions_view_spec.rb +2 -2
- data/spec/views/sessions/punk/pending_session_view_spec.rb +2 -2
- data/spec/views/tenants/punk/list_tenants_view_spec.rb +2 -2
- data/spec/views/users/punk/list_groups_view_spec.rb +2 -2
- data/spec/views/users/punk/list_users_view_spec.rb +2 -2
- data/spec/workers/punk/geocode_session_worker_spec.rb +2 -2
- data/spec/workers/punk/identify_session_worker_spec.rb +3 -3
- data/spec/workers/punk/send_email_worker_spec.rb +1 -1
- metadata +18 -3
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe PUNK do
|
4
|
-
describe
|
5
|
-
it
|
6
|
-
expect(described_class.get.trace).to eq(
|
4
|
+
describe ".env" do
|
5
|
+
it "loads environment" do
|
6
|
+
expect(described_class.get.trace).to eq("spec_test")
|
7
7
|
end
|
8
8
|
|
9
|
-
it
|
9
|
+
it "loads configuration" do
|
10
10
|
expect(described_class.env.to_sym).to eq(:test)
|
11
11
|
end
|
12
12
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe PUNK do
|
4
|
-
describe
|
5
|
-
it
|
4
|
+
describe ".init" do
|
5
|
+
it "cannot be called twice" do
|
6
6
|
expect { described_class.init }.to raise_error(PUNK::InternalServerError, "Cannot call PUNK.init multiple times!")
|
7
7
|
end
|
8
8
|
end
|
@@ -8,7 +8,7 @@ describe PUNK::Group do
|
|
8
8
|
it "is assigned a uuid on save" do
|
9
9
|
group = build(:group)
|
10
10
|
expect(group.id).to be_nil
|
11
|
-
group.
|
11
|
+
group.save_changes
|
12
12
|
expect(valid_uuid?(group.id)).to be(true)
|
13
13
|
end
|
14
14
|
|
@@ -21,7 +21,7 @@ describe PUNK::Group do
|
|
21
21
|
it "is invalid without a name" do
|
22
22
|
group = build(:group, name: nil)
|
23
23
|
expect(group.valid?).to be(false)
|
24
|
-
expect(group.errors[:name].first).to eq(
|
24
|
+
expect(group.errors[:name].first).to eq("is not present")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "is valid without an icon" do
|
@@ -32,13 +32,13 @@ describe PUNK::Group do
|
|
32
32
|
it "is invalid if the icon is not a URL" do
|
33
33
|
group = build(:group, icon: Faker::Alphanumeric.alpha)
|
34
34
|
expect(group.valid?).to be(false)
|
35
|
-
expect(group.errors[:icon].first).to eq(
|
35
|
+
expect(group.errors[:icon].first).to eq("is not a URL")
|
36
36
|
end
|
37
37
|
|
38
38
|
it "must belong to a tenant" do
|
39
39
|
group = build(:group, tenant: nil)
|
40
40
|
expect(group.valid?).to be(false)
|
41
|
-
expect(group.errors[:tenant].first).to eq(
|
41
|
+
expect(group.errors[:tenant].first).to eq("is not present")
|
42
42
|
end
|
43
43
|
|
44
44
|
it "can have multiple members" do
|
@@ -8,13 +8,13 @@ describe PUNK::GroupUserMetadata do
|
|
8
8
|
it "is invalid without a group" do
|
9
9
|
group_user_metadata = build(:group_user_metadata, group: nil)
|
10
10
|
expect(group_user_metadata.valid?).to be(false)
|
11
|
-
expect(group_user_metadata.errors[:group].first).to eq(
|
11
|
+
expect(group_user_metadata.errors[:group].first).to eq("is not present")
|
12
12
|
end
|
13
13
|
|
14
14
|
it "is invalid without a user" do
|
15
15
|
group_user_metadata = build(:group_user_metadata, user: nil)
|
16
16
|
expect(group_user_metadata.valid?).to be(false)
|
17
|
-
expect(group_user_metadata.errors[:user].first).to eq(
|
17
|
+
expect(group_user_metadata.errors[:user].first).to eq("is not present")
|
18
18
|
end
|
19
19
|
|
20
20
|
it "displays as the two IDs concatenated" do
|
@@ -1,58 +1,58 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe PUNK::Identity do
|
4
|
-
it
|
4
|
+
it "is valid with valid attributes" do
|
5
5
|
expect { create(:identity) }.not_to raise_error
|
6
6
|
end
|
7
7
|
|
8
|
-
it
|
9
|
-
identity = build(:identity, claim_type:
|
8
|
+
it "must claim an email or a phone" do
|
9
|
+
identity = build(:identity, claim_type: "zork", claim: "xyzzy")
|
10
10
|
expect(identity.valid?).to be(false)
|
11
|
-
expect(identity.errors[:claim_type].first).to eq(
|
11
|
+
expect(identity.errors[:claim_type].first).to eq("is not in range or set: [:email, :phone]")
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it "is assigned a uuid on save" do
|
15
15
|
identity = build(:identity)
|
16
16
|
expect(identity.id).to be_nil
|
17
|
-
identity.
|
17
|
+
identity.save_changes
|
18
18
|
expect(valid_uuid?(identity.id)).to be(true)
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
21
|
+
it "can be saved with a custom uuid" do
|
22
22
|
uuid = generate(:uuid)
|
23
23
|
identity = create(:identity, id: uuid)
|
24
24
|
expect(identity.id).to eq(uuid)
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
27
|
+
it "may belong to a user" do
|
28
28
|
identity_with_user = create(:identity)
|
29
29
|
expect(identity_with_user.user).to exist
|
30
30
|
identity_without_user = create(:identity, user: nil)
|
31
31
|
expect(identity_without_user.user).to be_nil
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
35
|
-
identity_with_email = build(:identity, claim_type:
|
34
|
+
it "has an email? accessor" do
|
35
|
+
identity_with_email = build(:identity, claim_type: "email")
|
36
36
|
expect(identity_with_email.email?).to be(true)
|
37
|
-
identity_without_email = build(:identity, claim_type:
|
37
|
+
identity_without_email = build(:identity, claim_type: "phone")
|
38
38
|
expect(identity_without_email.email?).to be(false)
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
42
|
-
identity_with_phone = create(:identity, claim_type:
|
41
|
+
it "has a phone? accessor" do
|
42
|
+
identity_with_phone = create(:identity, claim_type: "phone")
|
43
43
|
expect(identity_with_phone.phone?).to be(true)
|
44
|
-
identity_without_phone = create(:identity, claim_type:
|
44
|
+
identity_without_phone = create(:identity, claim_type: "email")
|
45
45
|
expect(identity_without_phone.phone?).to be(false)
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it "has a unique claim" do
|
49
49
|
identity = create(:identity)
|
50
50
|
duplicate_identity = build(:identity, claim_type: identity.claim_type, claim: identity.claim)
|
51
51
|
expect(duplicate_identity.valid?).to be(false)
|
52
|
-
expect(duplicate_identity.errors[:claim].first).to eq(
|
52
|
+
expect(duplicate_identity.errors[:claim].first).to eq("is already taken")
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
55
|
+
it "can have multiple sessions" do
|
56
56
|
identity = create(:identity)
|
57
57
|
expect(identity.sessions.count).to eq(0)
|
58
58
|
create_list(:session, 3, identity: identity)
|
@@ -8,7 +8,7 @@ describe PUNK::Session do
|
|
8
8
|
it "is assigned a uuid on save" do
|
9
9
|
session = build(:session)
|
10
10
|
expect(session.id).to be_nil
|
11
|
-
session.
|
11
|
+
session.save_changes
|
12
12
|
expect(valid_uuid?(session.id)).to be(true)
|
13
13
|
end
|
14
14
|
|
@@ -21,7 +21,7 @@ describe PUNK::Session do
|
|
21
21
|
it "must belong to an identity" do
|
22
22
|
session = build(:session, identity: nil)
|
23
23
|
expect(session.valid?).to be(false)
|
24
|
-
expect(session.errors[:identity].first).to eq(
|
24
|
+
expect(session.errors[:identity].first).to eq("is not present")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "may have a user" do
|
@@ -32,8 +32,8 @@ describe PUNK::Session do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "can contain client data" do
|
35
|
-
identity = create(:session, data: {
|
36
|
-
expect(identity.data[:foo]).to eq(
|
35
|
+
identity = create(:session, data: {foo: "bar"})
|
36
|
+
expect(identity.data[:foo]).to eq("bar")
|
37
37
|
end
|
38
38
|
|
39
39
|
it "permits only three validation attempts" do
|
@@ -8,7 +8,7 @@ describe PUNK::Tenant do
|
|
8
8
|
it "is assigned a uuid on save" do
|
9
9
|
tenant = build(:tenant)
|
10
10
|
expect(tenant.id).to be_nil
|
11
|
-
tenant.
|
11
|
+
tenant.save_changes
|
12
12
|
expect(valid_uuid?(tenant.id)).to be(true)
|
13
13
|
end
|
14
14
|
|
@@ -21,7 +21,7 @@ describe PUNK::Tenant do
|
|
21
21
|
it "is invalid without a name" do
|
22
22
|
tenant = build(:tenant, name: nil)
|
23
23
|
expect(tenant.valid?).to be(false)
|
24
|
-
expect(tenant.errors[:name].first).to eq(
|
24
|
+
expect(tenant.errors[:name].first).to eq("is not present")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "is valid without an icon" do
|
@@ -32,7 +32,7 @@ describe PUNK::Tenant do
|
|
32
32
|
it "is invalid if the icon is not a URL" do
|
33
33
|
tenant = build(:tenant, icon: Faker::Alphanumeric.alpha)
|
34
34
|
expect(tenant.valid?).to be(false)
|
35
|
-
expect(tenant.errors[:icon].first).to eq(
|
35
|
+
expect(tenant.errors[:icon].first).to eq("is not a URL")
|
36
36
|
end
|
37
37
|
|
38
38
|
it "can have multiple users" do
|
@@ -8,13 +8,13 @@ describe PUNK::TenantUserMetadata do
|
|
8
8
|
it "is invalid without a tenant" do
|
9
9
|
tenant_user_metadata = build(:tenant_user_metadata, tenant: nil)
|
10
10
|
expect(tenant_user_metadata.valid?).to be(false)
|
11
|
-
expect(tenant_user_metadata.errors[:tenant].first).to eq(
|
11
|
+
expect(tenant_user_metadata.errors[:tenant].first).to eq("is not present")
|
12
12
|
end
|
13
13
|
|
14
14
|
it "is invalid without a user" do
|
15
15
|
tenant_user_metadata = build(:tenant_user_metadata, user: nil)
|
16
16
|
expect(tenant_user_metadata.valid?).to be(false)
|
17
|
-
expect(tenant_user_metadata.errors[:user].first).to eq(
|
17
|
+
expect(tenant_user_metadata.errors[:user].first).to eq("is not present")
|
18
18
|
end
|
19
19
|
|
20
20
|
it "displays as the two IDs concatenated" do
|
@@ -8,7 +8,7 @@ describe PUNK::User do
|
|
8
8
|
it "is assigned a uuid on save" do
|
9
9
|
user = build(:user)
|
10
10
|
expect(user.id).to be_nil
|
11
|
-
user.
|
11
|
+
user.save_changes
|
12
12
|
expect(valid_uuid?(user.id)).to be(true)
|
13
13
|
end
|
14
14
|
|
@@ -21,7 +21,7 @@ describe PUNK::User do
|
|
21
21
|
it "is invalid without a name" do
|
22
22
|
user = build(:user, name: nil)
|
23
23
|
expect(user.valid?).to be(false)
|
24
|
-
expect(user.errors[:name].first).to eq(
|
24
|
+
expect(user.errors[:name].first).to eq("is not present")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "validates name presence in the database" do
|
@@ -37,7 +37,7 @@ describe PUNK::User do
|
|
37
37
|
it "is invalid if the icon is not a URL" do
|
38
38
|
user = build(:user, icon: Faker::Alphanumeric.alpha)
|
39
39
|
expect(user.valid?).to be(false)
|
40
|
-
expect(user.errors[:icon].first).to eq(
|
40
|
+
expect(user.errors[:icon].first).to eq("is not a URL")
|
41
41
|
end
|
42
42
|
|
43
43
|
it "is valid without an email" do
|
@@ -48,14 +48,14 @@ describe PUNK::User do
|
|
48
48
|
it "is invalid if the email is not an email address" do
|
49
49
|
user = build(:user, email: Faker::Alphanumeric.alpha)
|
50
50
|
expect(user.valid?).to be(false)
|
51
|
-
expect(user.errors[:email].first).to eq(
|
51
|
+
expect(user.errors[:email].first).to eq("is not an email address")
|
52
52
|
end
|
53
53
|
|
54
54
|
it "has a unique email" do
|
55
55
|
email = create(:user).email
|
56
56
|
user = build(:user, email: email)
|
57
57
|
expect(user.valid?).to be(false)
|
58
|
-
expect(user.errors[:email].first).to eq(
|
58
|
+
expect(user.errors[:email].first).to eq("is already taken")
|
59
59
|
end
|
60
60
|
|
61
61
|
it "validates email uniqueness in the database" do
|
@@ -72,14 +72,14 @@ describe PUNK::User do
|
|
72
72
|
it "is invalid if the phone is not a phone number" do
|
73
73
|
user = build(:user, phone: Faker::Alphanumeric.alpha)
|
74
74
|
expect(user.valid?).to be(false)
|
75
|
-
expect(user.errors[:phone].first).to eq(
|
75
|
+
expect(user.errors[:phone].first).to eq("is not a phone number")
|
76
76
|
end
|
77
77
|
|
78
78
|
it "has a unique phone" do
|
79
79
|
phone = create(:user).phone
|
80
80
|
user = build(:user, phone: phone)
|
81
81
|
expect(user.valid?).to be(false)
|
82
|
-
expect(user.errors[:phone].first).to eq(
|
82
|
+
expect(user.errors[:phone].first).to eq("is already taken")
|
83
83
|
end
|
84
84
|
|
85
85
|
it "validates phone uniqueness in the database" do
|
@@ -91,8 +91,8 @@ describe PUNK::User do
|
|
91
91
|
it "is invalid without either an email or a phone" do
|
92
92
|
user = build(:user, email: nil, phone: nil)
|
93
93
|
user.valid?
|
94
|
-
expect(user.errors[:email].first).to eq(
|
95
|
-
expect(user.errors[:phone].first).to eq(
|
94
|
+
expect(user.errors[:email].first).to eq("is not present")
|
95
|
+
expect(user.errors[:phone].first).to eq("is not present")
|
96
96
|
end
|
97
97
|
|
98
98
|
it "can belong to multiple tenants" do
|
@@ -3,17 +3,17 @@
|
|
3
3
|
describe PUNK, "GET /groups" do
|
4
4
|
include_context "Punk"
|
5
5
|
|
6
|
-
context
|
6
|
+
context "when the user is not authenticated" do
|
7
7
|
before do
|
8
|
-
get
|
8
|
+
get "/groups"
|
9
9
|
end
|
10
10
|
|
11
11
|
it { is_expected.not_to be_successful }
|
12
12
|
end
|
13
13
|
|
14
|
-
context
|
14
|
+
context "when the user is authenticated" do
|
15
15
|
let(:tenant) { create(:tenant) }
|
16
|
-
let(:identity) { create(:identity, claim_type:
|
16
|
+
let(:identity) { create(:identity, claim_type: "phone") }
|
17
17
|
let(:group) { create(:group, tenant: tenant) }
|
18
18
|
|
19
19
|
before do
|
@@ -3,21 +3,21 @@
|
|
3
3
|
describe PUNK, "GET /sessions" do
|
4
4
|
include_context "Punk"
|
5
5
|
|
6
|
-
context
|
6
|
+
context "when the user is not authenticated" do
|
7
7
|
before do
|
8
|
-
get
|
8
|
+
get "/sessions"
|
9
9
|
end
|
10
10
|
|
11
11
|
it { is_expected.not_to be_successful }
|
12
12
|
end
|
13
13
|
|
14
|
-
context
|
14
|
+
context "when the user is authenticated" do
|
15
15
|
let(:user) { create(:user) }
|
16
|
-
let(:identity) { create(:identity, user: user, claim_type:
|
16
|
+
let(:identity) { create(:identity, user: user, claim_type: "phone") }
|
17
17
|
|
18
18
|
before do
|
19
19
|
login(identity.claim)
|
20
|
-
get
|
20
|
+
get "/sessions"
|
21
21
|
end
|
22
22
|
|
23
23
|
after do
|
@@ -3,22 +3,22 @@
|
|
3
3
|
describe PUNK, "GET /tenants" do
|
4
4
|
include_context "Punk"
|
5
5
|
|
6
|
-
context
|
6
|
+
context "when the user is not authenticated" do
|
7
7
|
before do
|
8
|
-
get
|
8
|
+
get "/tenants"
|
9
9
|
end
|
10
10
|
|
11
11
|
it { is_expected.not_to be_successful }
|
12
12
|
end
|
13
13
|
|
14
|
-
context
|
14
|
+
context "when the user is authenticated" do
|
15
15
|
let(:tenant) { create(:tenant) }
|
16
|
-
let(:identity) { create(:identity, claim_type:
|
16
|
+
let(:identity) { create(:identity, claim_type: "phone") }
|
17
17
|
|
18
18
|
before do
|
19
19
|
identity.user.add_tenant(tenant)
|
20
20
|
login(identity.claim)
|
21
|
-
get
|
21
|
+
get "/tenants"
|
22
22
|
end
|
23
23
|
|
24
24
|
after do
|