viniBaxter-spa-nested_has_many 2.0.0
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 +7 -0
- data/.DS_Store +0 -0
- data/.circleci/config.yml +29 -0
- data/.gitignore +4 -0
- data/.ruby-version +1 -0
- data/Appraisals +13 -0
- data/CHANGELOG.md +57 -0
- data/Gemfile +5 -0
- data/README.md +38 -0
- data/Rakefile +24 -0
- data/app/assets/javascripts/administrate-field-nested_has_many/application.js +1 -0
- data/app/assets/stylesheets/administrate-field-nested_has_many/application.css +3 -0
- data/app/assets/stylesheets/administrate-field-nested_has_many/base.scss +14 -0
- data/app/views/fields/nested_has_many/_fields.html.erb +9 -0
- data/app/views/fields/nested_has_many/_form.html.erb +23 -0
- data/app/views/fields/nested_has_many/_index.html.erb +19 -0
- data/app/views/fields/nested_has_many/_show.html.erb +9 -0
- data/app/views/fields/nested_has_many/_show_current.html.erb +44 -0
- data/app/views/fields/nested_has_many/_show_old.html.erb +36 -0
- data/bin/rails +13 -0
- data/config/i18n-tasks.yml +8 -0
- data/config/locales/administrate-field-nested_has_many.en.yml +7 -0
- data/config/locales/administrate-field-nested_has_many.ja.yml +7 -0
- data/config/locales/administrate-field-nested_has_many.pt.yml +7 -0
- data/config/locales/administrate-field-nested_has_many.ru.yml +7 -0
- data/gemfiles/administrate_0.10.gemfile +8 -0
- data/gemfiles/administrate_0.10.gemfile.lock +214 -0
- data/gemfiles/administrate_0.13.gemfile +8 -0
- data/gemfiles/administrate_0.13.gemfile.lock +207 -0
- data/gemfiles/administrate_master.gemfile +8 -0
- data/gemfiles/administrate_master.gemfile.lock +219 -0
- data/lib/viniBaxter/spa/nested_has_many.rb +90 -0
- data/spec/dummy/.gitignore +3 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +7 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +14 -0
- data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/admin/application_controller.rb +21 -0
- data/spec/dummy/app/controllers/admin/foo/students_controller.rb +21 -0
- data/spec/dummy/app/controllers/admin/schools_controller.rb +21 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/dashboards/foo/student_dashboard.rb +51 -0
- data/spec/dummy/app/dashboards/school_dashboard.rb +52 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/foo/student.rb +3 -0
- data/spec/dummy/app/models/school.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/update +31 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/config/application.rb +18 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +12 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +53 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +34 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/db/migrate/20180907104642_create_schools.rb +9 -0
- data/spec/dummy/db/migrate/20180907104703_create_students.rb +10 -0
- data/spec/dummy/db/schema.rb +29 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/storage/.keep +0 -0
- data/spec/factories.rb +9 -0
- data/spec/features/has_many_spec.rb +41 -0
- data/spec/features/landing_spec.rb +10 -0
- data/spec/i18n_spec.rb +29 -0
- data/spec/lib/administrate/field/nested_has_many_spec.rb +14 -0
- data/spec/rails_helper.rb +67 -0
- data/spec/spec_helper.rb +96 -0
- data/viniBaxter-spa-nested_has_many.gemspec +29 -0
- metadata +368 -0
|
@@ -0,0 +1,29 @@
|
|
|
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: 2018_09_07_104703) do
|
|
14
|
+
|
|
15
|
+
create_table "schools", force: :cascade do |t|
|
|
16
|
+
t.string "name"
|
|
17
|
+
t.datetime "created_at", null: false
|
|
18
|
+
t.datetime "updated_at", null: false
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
create_table "students", force: :cascade do |t|
|
|
22
|
+
t.string "name"
|
|
23
|
+
t.integer "school_id"
|
|
24
|
+
t.datetime "created_at", null: false
|
|
25
|
+
t.datetime "updated_at", null: false
|
|
26
|
+
t.index ["school_id"], name: "index_students_on_school_id"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
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
|
|
File without changes
|
data/spec/factories.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require "rails_helper"
|
|
2
|
+
|
|
3
|
+
feature "Has many" do
|
|
4
|
+
let!(:school) do
|
|
5
|
+
FactoryBot.create(:school, name: "School of Life")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
let!(:student) do
|
|
9
|
+
FactoryBot.create(:student, name: "John Doe", school: school)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
scenario "index" do
|
|
13
|
+
visit admin_schools_path
|
|
14
|
+
expect(page).to have_content("School of Life")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
scenario "show" do
|
|
18
|
+
visit admin_school_path(school)
|
|
19
|
+
expect(page).to have_content("John Doe")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
scenario "new" do
|
|
23
|
+
visit new_admin_school_path
|
|
24
|
+
expect(page).to have_content("New Schools")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
scenario "create", js: true do
|
|
28
|
+
visit new_admin_school_path
|
|
29
|
+
expect(page).to have_content("New Schools")
|
|
30
|
+
expect(page).to have_content("Add Foo/Student")
|
|
31
|
+
fill_in "Name", with: "La Ferme du Bec Hellouin"
|
|
32
|
+
click_link "Add Foo/Student"
|
|
33
|
+
expect(page).to have_content("Remove Foo/Student")
|
|
34
|
+
within(".nested-fields") do
|
|
35
|
+
fill_in "Name", with: "Sébastien"
|
|
36
|
+
end
|
|
37
|
+
click_button "Create School"
|
|
38
|
+
expect(page).to have_text("La Ferme du Bec Hellouin")
|
|
39
|
+
expect(page).to have_text("Sébastien")
|
|
40
|
+
end
|
|
41
|
+
end
|
data/spec/i18n_spec.rb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "i18n/tasks"
|
|
4
|
+
|
|
5
|
+
RSpec.describe "I18n" do
|
|
6
|
+
let(:i18n) { I18n::Tasks::BaseTask.new }
|
|
7
|
+
let(:missing_keys) { i18n.missing_keys }
|
|
8
|
+
let(:unused_keys) { i18n.unused_keys }
|
|
9
|
+
|
|
10
|
+
it "does not have missing keys" do
|
|
11
|
+
expect(missing_keys).to be_empty,
|
|
12
|
+
"Missing #{missing_keys.leaves.count} i18n keys,
|
|
13
|
+
run `i18n-tasks missing' to show them"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "does not have unused keys" do
|
|
17
|
+
expect(unused_keys).to be_empty,
|
|
18
|
+
"#{unused_keys.leaves.count} unused i18n keys,
|
|
19
|
+
run `i18n-tasks unused' to show them"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "files are normalized" do
|
|
23
|
+
non_normalized = i18n.non_normalized_paths
|
|
24
|
+
message = "The following files need to be normalized:\n" \
|
|
25
|
+
"#{non_normalized.map { |path| " #{path}" }.join("\n")}\n" \
|
|
26
|
+
"Please run `i18n-tasks normalize` to fix"
|
|
27
|
+
expect(non_normalized).to be_empty, message
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require "administrate/field/nested_has_many"
|
|
2
|
+
|
|
3
|
+
describe Administrate::Field::NestedHasMany do
|
|
4
|
+
describe "#to_partial_path" do
|
|
5
|
+
it "returns a partial based on the page being rendered" do
|
|
6
|
+
page = :show
|
|
7
|
+
field = Administrate::Field::NestedHasMany.new(:relation, "/a.jpg", page)
|
|
8
|
+
|
|
9
|
+
path = field.to_partial_path
|
|
10
|
+
|
|
11
|
+
expect(path).to eq("/fields/nested_has_many/#{page}")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
ENV['RAILS_ENV'] ||= 'test'
|
|
4
|
+
require File.expand_path('../../spec/dummy/config/environment', __FILE__)
|
|
5
|
+
# Prevent database truncation if the environment is production
|
|
6
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
|
7
|
+
require 'rspec/rails'
|
|
8
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
|
9
|
+
require 'factory_bot'
|
|
10
|
+
require_relative './factories'
|
|
11
|
+
|
|
12
|
+
Capybara.server = :webrick
|
|
13
|
+
|
|
14
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
15
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
16
|
+
# run as spec files by default. This means that files in spec/support that end
|
|
17
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
18
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
|
19
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
|
20
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
21
|
+
#
|
|
22
|
+
# The following line is provided for convenience purposes. It has the downside
|
|
23
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
|
24
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
|
25
|
+
# require only the support files necessary.
|
|
26
|
+
#
|
|
27
|
+
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
|
28
|
+
|
|
29
|
+
# Checks for pending migrations and applies them before tests are run.
|
|
30
|
+
# If you are not using ActiveRecord, you can remove these lines.
|
|
31
|
+
begin
|
|
32
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
33
|
+
rescue ActiveRecord::PendingMigrationError => e
|
|
34
|
+
puts e.to_s.strip
|
|
35
|
+
exit 1
|
|
36
|
+
end
|
|
37
|
+
RSpec.configure do |config|
|
|
38
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
39
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
40
|
+
|
|
41
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
42
|
+
# examples within a transaction, remove the following line or assign false
|
|
43
|
+
# instead of true.
|
|
44
|
+
config.use_transactional_fixtures = true
|
|
45
|
+
|
|
46
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
|
47
|
+
# based on their file location, for example enabling you to call `get` and
|
|
48
|
+
# `post` in specs under `spec/controllers`.
|
|
49
|
+
#
|
|
50
|
+
# You can disable this behaviour by removing the line below, and instead
|
|
51
|
+
# explicitly tag your specs with their type, e.g.:
|
|
52
|
+
#
|
|
53
|
+
# RSpec.describe UsersController, :type => :controller do
|
|
54
|
+
# # ...
|
|
55
|
+
# end
|
|
56
|
+
#
|
|
57
|
+
# The different available types are documented in the features, such as in
|
|
58
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
|
59
|
+
config.infer_spec_type_from_file_location!
|
|
60
|
+
|
|
61
|
+
# Filter lines from Rails gems in backtraces.
|
|
62
|
+
config.filter_rails_from_backtrace!
|
|
63
|
+
# arbitrary gems may also be filtered via:
|
|
64
|
+
# config.filter_gems_from_backtrace("gem name")
|
|
65
|
+
|
|
66
|
+
config.include FactoryBot::Syntax::Methods
|
|
67
|
+
end
|