souls 0.24.2 → 0.24.6
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/exe/souls +12 -1
- data/lib/souls.rb +54 -0
- data/lib/souls/init.rb +37 -16
- data/lib/souls/version.rb +1 -1
- metadata +16 -191
- data/.gitignore +0 -15
- data/.irbrc +0 -3
- data/.rspec +0 -3
- data/.rubocop.yml +0 -152
- data/.ruby-version +0 -1
- data/.travis.yml +0 -6
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -98
- data/Rakefile +0 -23
- data/Steepfile +0 -8
- data/apps/api/.env.sample +0 -7
- data/apps/api/.gitignore +0 -32
- data/apps/api/.irbrc +0 -4
- data/apps/api/.rspec +0 -3
- data/apps/api/.rubocop.yml +0 -132
- data/apps/api/.ruby-version +0 -1
- data/apps/api/CODE_OF_CONDUCT.md +0 -74
- data/apps/api/Dockerfile +0 -16
- data/apps/api/Dockerfile.dev +0 -17
- data/apps/api/Gemfile +0 -50
- data/apps/api/Gemfile.lock +0 -412
- data/apps/api/LICENSE.txt +0 -67
- data/apps/api/Procfile +0 -2
- data/apps/api/Procfile.dev +0 -2
- data/apps/api/README.md +0 -37
- data/apps/api/Rakefile +0 -5
- data/apps/api/app.rb +0 -114
- data/apps/api/app/engines/notification_engine.rb +0 -5
- data/apps/api/app/graphql/mutations/.keep +0 -0
- data/apps/api/app/graphql/mutations/base/article/create_article.rb +0 -30
- data/apps/api/app/graphql/mutations/base/article/delete_article.rb +0 -17
- data/apps/api/app/graphql/mutations/base/article/destroy_delete_article.rb +0 -17
- data/apps/api/app/graphql/mutations/base/article/update_article.rb +0 -30
- data/apps/api/app/graphql/mutations/base/article_category/create_article_category.rb +0 -21
- data/apps/api/app/graphql/mutations/base/article_category/delete_article_category.rb +0 -17
- data/apps/api/app/graphql/mutations/base/article_category/destroy_delete_article_category.rb +0 -17
- data/apps/api/app/graphql/mutations/base/article_category/update_article_category.rb +0 -21
- data/apps/api/app/graphql/mutations/base/user/create_user.rb +0 -31
- data/apps/api/app/graphql/mutations/base/user/delete_user.rb +0 -17
- data/apps/api/app/graphql/mutations/base/user/destroy_delete_user.rb +0 -17
- data/apps/api/app/graphql/mutations/base/user/update_user.rb +0 -31
- data/apps/api/app/graphql/mutations/base_mutation.rb +0 -65
- data/apps/api/app/graphql/mutations/managers/user_manager/add_user_role.rb +0 -22
- data/apps/api/app/graphql/mutations/managers/user_manager/remove_user_role.rb +0 -22
- data/apps/api/app/graphql/mutations/managers/user_manager/sign_in_user.rb +0 -45
- data/apps/api/app/graphql/queries/article.rb +0 -13
- data/apps/api/app/graphql/queries/article_categories.rb +0 -11
- data/apps/api/app/graphql/queries/article_category.rb +0 -13
- data/apps/api/app/graphql/queries/articles.rb +0 -11
- data/apps/api/app/graphql/queries/base_query.rb +0 -12
- data/apps/api/app/graphql/queries/me.rb +0 -11
- data/apps/api/app/graphql/queries/user.rb +0 -13
- data/apps/api/app/graphql/queries/users.rb +0 -11
- data/apps/api/app/graphql/resolvers/article_category_search.rb +0 -41
- data/apps/api/app/graphql/resolvers/article_search.rb +0 -57
- data/apps/api/app/graphql/resolvers/base.rb +0 -17
- data/apps/api/app/graphql/resolvers/user_search.rb +0 -63
- data/apps/api/app/graphql/souls_api_schema.rb +0 -43
- data/apps/api/app/graphql/types/.keep +0 -0
- data/apps/api/app/graphql/types/article_category_type.rb +0 -12
- data/apps/api/app/graphql/types/article_type.rb +0 -30
- data/apps/api/app/graphql/types/base/base_argument.rb +0 -4
- data/apps/api/app/graphql/types/base/base_enum.rb +0 -4
- data/apps/api/app/graphql/types/base/base_field.rb +0 -5
- data/apps/api/app/graphql/types/base/base_input_object.rb +0 -5
- data/apps/api/app/graphql/types/base/base_interface.rb +0 -7
- data/apps/api/app/graphql/types/base/base_object.rb +0 -6
- data/apps/api/app/graphql/types/base/base_scalar.rb +0 -4
- data/apps/api/app/graphql/types/base/base_union.rb +0 -4
- data/apps/api/app/graphql/types/base/mutation_type.rb +0 -26
- data/apps/api/app/graphql/types/base/query_type.rb +0 -18
- data/apps/api/app/graphql/types/connections/article_category_connection.rb +0 -3
- data/apps/api/app/graphql/types/connections/article_connection.rb +0 -3
- data/apps/api/app/graphql/types/connections/base_connection.rb +0 -14
- data/apps/api/app/graphql/types/connections/user_connection.rb +0 -3
- data/apps/api/app/graphql/types/edges/article_category_edge.rb +0 -5
- data/apps/api/app/graphql/types/edges/article_edge.rb +0 -5
- data/apps/api/app/graphql/types/edges/base_edge.rb +0 -4
- data/apps/api/app/graphql/types/edges/user_edge.rb +0 -5
- data/apps/api/app/graphql/types/user_type.rb +0 -24
- data/apps/api/app/models/article.rb +0 -4
- data/apps/api/app/models/article_category.rb +0 -3
- data/apps/api/app/models/user.rb +0 -19
- data/apps/api/app/policies/application_policy.rb +0 -40
- data/apps/api/app/policies/article_category_policy.rb +0 -31
- data/apps/api/app/policies/article_policy.rb +0 -31
- data/apps/api/app/policies/user_policy.rb +0 -35
- data/apps/api/app/utils/association_loader.rb +0 -50
- data/apps/api/app/utils/fire_store.rb +0 -9
- data/apps/api/app/utils/firebase_id_token.rb +0 -4
- data/apps/api/app/utils/json_web_token.rb +0 -13
- data/apps/api/app/utils/record_loader.rb +0 -10
- data/apps/api/app/utils/souls_helper.rb +0 -18
- data/apps/api/cloudbuild.yml +0 -32
- data/apps/api/config.ru +0 -17
- data/apps/api/config/database.yml +0 -33
- data/apps/api/config/souls.rb +0 -10
- data/apps/api/constants/areas.rb +0 -71
- data/apps/api/constants/column_name_ja.rb +0 -27
- data/apps/api/db/migrate/20200006095538_create_users.rb +0 -30
- data/apps/api/db/migrate/20200712180236_create_article_categories.rb +0 -12
- data/apps/api/db/migrate/20200714215521_create_articles.rb +0 -22
- data/apps/api/db/schema.rb +0 -78
- data/apps/api/db/seeds.rb +0 -44
- data/apps/api/github/workflows/delivery.yml +0 -81
- data/apps/api/log/.keep +0 -0
- data/apps/api/spec/factories/article_categories.rb +0 -9
- data/apps/api/spec/factories/articles.rb +0 -17
- data/apps/api/spec/factories/users.rb +0 -23
- data/apps/api/spec/models/article_category_spec.rb +0 -7
- data/apps/api/spec/models/article_spec.rb +0 -7
- data/apps/api/spec/models/user_spec.rb +0 -7
- data/apps/api/spec/mutations/base/article_category_spec.rb +0 -46
- data/apps/api/spec/mutations/base/article_spec.rb +0 -70
- data/apps/api/spec/mutations/base/user_spec.rb +0 -76
- data/apps/api/spec/policies/article_category_policy_spec.rb +0 -24
- data/apps/api/spec/policies/article_policy_spec.rb +0 -24
- data/apps/api/spec/policies/user_policy_spec.rb +0 -24
- data/apps/api/spec/queries/article_category_spec.rb +0 -39
- data/apps/api/spec/queries/article_spec.rb +0 -53
- data/apps/api/spec/queries/user_spec.rb +0 -59
- data/apps/api/spec/resolvers/article_category_search_spec.rb +0 -54
- data/apps/api/spec/resolvers/article_search_spec.rb +0 -68
- data/apps/api/spec/resolvers/user_search_spec.rb +0 -74
- data/apps/api/spec/spec_helper.rb +0 -110
- data/apps/api/tmp/.keep +0 -0
- data/apps/worker/.env.sample +0 -9
- data/apps/worker/.gitignore +0 -32
- data/apps/worker/.irbrc +0 -4
- data/apps/worker/.rspec +0 -3
- data/apps/worker/.rubocop.yml +0 -132
- data/apps/worker/.ruby-version +0 -1
- data/apps/worker/CODE_OF_CONDUCT.md +0 -74
- data/apps/worker/Dockerfile +0 -16
- data/apps/worker/Dockerfile.dev +0 -17
- data/apps/worker/Gemfile +0 -49
- data/apps/worker/Gemfile.lock +0 -396
- data/apps/worker/LICENSE.txt +0 -67
- data/apps/worker/Procfile +0 -1
- data/apps/worker/Procfile.dev +0 -1
- data/apps/worker/README.md +0 -37
- data/apps/worker/Rakefile +0 -5
- data/apps/worker/app.rb +0 -101
- data/apps/worker/app/engines/notification_engine.rb +0 -5
- data/apps/worker/app/graphql/mutations/.keep +0 -0
- data/apps/worker/app/graphql/mutations/base_mutation.rb +0 -16
- data/apps/worker/app/graphql/mutations/workers/send_user_mail_job.rb +0 -31
- data/apps/worker/app/graphql/souls_api_schema.rb +0 -43
- data/apps/worker/app/graphql/types/.keep +0 -0
- data/apps/worker/app/graphql/types/base/base_argument.rb +0 -4
- data/apps/worker/app/graphql/types/base/base_enum.rb +0 -4
- data/apps/worker/app/graphql/types/base/base_field.rb +0 -5
- data/apps/worker/app/graphql/types/base/base_input_object.rb +0 -5
- data/apps/worker/app/graphql/types/base/base_interface.rb +0 -7
- data/apps/worker/app/graphql/types/base/base_object.rb +0 -5
- data/apps/worker/app/graphql/types/base/base_scalar.rb +0 -4
- data/apps/worker/app/graphql/types/base/base_union.rb +0 -4
- data/apps/worker/app/graphql/types/base/mutation_type.rb +0 -12
- data/apps/worker/app/graphql/types/base/query_type.rb +0 -6
- data/apps/worker/app/models/article.rb +0 -4
- data/apps/worker/app/models/article_category.rb +0 -3
- data/apps/worker/app/models/user.rb +0 -19
- data/apps/worker/app/utils/fire_store.rb +0 -9
- data/apps/worker/app/utils/souls_helper.rb +0 -96
- data/apps/worker/cloudbuild.yml +0 -32
- data/apps/worker/config.ru +0 -17
- data/apps/worker/config/database.yml +0 -33
- data/apps/worker/config/souls.rb +0 -10
- data/apps/worker/db/migrate/20200006095538_create_users.rb +0 -30
- data/apps/worker/db/migrate/20200712180236_create_article_categories.rb +0 -12
- data/apps/worker/db/migrate/20200714215521_create_articles.rb +0 -22
- data/apps/worker/db/schema.rb +0 -78
- data/apps/worker/db/seeds.rb +0 -44
- data/apps/worker/github/workflows/delivery.yml +0 -81
- data/apps/worker/log/.keep +0 -0
- data/apps/worker/spec/factories/article_categories.rb +0 -9
- data/apps/worker/spec/factories/articles.rb +0 -17
- data/apps/worker/spec/factories/users.rb +0 -23
- data/apps/worker/spec/models/article_category_spec.rb +0 -7
- data/apps/worker/spec/models/article_spec.rb +0 -7
- data/apps/worker/spec/models/user_spec.rb +0 -7
- data/apps/worker/spec/spec_helper.rb +0 -110
- data/apps/worker/tmp/.keep +0 -0
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/config/souls.rb +0 -9
- data/db/schema.rb +0 -67
- data/rbs/init.rbs +0 -2
- data/souls.gemspec +0 -34
@@ -1,24 +0,0 @@
|
|
1
|
-
describe ArticleCategoryPolicy do
|
2
|
-
subject { described_class.new(user, article) }
|
3
|
-
|
4
|
-
let(:article) { FactoryBot.create(:article) }
|
5
|
-
|
6
|
-
context "being a normal" do
|
7
|
-
let(:user) { FactoryBot.create(:user) }
|
8
|
-
|
9
|
-
it { is_expected.to(permit_actions(%i[index show])) }
|
10
|
-
it { is_expected.to(forbid_actions(%i[create update delete])) }
|
11
|
-
end
|
12
|
-
|
13
|
-
context "being a user" do
|
14
|
-
let(:user) { FactoryBot.create(:user, roles: :user) }
|
15
|
-
|
16
|
-
it { is_expected.to(permit_actions(%i[create update])) }
|
17
|
-
end
|
18
|
-
|
19
|
-
context "being an admin" do
|
20
|
-
let(:user) { FactoryBot.create(:user, roles: :admin) }
|
21
|
-
|
22
|
-
it { is_expected.to(permit_actions(%i[create update delete])) }
|
23
|
-
end
|
24
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
describe ArticlePolicy do
|
2
|
-
subject { described_class.new(user, article) }
|
3
|
-
|
4
|
-
let(:article) { FactoryBot.create(:article) }
|
5
|
-
|
6
|
-
context "being a normal" do
|
7
|
-
let(:user) { FactoryBot.create(:user) }
|
8
|
-
|
9
|
-
it { is_expected.to(permit_actions(%i[index show])) }
|
10
|
-
it { is_expected.to(forbid_actions(%i[create update delete])) }
|
11
|
-
end
|
12
|
-
|
13
|
-
context "being a user" do
|
14
|
-
let(:user) { FactoryBot.create(:user, roles: :user) }
|
15
|
-
|
16
|
-
it { is_expected.to(permit_actions(%i[create update])) }
|
17
|
-
end
|
18
|
-
|
19
|
-
context "being an admin" do
|
20
|
-
let(:user) { FactoryBot.create(:user, roles: :admin) }
|
21
|
-
|
22
|
-
it { is_expected.to(permit_actions(%i[create update delete])) }
|
23
|
-
end
|
24
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
describe UserPolicy do
|
2
|
-
subject { described_class.new(user, article) }
|
3
|
-
|
4
|
-
let(:article) { FactoryBot.create(:article) }
|
5
|
-
|
6
|
-
context "being a normal" do
|
7
|
-
let(:user) { FactoryBot.create(:user) }
|
8
|
-
|
9
|
-
it { is_expected.to(permit_actions(%i[index show])) }
|
10
|
-
it { is_expected.to(forbid_actions(%i[create update delete])) }
|
11
|
-
end
|
12
|
-
|
13
|
-
context "being a user" do
|
14
|
-
let(:user) { FactoryBot.create(:user, roles: :user) }
|
15
|
-
|
16
|
-
it { is_expected.to(permit_actions(%i[create update])) }
|
17
|
-
end
|
18
|
-
|
19
|
-
context "being an admin" do
|
20
|
-
let(:user) { FactoryBot.create(:user, roles: :admin) }
|
21
|
-
|
22
|
-
it { is_expected.to(permit_actions(%i[create update delete])) }
|
23
|
-
end
|
24
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
RSpec.describe("ArticleCategory Query テスト") do
|
2
|
-
describe "ArticleCategory データを取得する" do
|
3
|
-
let!(:article_category) { FactoryBot.create(:article_category) }
|
4
|
-
|
5
|
-
let(:query) do
|
6
|
-
data_id = Base64.encode64("ArticleCategory:#{article_category.id}")
|
7
|
-
%(query {
|
8
|
-
articleCategory(id: \"#{data_id}\") {
|
9
|
-
id
|
10
|
-
name
|
11
|
-
tags
|
12
|
-
isDeleted
|
13
|
-
}
|
14
|
-
}
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
subject(:result) do
|
19
|
-
SoulsApiSchema.execute(query).as_json
|
20
|
-
end
|
21
|
-
|
22
|
-
it "return ArticleCategory Data" do
|
23
|
-
begin
|
24
|
-
a1 = result.dig("data", "articleCategory")
|
25
|
-
raise unless a1.present?
|
26
|
-
rescue StandardError
|
27
|
-
raise(StandardError, result)
|
28
|
-
end
|
29
|
-
expect(a1).to(
|
30
|
-
include(
|
31
|
-
"id" => be_a(String),
|
32
|
-
"name" => be_a(String),
|
33
|
-
"tags" => be_all(String),
|
34
|
-
"isDeleted" => be_in([true, false])
|
35
|
-
)
|
36
|
-
)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
RSpec.describe("Article Query テスト") do
|
2
|
-
describe "Article データを取得する" do
|
3
|
-
let(:user) { FactoryBot.create(:user) }
|
4
|
-
let(:article_category) { FactoryBot.create(:article_category) }
|
5
|
-
let(:article) { FactoryBot.create(:article, user_id: user.id, article_category_id: article_category.id) }
|
6
|
-
|
7
|
-
let(:query) do
|
8
|
-
data_id = Base64.encode64("Article:#{article.id}")
|
9
|
-
%(query {
|
10
|
-
article(id: \"#{data_id}\") {
|
11
|
-
id
|
12
|
-
title
|
13
|
-
body
|
14
|
-
thumnailUrl
|
15
|
-
publicDate
|
16
|
-
isPublic
|
17
|
-
justCreated
|
18
|
-
slag
|
19
|
-
tags
|
20
|
-
isDeleted
|
21
|
-
}
|
22
|
-
}
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
subject(:result) do
|
27
|
-
SoulsApiSchema.execute(query).as_json
|
28
|
-
end
|
29
|
-
|
30
|
-
it "return Article Data" do
|
31
|
-
begin
|
32
|
-
a1 = result.dig("data", "article")
|
33
|
-
raise unless a1.present?
|
34
|
-
rescue StandardError
|
35
|
-
raise(StandardError, result)
|
36
|
-
end
|
37
|
-
expect(a1).to(
|
38
|
-
include(
|
39
|
-
"id" => be_a(String),
|
40
|
-
"title" => be_a(String),
|
41
|
-
"body" => be_a(String),
|
42
|
-
"thumnailUrl" => be_a(String),
|
43
|
-
"publicDate" => be_a(String),
|
44
|
-
"isPublic" => be_in([true, false]),
|
45
|
-
"justCreated" => be_in([true, false]),
|
46
|
-
"slag" => be_a(String),
|
47
|
-
"tags" => be_all(String),
|
48
|
-
"isDeleted" => be_in([true, false])
|
49
|
-
)
|
50
|
-
)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
RSpec.describe("User Query テスト") do
|
2
|
-
describe "User データを取得する" do
|
3
|
-
let!(:user) { FactoryBot.create(:user) }
|
4
|
-
|
5
|
-
let(:query) do
|
6
|
-
data_id = Base64.encode64("User:#{user.id}")
|
7
|
-
%(query {
|
8
|
-
user(id: \"#{data_id}\") {
|
9
|
-
id
|
10
|
-
uid
|
11
|
-
username
|
12
|
-
screenName
|
13
|
-
lastName
|
14
|
-
firstName
|
15
|
-
lastNameKanji
|
16
|
-
firstNameKanji
|
17
|
-
lastNameKana
|
18
|
-
firstNameKana
|
19
|
-
email
|
20
|
-
tel
|
21
|
-
iconUrl
|
22
|
-
birthday
|
23
|
-
}
|
24
|
-
}
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
subject(:result) do
|
29
|
-
SoulsApiSchema.execute(query).as_json
|
30
|
-
end
|
31
|
-
|
32
|
-
it "return User Data" do
|
33
|
-
begin
|
34
|
-
a1 = result.dig("data", "user")
|
35
|
-
raise unless a1.present?
|
36
|
-
rescue StandardError
|
37
|
-
raise(StandardError, result)
|
38
|
-
end
|
39
|
-
expect(a1).to(
|
40
|
-
include(
|
41
|
-
"id" => be_a(String),
|
42
|
-
"uid" => be_a(String),
|
43
|
-
"username" => be_a(String),
|
44
|
-
"screenName" => be_a(String),
|
45
|
-
"lastName" => be_a(String),
|
46
|
-
"firstName" => be_a(String),
|
47
|
-
"lastNameKanji" => be_a(String),
|
48
|
-
"firstNameKanji" => be_a(String),
|
49
|
-
"lastNameKana" => be_a(String),
|
50
|
-
"firstNameKana" => be_a(String),
|
51
|
-
"email" => be_a(String),
|
52
|
-
"tel" => be_a(String),
|
53
|
-
"iconUrl" => be_a(String),
|
54
|
-
"birthday" => be_a(String)
|
55
|
-
)
|
56
|
-
)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
RSpec.describe("ArticleCategorySearch Resolver テスト") do
|
2
|
-
describe "削除フラグ false の ArticleCategory を返却する" do
|
3
|
-
let!(:article_category) { FactoryBot.create(:article_category) }
|
4
|
-
|
5
|
-
let(:query) do
|
6
|
-
%(query {
|
7
|
-
articleCategorySearch(filter: {
|
8
|
-
isDeleted: false
|
9
|
-
}) {
|
10
|
-
edges {
|
11
|
-
cursor
|
12
|
-
node {
|
13
|
-
id
|
14
|
-
name
|
15
|
-
tags
|
16
|
-
isDeleted
|
17
|
-
}
|
18
|
-
}
|
19
|
-
nodes {
|
20
|
-
id
|
21
|
-
}
|
22
|
-
pageInfo {
|
23
|
-
endCursor
|
24
|
-
hasNextPage
|
25
|
-
startCursor
|
26
|
-
hasPreviousPage
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
subject(:result) do
|
34
|
-
SoulsApiSchema.execute(query).as_json
|
35
|
-
end
|
36
|
-
|
37
|
-
it "return ArticleCategory Data" do
|
38
|
-
begin
|
39
|
-
a1 = result.dig("data", "articleCategorySearch", "edges")[0]["node"]
|
40
|
-
raise unless a1.present?
|
41
|
-
rescue StandardError
|
42
|
-
raise(StandardError, result)
|
43
|
-
end
|
44
|
-
expect(a1).to(
|
45
|
-
include(
|
46
|
-
"id" => be_a(String),
|
47
|
-
"name" => be_a(String),
|
48
|
-
"tags" => be_all(String),
|
49
|
-
"isDeleted" => be_in([true, false])
|
50
|
-
)
|
51
|
-
)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
RSpec.describe("ArticleSearch Resolver テスト") do
|
2
|
-
describe "削除フラグ false の Article を返却する" do
|
3
|
-
let(:user) { FactoryBot.create(:user) }
|
4
|
-
let(:article_category) { FactoryBot.create(:article_category) }
|
5
|
-
let!(:article) { FactoryBot.create(:article, user_id: user.id, article_category_id: article_category.id) }
|
6
|
-
|
7
|
-
let(:query) do
|
8
|
-
%(query {
|
9
|
-
articleSearch(filter: {
|
10
|
-
isDeleted: false
|
11
|
-
}) {
|
12
|
-
edges {
|
13
|
-
cursor
|
14
|
-
node {
|
15
|
-
id
|
16
|
-
title
|
17
|
-
body
|
18
|
-
thumnailUrl
|
19
|
-
publicDate
|
20
|
-
isPublic
|
21
|
-
justCreated
|
22
|
-
slag
|
23
|
-
tags
|
24
|
-
isDeleted
|
25
|
-
}
|
26
|
-
}
|
27
|
-
nodes {
|
28
|
-
id
|
29
|
-
}
|
30
|
-
pageInfo {
|
31
|
-
endCursor
|
32
|
-
hasNextPage
|
33
|
-
startCursor
|
34
|
-
hasPreviousPage
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
subject(:result) do
|
42
|
-
SoulsApiSchema.execute(query).as_json
|
43
|
-
end
|
44
|
-
|
45
|
-
it "return Article Data" do
|
46
|
-
begin
|
47
|
-
a1 = result.dig("data", "articleSearch", "edges")[0]["node"]
|
48
|
-
raise unless a1.present?
|
49
|
-
rescue StandardError
|
50
|
-
raise(StandardError, result)
|
51
|
-
end
|
52
|
-
expect(a1).to(
|
53
|
-
include(
|
54
|
-
"id" => be_a(String),
|
55
|
-
"title" => be_a(String),
|
56
|
-
"body" => be_a(String),
|
57
|
-
"thumnailUrl" => be_a(String),
|
58
|
-
"publicDate" => be_a(String),
|
59
|
-
"isPublic" => be_in([true, false]),
|
60
|
-
"justCreated" => be_in([true, false]),
|
61
|
-
"slag" => be_a(String),
|
62
|
-
"tags" => be_all(String),
|
63
|
-
"isDeleted" => be_in([true, false])
|
64
|
-
)
|
65
|
-
)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
RSpec.describe("UserSearch Resolver テスト") do
|
2
|
-
describe "削除フラグ false の User を返却する" do
|
3
|
-
let!(:user) { FactoryBot.create(:user) }
|
4
|
-
|
5
|
-
let(:query) do
|
6
|
-
%(query {
|
7
|
-
userSearch(filter: {
|
8
|
-
isDeleted: false
|
9
|
-
}) {
|
10
|
-
edges {
|
11
|
-
cursor
|
12
|
-
node {
|
13
|
-
id
|
14
|
-
uid
|
15
|
-
username
|
16
|
-
screenName
|
17
|
-
lastName
|
18
|
-
firstName
|
19
|
-
lastNameKanji
|
20
|
-
firstNameKanji
|
21
|
-
lastNameKana
|
22
|
-
firstNameKana
|
23
|
-
email
|
24
|
-
tel
|
25
|
-
iconUrl
|
26
|
-
birthday
|
27
|
-
}
|
28
|
-
}
|
29
|
-
nodes {
|
30
|
-
id
|
31
|
-
}
|
32
|
-
pageInfo {
|
33
|
-
endCursor
|
34
|
-
hasNextPage
|
35
|
-
startCursor
|
36
|
-
hasPreviousPage
|
37
|
-
}
|
38
|
-
}
|
39
|
-
}
|
40
|
-
)
|
41
|
-
end
|
42
|
-
|
43
|
-
subject(:result) do
|
44
|
-
SoulsApiSchema.execute(query).as_json
|
45
|
-
end
|
46
|
-
|
47
|
-
it "return User Data" do
|
48
|
-
begin
|
49
|
-
a1 = result.dig("data", "userSearch", "edges")[0]["node"]
|
50
|
-
raise unless a1.present?
|
51
|
-
rescue StandardError
|
52
|
-
raise(StandardError, result)
|
53
|
-
end
|
54
|
-
expect(a1).to(
|
55
|
-
include(
|
56
|
-
"id" => be_a(String),
|
57
|
-
"uid" => be_a(String),
|
58
|
-
"username" => be_a(String),
|
59
|
-
"screenName" => be_a(String),
|
60
|
-
"lastName" => be_a(String),
|
61
|
-
"firstName" => be_a(String),
|
62
|
-
"lastNameKanji" => be_a(String),
|
63
|
-
"firstNameKanji" => be_a(String),
|
64
|
-
"lastNameKana" => be_a(String),
|
65
|
-
"firstNameKana" => be_a(String),
|
66
|
-
"email" => be_a(String),
|
67
|
-
"tel" => be_a(String),
|
68
|
-
"iconUrl" => be_a(String),
|
69
|
-
"birthday" => be_a(String)
|
70
|
-
)
|
71
|
-
)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,110 +0,0 @@
|
|
1
|
-
ENV["RACK_ENV"] = "test"
|
2
|
-
require "./app"
|
3
|
-
require "rspec"
|
4
|
-
# require "test/unit"
|
5
|
-
require "rack/test"
|
6
|
-
require "database_cleaner"
|
7
|
-
require "capybara/rspec"
|
8
|
-
require "webmock/rspec"
|
9
|
-
require "pundit/matchers"
|
10
|
-
|
11
|
-
if ENV["RACK_ENV"] == "production"
|
12
|
-
abort("The Souls environment is running in production mode!")
|
13
|
-
end
|
14
|
-
|
15
|
-
WebMock.disable_net_connect!(allow_localhost: true)
|
16
|
-
|
17
|
-
begin
|
18
|
-
ActiveRecord::Migration.maintain_test_schema!
|
19
|
-
rescue ActiveRecord::PendingMigrationError => e
|
20
|
-
puts e.to_s.strip
|
21
|
-
exit 1
|
22
|
-
end
|
23
|
-
|
24
|
-
def app
|
25
|
-
SoulsApi
|
26
|
-
end
|
27
|
-
|
28
|
-
Pundit::Matchers.configure do |config|
|
29
|
-
# config.user_alias = :user_role
|
30
|
-
end
|
31
|
-
|
32
|
-
RSpec.configure do |config|
|
33
|
-
config.order = :random
|
34
|
-
|
35
|
-
config.include Capybara::DSL
|
36
|
-
config.expect_with :rspec do |expectations|
|
37
|
-
# config.filter_run_excluding skip: true
|
38
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
39
|
-
end
|
40
|
-
|
41
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
42
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
43
|
-
config.mock_with :rspec do |mocks|
|
44
|
-
mocks.verify_partial_doubles = true
|
45
|
-
end
|
46
|
-
|
47
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
48
|
-
config.include FactoryBot::Syntax::Methods
|
49
|
-
config.include Rack::Test::Methods
|
50
|
-
|
51
|
-
config.before(:suite) do
|
52
|
-
FactoryBot.find_definitions
|
53
|
-
DatabaseCleaner.clean_with(:truncation)
|
54
|
-
end
|
55
|
-
|
56
|
-
config.before(:each) do |_example|
|
57
|
-
DatabaseCleaner.strategy = :transaction
|
58
|
-
DatabaseCleaner.start
|
59
|
-
end
|
60
|
-
|
61
|
-
config.append_after(:each) { |_example| DatabaseCleaner.clean }
|
62
|
-
config.filter_run_excluding long: true
|
63
|
-
config.filter_run_excluding uses_external_service: true
|
64
|
-
end
|
65
|
-
|
66
|
-
class ActiveRecord::Base
|
67
|
-
mattr_accessor :shared_connection
|
68
|
-
@@shared_connection = nil
|
69
|
-
|
70
|
-
def self.connection
|
71
|
-
@@shared_connection || retrieve_connection
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
76
|
-
def get_global_key class_name, id
|
77
|
-
Base64.strict_encode64("#{class_name}:#{id}")
|
78
|
-
end
|
79
|
-
|
80
|
-
class ActiveSupport::TestCase
|
81
|
-
setup :begin_gc_deferment
|
82
|
-
teardown :reconsider_gc_deferment
|
83
|
-
teardown :scrub_instance_variables
|
84
|
-
|
85
|
-
@@reserved_ivars = %w[@_implementation @_result @_proxy @_assigns_hash_proxy @_backtrace]
|
86
|
-
DEFERRED_GC_THRESHOLD = (ENV["DEFER_GC"] || 1.0).to_f
|
87
|
-
|
88
|
-
@@last_gc_run = Time.now
|
89
|
-
|
90
|
-
def begin_gc_deferment
|
91
|
-
GC.disable if DEFERRED_GC_THRESHOLD > 0
|
92
|
-
end
|
93
|
-
|
94
|
-
def reconsider_gc_deferment
|
95
|
-
if DEFERRED_GC_THRESHOLD > 0 && Time.now - @@last_gc_run >= DEFERRED_GC_THRESHOLD
|
96
|
-
|
97
|
-
GC.enable
|
98
|
-
GC.start
|
99
|
-
GC.disable
|
100
|
-
|
101
|
-
@@last_gc_run = Time.now
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def scrub_instance_variables
|
106
|
-
(instance_variables - @@reserved_ivars).each do |ivar|
|
107
|
-
instance_variable_set(ivar, nil)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|