punk 0.3.2 → 0.4.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.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.rdoc_options +0 -1
- data/.rubocop.yml +1091 -93
- data/.standard.yml +2 -0
- data/Gemfile +60 -61
- data/Gemfile.lock +64 -59
- 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/env/defaults.sh +3 -0
- data/lib/punk.rb +8 -9
- 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 +33 -31
- 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 +24 -22
@@ -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
|
@@ -3,17 +3,17 @@
|
|
3
3
|
describe PUNK, "GET /users" 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 "/users"
|
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
|
let(:tenant_user) { create(:user) }
|
19
19
|
let(:group_user) { create(:user) }
|
@@ -31,7 +31,7 @@ describe PUNK, "GET /users" do
|
|
31
31
|
logout
|
32
32
|
end
|
33
33
|
|
34
|
-
context
|
34
|
+
context "without a group" do
|
35
35
|
before do
|
36
36
|
get "/users?tenant_id=#{tenant.id}"
|
37
37
|
end
|
@@ -44,7 +44,7 @@ describe PUNK, "GET /users" do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
context
|
47
|
+
context "with a group" do
|
48
48
|
before do
|
49
49
|
get "/users?tenant_id=#{tenant.id}&group_id=#{group.id}"
|
50
50
|
end
|
@@ -6,7 +6,7 @@ describe PUNK::CreateIdentitiesService do
|
|
6
6
|
create(:user, email: nil)
|
7
7
|
end
|
8
8
|
|
9
|
-
it
|
9
|
+
it "creates identities for users that are missing them" do
|
10
10
|
expect(PUNK::Identity.count).to eq(0)
|
11
11
|
described_class.run
|
12
12
|
expect(PUNK::Identity.count).to eq(2)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "simplecov"
|
4
|
+
require "coveralls"
|
5
5
|
SimpleCov.start do
|
6
|
-
add_filter
|
7
|
-
add_filter
|
8
|
-
add_filter
|
9
|
-
add_filter
|
10
|
-
add_filter
|
11
|
-
add_filter
|
12
|
-
add_filter
|
13
|
-
add_filter
|
14
|
-
add_filter
|
15
|
-
add_filter
|
6
|
+
add_filter "spec"
|
7
|
+
add_filter "lib/punk/commands/auth.rb"
|
8
|
+
add_filter "lib/punk/commands/generate.rb"
|
9
|
+
add_filter "lib/punk/commands/http.rb"
|
10
|
+
add_filter "lib/punk/commands/list.rb"
|
11
|
+
add_filter "lib/punk/core/commands.rb"
|
12
|
+
add_filter "lib/punk/framework/command.rb"
|
13
|
+
add_filter "lib/punk/plugins/cors.rb"
|
14
|
+
add_filter "lib/punk/plugins/ssl.rb"
|
15
|
+
add_filter "lib/punk/startup/logger.rb"
|
16
16
|
end
|
17
17
|
Coveralls.wear!
|
18
18
|
|
19
|
-
require_relative
|
19
|
+
require_relative "../lib/punk"
|
20
20
|
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
21
|
+
require "factory_bot"
|
22
|
+
require "faker"
|
23
|
+
require "timecop"
|
24
|
+
require "securerandom"
|
25
|
+
require "vcr"
|
26
|
+
require "rack/test"
|
27
27
|
|
28
|
-
Faker::Config.locale =
|
28
|
+
Faker::Config.locale = "en-US"
|
29
29
|
|
30
30
|
FactoryBot.use_parent_strategy = false
|
31
31
|
|
32
32
|
VCR.configure do |c|
|
33
33
|
c.ignore_localhost = true
|
34
|
-
c.cassette_library_dir =
|
34
|
+
c.cassette_library_dir = "spec/vcr_cassettes"
|
35
35
|
c.hook_into :webmock
|
36
36
|
c.configure_rspec_metadata!
|
37
37
|
end
|
38
38
|
|
39
|
-
PUNK.init(task:
|
39
|
+
PUNK.init(task: "spec", config: {app: {name: "Punk Test"}}).exec
|
40
40
|
|
41
|
-
Sidekiq.logger = SemanticLogger[
|
41
|
+
Sidekiq.logger = SemanticLogger["PUNK::SKQ"]
|
42
42
|
|
43
|
-
RSpec.shared_context
|
43
|
+
RSpec.shared_context "Punk" do # rubocop:disable RSpec/ContextWording
|
44
44
|
include Rack::Test::Methods
|
45
45
|
|
46
46
|
subject { last_response }
|
@@ -57,7 +57,7 @@ RSpec.shared_context 'Punk' do # rubocop:disable RSpec/ContextWording
|
|
57
57
|
"PATH_INFO" => "/sessions",
|
58
58
|
"CONTENT_TYPE" => "text/json",
|
59
59
|
"SCRIPT_NAME" => "",
|
60
|
-
"rack.input" => StringIO.new({
|
60
|
+
"rack.input" => StringIO.new({claim: claim}.to_json)
|
61
61
|
)
|
62
62
|
response = ActiveSupport::JSON.decode(response[-1].first).deep_symbolize_keys
|
63
63
|
slug = response[:slug]
|
@@ -68,7 +68,7 @@ RSpec.shared_context 'Punk' do # rubocop:disable RSpec/ContextWording
|
|
68
68
|
"PATH_INFO" => "/sessions/#{slug}",
|
69
69
|
"CONTENT_TYPE" => "text/json",
|
70
70
|
"SCRIPT_NAME" => "",
|
71
|
-
"rack.input" => StringIO.new({
|
71
|
+
"rack.input" => StringIO.new({secret: sms[:body][-7..-2]}.to_json)
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
@@ -84,7 +84,7 @@ end
|
|
84
84
|
|
85
85
|
module Helpers
|
86
86
|
def valid_uuid?(data)
|
87
|
-
data.split(
|
87
|
+
data.split("-").map { |s| Integer(s, 16) }.length == 5
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|