tests_doc 0.0.3 → 0.0.4
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/.ruby-version +1 -1
- data/examples/rails-4.2.5/Gemfile +0 -1
- data/examples/rails-4.2.5/Gemfile.lock +4 -4
- data/examples/rails-4.2.5/spec/requests/posts_spec.rb +4 -1
- data/examples/rails-4.2.5/spec/requests/users_spec.rb +3 -1
- data/examples/rails-4.2.5/tests-doc/README.md +1 -1
- data/examples/rails-4.2.5/tests-doc/api/posts.md +1 -16
- data/examples/rails-4.2.5/tests-doc/api/posts/@id.md +6 -6
- data/examples/rails-4.2.5/tests-doc/api/posts@with-filter.md +1 -16
- data/examples/rails-4.2.5/tests-doc/api/users.md +1 -16
- data/examples/rails-5.2.3/.gitignore +31 -0
- data/examples/rails-5.2.3/.ruby-version +1 -0
- data/examples/rails-5.2.3/Gemfile +49 -0
- data/examples/rails-5.2.3/Gemfile.lock +235 -0
- data/examples/rails-5.2.3/README.md +24 -0
- data/examples/rails-5.2.3/Rakefile +6 -0
- data/examples/rails-5.2.3/app/assets/config/manifest.js +3 -0
- data/examples/rails-5.2.3/app/assets/images/.keep +0 -0
- data/examples/rails-5.2.3/app/assets/javascripts/application.js +16 -0
- data/examples/rails-5.2.3/app/assets/javascripts/cable.js +13 -0
- data/examples/rails-5.2.3/app/assets/javascripts/channels/.keep +0 -0
- data/examples/rails-5.2.3/app/assets/javascripts/posts.js +2 -0
- data/examples/rails-5.2.3/app/assets/javascripts/users.js +2 -0
- data/examples/rails-5.2.3/app/assets/stylesheets/application.css +15 -0
- data/examples/rails-5.2.3/app/assets/stylesheets/posts.scss +3 -0
- data/examples/rails-5.2.3/app/assets/stylesheets/users.scss +3 -0
- data/examples/rails-5.2.3/app/channels/application_cable/channel.rb +4 -0
- data/examples/rails-5.2.3/app/channels/application_cable/connection.rb +4 -0
- data/examples/rails-5.2.3/app/controllers/application_controller.rb +2 -0
- data/examples/rails-5.2.3/app/controllers/concerns/.keep +0 -0
- data/examples/rails-5.2.3/app/controllers/posts_controller.rb +61 -0
- data/examples/rails-5.2.3/app/controllers/users_controller.rb +59 -0
- data/examples/rails-5.2.3/app/helpers/application_helper.rb +2 -0
- data/examples/rails-5.2.3/app/helpers/posts_helper.rb +2 -0
- data/examples/rails-5.2.3/app/helpers/users_helper.rb +2 -0
- data/examples/rails-5.2.3/app/jobs/application_job.rb +2 -0
- data/examples/rails-5.2.3/app/mailers/application_mailer.rb +4 -0
- data/examples/rails-5.2.3/app/models/application_record.rb +3 -0
- data/examples/rails-5.2.3/app/models/concerns/.keep +0 -0
- data/examples/rails-5.2.3/app/models/post.rb +3 -0
- data/examples/rails-5.2.3/app/models/user.rb +2 -0
- data/examples/rails-5.2.3/app/views/layouts/application.html.erb +15 -0
- data/examples/rails-5.2.3/app/views/layouts/mailer.html.erb +13 -0
- data/examples/rails-5.2.3/app/views/layouts/mailer.text.erb +1 -0
- data/examples/rails-5.2.3/bin/bundle +3 -0
- data/examples/rails-5.2.3/bin/rails +9 -0
- data/examples/rails-5.2.3/bin/rake +9 -0
- data/examples/rails-5.2.3/bin/setup +36 -0
- data/examples/rails-5.2.3/bin/spring +17 -0
- data/examples/rails-5.2.3/bin/update +31 -0
- data/examples/rails-5.2.3/bin/yarn +11 -0
- data/examples/rails-5.2.3/config.ru +5 -0
- data/examples/rails-5.2.3/config/application.rb +19 -0
- data/examples/rails-5.2.3/config/boot.rb +4 -0
- data/examples/rails-5.2.3/config/cable.yml +10 -0
- data/examples/rails-5.2.3/config/credentials.yml.enc +1 -0
- data/examples/rails-5.2.3/config/database.yml +25 -0
- data/examples/rails-5.2.3/config/environment.rb +5 -0
- data/examples/rails-5.2.3/config/environments/development.rb +61 -0
- data/examples/rails-5.2.3/config/environments/production.rb +94 -0
- data/examples/rails-5.2.3/config/environments/test.rb +46 -0
- data/examples/rails-5.2.3/config/initializers/application_controller_renderer.rb +8 -0
- data/examples/rails-5.2.3/config/initializers/assets.rb +14 -0
- data/examples/rails-5.2.3/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails-5.2.3/config/initializers/content_security_policy.rb +25 -0
- data/examples/rails-5.2.3/config/initializers/cookies_serializer.rb +5 -0
- data/examples/rails-5.2.3/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/rails-5.2.3/config/initializers/inflections.rb +16 -0
- data/examples/rails-5.2.3/config/initializers/mime_types.rb +4 -0
- data/examples/rails-5.2.3/config/initializers/wrap_parameters.rb +14 -0
- data/examples/rails-5.2.3/config/locales/en.yml +33 -0
- data/examples/rails-5.2.3/config/puma.rb +34 -0
- data/examples/rails-5.2.3/config/routes.rb +6 -0
- data/examples/rails-5.2.3/config/spring.rb +6 -0
- data/examples/rails-5.2.3/config/storage.yml +34 -0
- data/examples/rails-5.2.3/db/migrate/20190618211257_create_users.rb +11 -0
- data/examples/rails-5.2.3/db/migrate/20190618211325_create_posts.rb +11 -0
- data/examples/rails-5.2.3/db/schema.rb +32 -0
- data/examples/rails-5.2.3/db/seeds.rb +7 -0
- data/examples/rails-5.2.3/lib/assets/.keep +0 -0
- data/examples/rails-5.2.3/lib/tasks/.keep +0 -0
- data/examples/rails-5.2.3/log/.keep +0 -0
- data/examples/rails-5.2.3/package.json +5 -0
- data/examples/rails-5.2.3/public/404.html +67 -0
- data/examples/rails-5.2.3/public/422.html +67 -0
- data/examples/rails-5.2.3/public/500.html +66 -0
- data/examples/rails-5.2.3/public/apple-touch-icon-precomposed.png +0 -0
- data/examples/rails-5.2.3/public/apple-touch-icon.png +0 -0
- data/examples/rails-5.2.3/public/favicon.ico +0 -0
- data/examples/rails-5.2.3/public/robots.txt +1 -0
- data/examples/rails-5.2.3/spec/rails_helper.rb +62 -0
- data/examples/rails-5.2.3/spec/requests/posts_spec.rb +33 -0
- data/examples/rails-5.2.3/spec/requests/users_spec.rb +24 -0
- data/examples/rails-5.2.3/spec/spec_helper.rb +89 -0
- data/examples/rails-5.2.3/storage/.keep +0 -0
- data/examples/rails-5.2.3/tests-doc/README.md +32 -0
- data/examples/rails-5.2.3/tests-doc/api/posts.md +24 -0
- data/examples/rails-5.2.3/tests-doc/api/posts/@id.md +29 -0
- data/examples/rails-5.2.3/tests-doc/api/posts@with-filter.md +25 -0
- data/examples/rails-5.2.3/tests-doc/api/users.md +24 -0
- data/examples/rails-5.2.3/tests-doc/api/users/@id/posts.md +24 -0
- data/examples/rails-5.2.3/tmp/.keep +0 -0
- data/examples/rails-5.2.3/vendor/.keep +0 -0
- data/lib/tests_doc/version.rb +1 -1
- data/tests_doc.gemspec +1 -1
- metadata +100 -7
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
test:
|
|
2
|
+
service: Disk
|
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
|
4
|
+
|
|
5
|
+
local:
|
|
6
|
+
service: Disk
|
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
|
8
|
+
|
|
9
|
+
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
|
10
|
+
# amazon:
|
|
11
|
+
# service: S3
|
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
|
14
|
+
# region: us-east-1
|
|
15
|
+
# bucket: your_own_bucket
|
|
16
|
+
|
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
|
18
|
+
# google:
|
|
19
|
+
# service: GCS
|
|
20
|
+
# project: your_project
|
|
21
|
+
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
|
22
|
+
# bucket: your_own_bucket
|
|
23
|
+
|
|
24
|
+
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
|
25
|
+
# microsoft:
|
|
26
|
+
# service: AzureStorage
|
|
27
|
+
# storage_account_name: your_account_name
|
|
28
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
|
29
|
+
# container: your_container_name
|
|
30
|
+
|
|
31
|
+
# mirror:
|
|
32
|
+
# service: Mirror
|
|
33
|
+
# primary: local
|
|
34
|
+
# mirrors: [ amazon, google, microsoft ]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
|
4
|
+
#
|
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
|
6
|
+
# database schema. If you need to create the application database on another
|
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
|
10
|
+
#
|
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
|
12
|
+
|
|
13
|
+
ActiveRecord::Schema.define(version: 2019_06_18_211325) do
|
|
14
|
+
|
|
15
|
+
create_table "posts", force: :cascade do |t|
|
|
16
|
+
t.string "title"
|
|
17
|
+
t.text "body"
|
|
18
|
+
t.integer "user_id"
|
|
19
|
+
t.datetime "created_at", null: false
|
|
20
|
+
t.datetime "updated_at", null: false
|
|
21
|
+
t.index ["user_id"], name: "index_posts_on_user_id"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
create_table "users", force: :cascade do |t|
|
|
25
|
+
t.string "first_name"
|
|
26
|
+
t.string "last_name"
|
|
27
|
+
t.string "email"
|
|
28
|
+
t.datetime "created_at", null: false
|
|
29
|
+
t.datetime "updated_at", null: false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
|
2
|
+
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
|
3
|
+
#
|
|
4
|
+
# Examples:
|
|
5
|
+
#
|
|
6
|
+
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
|
7
|
+
# Character.create(name: 'Luke', movie: movies.first)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/404.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/422.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/500.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
62
|
+
</div>
|
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
64
|
+
</div>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
require File.expand_path("../../config/environment", __FILE__)
|
|
6
|
+
require 'rspec/rails'
|
|
7
|
+
|
|
8
|
+
require 'tests_doc'
|
|
9
|
+
|
|
10
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
11
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
12
|
+
# run as spec files by default. This means that files in spec/support that end
|
|
13
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
14
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
|
15
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
|
16
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
17
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
|
18
|
+
|
|
19
|
+
# Checks for pending migrations before tests are run.
|
|
20
|
+
# If you are not using ActiveRecord, you can remove this line.
|
|
21
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
22
|
+
|
|
23
|
+
RSpec.configure do |config|
|
|
24
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
25
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
26
|
+
|
|
27
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
28
|
+
# examples within a transaction, remove the following line or assign false
|
|
29
|
+
# instead of true.
|
|
30
|
+
config.use_transactional_fixtures = true
|
|
31
|
+
|
|
32
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
|
33
|
+
# based on their file location, for example enabling you to call `get` and
|
|
34
|
+
# `post` in specs under `spec/controllers`.
|
|
35
|
+
#
|
|
36
|
+
# You can disable this behaviour by removing the line below, and instead
|
|
37
|
+
# explicitly tag your specs with their type, e.g.:
|
|
38
|
+
#
|
|
39
|
+
# RSpec.describe UsersController, :type => :controller do
|
|
40
|
+
# # ...
|
|
41
|
+
# end
|
|
42
|
+
#
|
|
43
|
+
# The different available types are documented in the features, such as in
|
|
44
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
|
45
|
+
config.infer_spec_type_from_file_location!
|
|
46
|
+
|
|
47
|
+
config.include ::TestsDoc::RecordSpecHelper, type: :request
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
TestsDoc.configure do |config|
|
|
52
|
+
config.changes_whitelist_regexes = [
|
|
53
|
+
/\"id\":.*\n/,
|
|
54
|
+
/_id\":.*\n/,
|
|
55
|
+
/_at\":.*\n/,
|
|
56
|
+
/.*_ids":\s\[\s*\w+\s*\]/
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
config.add_spec_file_number = true # default: true
|
|
60
|
+
config.add_index_timestamps = true # default: true
|
|
61
|
+
config.debug = true # default: false
|
|
62
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Posts", :type => :request do
|
|
4
|
+
describe "GET /posts" do
|
|
5
|
+
it "renders posts" do
|
|
6
|
+
recording_api_interaction do
|
|
7
|
+
get posts_path
|
|
8
|
+
expect(response.status).to be(200)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "renders posts with filter" do
|
|
13
|
+
recording_api_interaction do |options|
|
|
14
|
+
options.key = 'with-filter'
|
|
15
|
+
get posts_path(published: true)
|
|
16
|
+
expect(response.status).to be(200)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "GET /posts/:id" do
|
|
22
|
+
it "renders posts with id" do
|
|
23
|
+
User.create
|
|
24
|
+
Post.create(user_id: User.first.id)
|
|
25
|
+
|
|
26
|
+
recording_api_interaction do |options|
|
|
27
|
+
options.path = 'posts/@id'
|
|
28
|
+
get post_path(Post.first.id)
|
|
29
|
+
expect(response.status).to be(200)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Users", :type => :request do
|
|
4
|
+
describe "GET /users" do
|
|
5
|
+
it "renders users" do
|
|
6
|
+
recording_api_interaction do
|
|
7
|
+
get users_path
|
|
8
|
+
expect(response.status).to be(200)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "GET /users/:user_id/posts" do
|
|
14
|
+
it "renders posts" do
|
|
15
|
+
User.create
|
|
16
|
+
|
|
17
|
+
recording_api_interaction do |options|
|
|
18
|
+
options.path = 'users/@id/posts'
|
|
19
|
+
get user_posts_path(User.first.id)
|
|
20
|
+
expect(response.status).to be(200)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|