souls 0.24.1 → 0.24.5
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 +181 -123
- data/lib/souls/gcloud/iam.rb +30 -16
- data/lib/souls/init.rb +22 -16
- data/lib/souls/version.rb +1 -1
- metadata +16 -193
- data/.gitignore +0 -15
- data/.irbrc +0 -2
- 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/api_v0.0.1.tar.gz +0 -0
- data/apps/api/.env.sample +0 -7
- data/apps/api/.gitignore +0 -32
- data/apps/api/.irbrc +0 -1
- 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 -25
- data/apps/api/spec/policies/article_policy_spec.rb +0 -25
- data/apps/api/spec/policies/user_policy_spec.rb +0 -5
- 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 -1
- 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
- data/souls_api2.tar.gz +0 -0
data/apps/api/db/seeds.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require "./app"
|
2
|
-
|
3
|
-
Dir[File.expand_path("#{Rack::Directory.new('').root}/spec/factories/*.rb")]
|
4
|
-
.each { |file| require file }
|
5
|
-
|
6
|
-
def create_user
|
7
|
-
gimei = Gimei.name
|
8
|
-
user =
|
9
|
-
FactoryBot.create(
|
10
|
-
:user,
|
11
|
-
username: gimei.kanji,
|
12
|
-
last_name: gimei.last.hiragana,
|
13
|
-
first_name: gimei.first.hiragana,
|
14
|
-
last_name_kanji: gimei.last.kanji,
|
15
|
-
first_name_kanji: gimei.first.kanji,
|
16
|
-
last_name_kana: gimei.last.katakana,
|
17
|
-
first_name_kana: gimei.first.katakana,
|
18
|
-
gender: gimei.gender
|
19
|
-
)
|
20
|
-
puts(user.to_json)
|
21
|
-
return user.id if user
|
22
|
-
end
|
23
|
-
|
24
|
-
def create_article_category
|
25
|
-
article_category = FactoryBot.create(:article_category)
|
26
|
-
"Article Category Created!\n #{article_category.to_json}" if article_category
|
27
|
-
end
|
28
|
-
|
29
|
-
def create_article(user_id, article_category_id)
|
30
|
-
article = FactoryBot.create(:article, user_id: user_id, article_category_id: article_category_id)
|
31
|
-
"Article Created!\n #{article.to_json}" if article
|
32
|
-
end
|
33
|
-
|
34
|
-
%w[お知らせ 特集 レシピ].each do |name|
|
35
|
-
puts ArticleCategory.create(name: name).to_json
|
36
|
-
end
|
37
|
-
|
38
|
-
10.times { create_user }
|
39
|
-
|
40
|
-
100.times do |_i|
|
41
|
-
user_id = User.find(rand(5).to_i + 1).id
|
42
|
-
article_category_id = ArticleCategory.find(rand(3).to_i + 1).id
|
43
|
-
puts create_article(user_id, article_category_id)
|
44
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
name: Delivery
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- master
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
build:
|
10
|
-
|
11
|
-
runs-on: ubuntu-20.04
|
12
|
-
|
13
|
-
services:
|
14
|
-
db:
|
15
|
-
image: postgres:13
|
16
|
-
ports: ["5433:5432"]
|
17
|
-
env:
|
18
|
-
POSTGRES_PASSWORD: postgres
|
19
|
-
options: >-
|
20
|
-
--health-cmd pg_isready
|
21
|
-
--health-interval 10s
|
22
|
-
--health-timeout 5s
|
23
|
-
--health-retries 5
|
24
|
-
|
25
|
-
steps:
|
26
|
-
- uses: actions/checkout@v2
|
27
|
-
- name: Set up Ruby 3.0
|
28
|
-
uses: actions/setup-ruby@v1
|
29
|
-
with:
|
30
|
-
ruby-version: 3.0
|
31
|
-
- name: Build and test with Rake
|
32
|
-
env:
|
33
|
-
PGHOST: 127.0.0.1
|
34
|
-
PGUSER: postgres
|
35
|
-
RACK_ENV: test
|
36
|
-
run: |
|
37
|
-
sudo apt-get -yqq install libpq-dev
|
38
|
-
gem install bundler
|
39
|
-
bundle install --jobs 4 --retry 3
|
40
|
-
bundle exec rake db:create RACK_ENV=test
|
41
|
-
bundle exec rake db:migrate RACK_ENV=test
|
42
|
-
bundle exec rspec
|
43
|
-
|
44
|
-
- name: Checkout the repository
|
45
|
-
uses: actions/checkout@v2
|
46
|
-
|
47
|
-
- name: GCP Authenticate
|
48
|
-
uses: google-github-actions/setup-gcloud@master
|
49
|
-
with:
|
50
|
-
version: "323.0.0"
|
51
|
-
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
52
|
-
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
53
|
-
export_default_credentials: true
|
54
|
-
|
55
|
-
- name: Configure Docker
|
56
|
-
run: gcloud auth configure-docker --quiet
|
57
|
-
|
58
|
-
- name: Build Docker container
|
59
|
-
run: docker build . -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{secrets.APP_NAME}}
|
60
|
-
|
61
|
-
- name: Push to Container Resistory
|
62
|
-
run: docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{secrets.APP_NAME}}
|
63
|
-
|
64
|
-
- name: Deploy to Cloud Run
|
65
|
-
run: |
|
66
|
-
gcloud run deploy ${{ secrets.APP_NAME }} \
|
67
|
-
--image=gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{secrets.APP_NAME}} \
|
68
|
-
--memory=4Gi \
|
69
|
-
--region=asia-northeast1 \
|
70
|
-
--allow-unauthenticated \
|
71
|
-
--platform=managed \
|
72
|
-
--quiet \
|
73
|
-
--concurrency=80 \
|
74
|
-
--port=8080 \
|
75
|
-
--set-cloudsql-instances=${{ secrets.GCLOUDSQL_INSTANCE }} \
|
76
|
-
--set-env-vars="DB_USER=${{ secrets.DB_USER }}" \
|
77
|
-
--set-env-vars="DB_PW=${{ secrets.DB_PW }}" \
|
78
|
-
--set-env-vars="DB_HOST=${{ secrets.DB_HOST }}" \
|
79
|
-
--set-env-vars="TZ=${{ secrets.TZ }}" \
|
80
|
-
--set-env-vars="SLACK=${{ secrets.SLACK }}" \
|
81
|
-
--set-env-vars="SECRET_KEY_BASE=${{ secrets.SECRET_KEY_BASE }}" \
|
data/apps/api/log/.keep
DELETED
File without changes
|
@@ -1,17 +0,0 @@
|
|
1
|
-
FactoryBot.define do
|
2
|
-
factory :article do
|
3
|
-
association :user, factory: :user
|
4
|
-
title { Faker::Book.unique.title }
|
5
|
-
body { Faker::Quote.matz }
|
6
|
-
thumnail_url { Faker::Internet.url }
|
7
|
-
public_date { Time.now }
|
8
|
-
association :article_category, factory: :article_category
|
9
|
-
is_public { false }
|
10
|
-
just_created { false }
|
11
|
-
slag { Faker::Internet.password(min_length: 16) }
|
12
|
-
tags { %w[tag1 tag2 tag3] }
|
13
|
-
is_deleted { false }
|
14
|
-
created_at { Time.now }
|
15
|
-
updated_at { Time.now }
|
16
|
-
end
|
17
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "gimei"
|
2
|
-
FactoryBot.define do
|
3
|
-
factory :user do
|
4
|
-
uid { Faker::Internet.password }
|
5
|
-
username { Gimei.kanji }
|
6
|
-
screen_name { Faker::Internet.unique.username }
|
7
|
-
last_name { Gimei.last.hiragana }
|
8
|
-
first_name { Gimei.first.hiragana }
|
9
|
-
last_name_kanji { Gimei.last.kanji }
|
10
|
-
first_name_kanji { Gimei.first.kanji }
|
11
|
-
last_name_kana { Gimei.last.katakana }
|
12
|
-
first_name_kana { Gimei.last.katakana }
|
13
|
-
email { Faker::Internet.unique.email }
|
14
|
-
tel { Faker::PhoneNumber.subscriber_number(length: 10) }
|
15
|
-
icon_url { "https://picsum.photos/200" }
|
16
|
-
birthday { Faker::Date.birthday(min_age: 18, max_age: 65) }
|
17
|
-
gender { Gimei.male }
|
18
|
-
lang { "ja" }
|
19
|
-
category { "user" }
|
20
|
-
roles_mask { :normal }
|
21
|
-
is_deleted { false }
|
22
|
-
end
|
23
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
RSpec.describe("ArticleCategory Mutation テスト") do
|
2
|
-
describe "ArticleCategory データを登録する" do
|
3
|
-
let(:article_category) { FactoryBot.attributes_for(:article_category) }
|
4
|
-
|
5
|
-
let(:mutation) do
|
6
|
-
%(mutation {
|
7
|
-
createArticleCategory(input: {
|
8
|
-
name: "#{article_category[:name]}"
|
9
|
-
tags: #{article_category[:tags]}
|
10
|
-
isDeleted: #{article_category[:is_deleted]}
|
11
|
-
}) {
|
12
|
-
articleCategoryEdge {
|
13
|
-
node {
|
14
|
-
id
|
15
|
-
name
|
16
|
-
tags
|
17
|
-
isDeleted
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
subject(:result) do
|
26
|
-
SoulsApiSchema.execute(mutation).as_json
|
27
|
-
end
|
28
|
-
|
29
|
-
it "return ArticleCategory Data" do
|
30
|
-
begin
|
31
|
-
a1 = result.dig("data", "createArticleCategory", "articleCategoryEdge", "node")
|
32
|
-
raise unless a1.present?
|
33
|
-
rescue StandardError
|
34
|
-
raise(StandardError, result)
|
35
|
-
end
|
36
|
-
expect(a1).to(
|
37
|
-
include(
|
38
|
-
"id" => be_a(String),
|
39
|
-
"name" => be_a(String),
|
40
|
-
"tags" => be_all(String),
|
41
|
-
"isDeleted" => be_in([true, false])
|
42
|
-
)
|
43
|
-
)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
RSpec.describe("Article Mutation テスト") do
|
2
|
-
describe "Article データを登録する" do
|
3
|
-
let(:user) { FactoryBot.create(:user) }
|
4
|
-
let(:article_category) { FactoryBot.create(:article_category) }
|
5
|
-
let(:article) do
|
6
|
-
FactoryBot.attributes_for(:article, article_category_id: get_global_key("ArticleCategory", article_category.id))
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:mutation) do
|
10
|
-
%(mutation {
|
11
|
-
createArticle(input: {
|
12
|
-
title: "#{article[:title]}"
|
13
|
-
body: "#{article[:body]}"
|
14
|
-
thumnailUrl: "#{article[:thumnail_url]}"
|
15
|
-
publicDate: "#{article[:public_date]}"
|
16
|
-
articleCategoryId: "#{article[:article_category_id]}"
|
17
|
-
isPublic: #{article[:is_public]}
|
18
|
-
justCreated: #{article[:just_created]}
|
19
|
-
slag: "#{article[:slag]}"
|
20
|
-
tags: #{article[:tags]}
|
21
|
-
isDeleted: #{article[:is_deleted]}
|
22
|
-
}) {
|
23
|
-
articleEdge {
|
24
|
-
node {
|
25
|
-
id
|
26
|
-
title
|
27
|
-
body
|
28
|
-
thumnailUrl
|
29
|
-
publicDate
|
30
|
-
isPublic
|
31
|
-
justCreated
|
32
|
-
slag
|
33
|
-
tags
|
34
|
-
isDeleted
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
}
|
39
|
-
)
|
40
|
-
end
|
41
|
-
|
42
|
-
subject(:result) do
|
43
|
-
context = { user: user }
|
44
|
-
SoulsApiSchema.execute(mutation, context: context).as_json
|
45
|
-
end
|
46
|
-
|
47
|
-
it "return Article Data" do
|
48
|
-
begin
|
49
|
-
a1 = result.dig("data", "createArticle", "articleEdge", "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
|
-
"title" => be_a(String),
|
58
|
-
"body" => be_a(String),
|
59
|
-
"thumnailUrl" => be_a(String),
|
60
|
-
"publicDate" => be_a(String),
|
61
|
-
"isPublic" => be_in([true, false]),
|
62
|
-
"justCreated" => be_in([true, false]),
|
63
|
-
"slag" => be_a(String),
|
64
|
-
"tags" => be_all(String),
|
65
|
-
"isDeleted" => be_in([true, false])
|
66
|
-
)
|
67
|
-
)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
RSpec.describe("User Mutation テスト") do
|
2
|
-
describe "User データを登録する" do
|
3
|
-
let(:user) { FactoryBot.attributes_for(:user) }
|
4
|
-
|
5
|
-
let(:mutation) do
|
6
|
-
%(mutation {
|
7
|
-
createUser(input: {
|
8
|
-
uid: "#{user[:uid]}"
|
9
|
-
username: "#{user[:username]}"
|
10
|
-
screenName: "#{user[:screen_name]}"
|
11
|
-
lastName: "#{user[:last_name]}"
|
12
|
-
firstName: "#{user[:first_name]}"
|
13
|
-
lastNameKanji: "#{user[:last_name_kanji]}"
|
14
|
-
firstNameKanji: "#{user[:first_name_kanji]}"
|
15
|
-
lastNameKana: "#{user[:last_name_kana]}"
|
16
|
-
firstNameKana: "#{user[:first_name_kana]}"
|
17
|
-
email: "#{user[:email]}"
|
18
|
-
tel: "#{user[:tel]}"
|
19
|
-
iconUrl: "#{user[:icon_url]}"
|
20
|
-
birthday: "#{user[:birthday]}"
|
21
|
-
}) {
|
22
|
-
userEdge {
|
23
|
-
node {
|
24
|
-
id
|
25
|
-
uid
|
26
|
-
username
|
27
|
-
screenName
|
28
|
-
lastName
|
29
|
-
firstName
|
30
|
-
lastNameKanji
|
31
|
-
firstNameKanji
|
32
|
-
lastNameKana
|
33
|
-
firstNameKana
|
34
|
-
email
|
35
|
-
tel
|
36
|
-
iconUrl
|
37
|
-
birthday
|
38
|
-
}
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
)
|
43
|
-
end
|
44
|
-
|
45
|
-
subject(:result) do
|
46
|
-
SoulsApiSchema.execute(mutation).as_json
|
47
|
-
end
|
48
|
-
|
49
|
-
it "return User Data" do
|
50
|
-
begin
|
51
|
-
a1 = result.dig("data", "createUser", "userEdge", "node")
|
52
|
-
raise unless a1.present?
|
53
|
-
rescue StandardError
|
54
|
-
raise(StandardError, result)
|
55
|
-
end
|
56
|
-
expect(a1).to(
|
57
|
-
include(
|
58
|
-
"id" => be_a(String),
|
59
|
-
"uid" => be_a(String),
|
60
|
-
"username" => be_a(String),
|
61
|
-
"screenName" => be_a(String),
|
62
|
-
"lastName" => be_a(String),
|
63
|
-
"firstName" => be_a(String),
|
64
|
-
"lastNameKanji" => be_a(String),
|
65
|
-
"firstNameKanji" => be_a(String),
|
66
|
-
"lastNameKana" => be_a(String),
|
67
|
-
"firstNameKana" => be_a(String),
|
68
|
-
"email" => be_a(String),
|
69
|
-
"tel" => be_a(String),
|
70
|
-
"iconUrl" => be_a(String),
|
71
|
-
"birthday" => be_a(String)
|
72
|
-
)
|
73
|
-
)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
describe ArticleCategoryPolicy do
|
2
|
-
subject { described_class.new(user, article_category) }
|
3
|
-
|
4
|
-
let(:article_category) { FactoryBot.create(:article_category) }
|
5
|
-
|
6
|
-
context "being a visitor" do
|
7
|
-
let(:user) { FactoryBot.create(:user) }
|
8
|
-
|
9
|
-
it { is_expected.to(permit_action(:index)) }
|
10
|
-
it { is_expected.to(permit_action(:show)) }
|
11
|
-
it { is_expected.to(forbid_actions(%i[create update delete])) }
|
12
|
-
end
|
13
|
-
|
14
|
-
context "being a staff" do
|
15
|
-
let(:user) { FactoryBot.create(:user, roles_mask: 3) }
|
16
|
-
|
17
|
-
it { is_expected.to(permit_actions(%i[create update])) }
|
18
|
-
end
|
19
|
-
|
20
|
-
context "being an administrator" do
|
21
|
-
let(:user) { FactoryBot.create(:user, roles_mask: 4) }
|
22
|
-
|
23
|
-
it { is_expected.to(permit_actions(%i[create update delete])) }
|
24
|
-
end
|
25
|
-
end
|
@@ -1,25 +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 visitor" do
|
7
|
-
let(:user) { FactoryBot.create(:user) }
|
8
|
-
|
9
|
-
it { is_expected.to(permit_action(:index)) }
|
10
|
-
it { is_expected.to(permit_action(:show)) }
|
11
|
-
it { is_expected.to(forbid_actions(%i[create update delete])) }
|
12
|
-
end
|
13
|
-
|
14
|
-
context "being a staff" do
|
15
|
-
let(:user) { FactoryBot.create(:user, roles_mask: 3) }
|
16
|
-
|
17
|
-
it { is_expected.to(permit_actions(%i[create update])) }
|
18
|
-
end
|
19
|
-
|
20
|
-
context "being an administrator" do
|
21
|
-
let(:user) { FactoryBot.create(:user, roles_mask: 4) }
|
22
|
-
|
23
|
-
it { is_expected.to(permit_actions(%i[create update delete])) }
|
24
|
-
end
|
25
|
-
end
|