tb_commerce 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +3 -0
- data/Rakefile +25 -0
- data/app/assets/javascripts/tb_commerce/application.js +13 -0
- data/app/assets/stylesheets/tb_commerce/application.css +15 -0
- data/app/controllers/tb_commerce/application_controller.rb +4 -0
- data/app/helpers/tb_commerce/application_helper.rb +4 -0
- data/app/views/layouts/tb_commerce/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/lib/tasks/tb_commerce_tasks.rake +4 -0
- data/lib/tb_commerce.rb +4 -0
- data/lib/tb_commerce/configuration.rb +3 -0
- data/lib/tb_commerce/engine.rb +22 -0
- data/lib/tb_commerce/version.rb +3 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/admin/application.js +16 -0
- data/spec/dummy/app/assets/javascripts/application.js +18 -0
- data/spec/dummy/app/assets/stylesheets/admin/application.scss +3 -0
- data/spec/dummy/app/assets/stylesheets/application.scss +5 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +33 -0
- data/spec/dummy/app/views/layouts/error_page.html.erb +8 -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 +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +38 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +13 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -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/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/migrate/20150323152913_create_spud_admin_permissions.tb_core.rb +12 -0
- data/spec/dummy/db/migrate/20150323152914_create_spud_users.tb_core.rb +30 -0
- data/spec/dummy/db/migrate/20150323152915_add_time_zone_to_spud_user.tb_core.rb +7 -0
- data/spec/dummy/db/migrate/20150323152916_add_scope_to_spud_admin_permissions.tb_core.rb +7 -0
- data/spec/dummy/db/migrate/20150323152917_create_spud_user_settings.tb_core.rb +12 -0
- data/spec/dummy/db/migrate/20150323152918_create_spud_roles.tb_core.rb +11 -0
- data/spec/dummy/db/migrate/20150323152919_create_spud_permissions.tb_core.rb +11 -0
- data/spec/dummy/db/migrate/20150323152920_create_spud_role_permissions.tb_core.rb +12 -0
- data/spec/dummy/db/migrate/20150323152921_drop_spud_admin_permissions.tb_core.rb +16 -0
- data/spec/dummy/db/migrate/20150323152922_create_tb_checkout_carts.tb_checkout_engine.rb +13 -0
- data/spec/dummy/db/migrate/20150323152923_create_tb_checkout_cart_items.tb_checkout_engine.rb +16 -0
- data/spec/dummy/db/migrate/20150323152924_create_tb_checkout_transactions.tb_checkout_engine.rb +24 -0
- data/spec/dummy/db/migrate/20150323152925_create_tb_checkout_basic_products.tb_checkout_engine.rb +9 -0
- data/spec/dummy/db/migrate/20150323152926_add_spud_user_and_session_id_to_transactions.tb_checkout_engine.rb +11 -0
- data/spec/dummy/db/schema.rb +135 -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/favicon.ico +0 -0
- data/spec/factories/spud_users.rb +14 -0
- data/spec/rails_helper.rb +67 -0
- data/spec/spec_helper.rb +87 -0
- metadata +295 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
# This migration comes from tb_checkout_engine (originally 20140915202848)
|
2
|
+
class AddSpudUserAndSessionIdToTransactions < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
change_table :tb_checkout_transactions do |t|
|
5
|
+
t.integer :spud_user_id
|
6
|
+
t.index :spud_user_id
|
7
|
+
t.string :session_id, :limit => 32
|
8
|
+
t.index :session_id
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20150323152926) do
|
15
|
+
|
16
|
+
create_table "spud_permissions", force: :cascade do |t|
|
17
|
+
t.string "name", limit: 255, null: false
|
18
|
+
t.string "tag", limit: 255, null: false
|
19
|
+
t.datetime "created_at"
|
20
|
+
t.datetime "updated_at"
|
21
|
+
end
|
22
|
+
|
23
|
+
add_index "spud_permissions", ["tag"], name: "index_spud_permissions_on_tag", unique: true, using: :btree
|
24
|
+
|
25
|
+
create_table "spud_role_permissions", force: :cascade do |t|
|
26
|
+
t.integer "spud_role_id", limit: 4, null: false
|
27
|
+
t.string "spud_permission_tag", limit: 255, null: false
|
28
|
+
t.datetime "created_at"
|
29
|
+
t.datetime "updated_at"
|
30
|
+
end
|
31
|
+
|
32
|
+
add_index "spud_role_permissions", ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag", using: :btree
|
33
|
+
add_index "spud_role_permissions", ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id", using: :btree
|
34
|
+
|
35
|
+
create_table "spud_roles", force: :cascade do |t|
|
36
|
+
t.string "name", limit: 255
|
37
|
+
t.datetime "created_at"
|
38
|
+
t.datetime "updated_at"
|
39
|
+
end
|
40
|
+
|
41
|
+
create_table "spud_user_settings", force: :cascade do |t|
|
42
|
+
t.integer "spud_user_id", limit: 4
|
43
|
+
t.string "key", limit: 255
|
44
|
+
t.string "value", limit: 255
|
45
|
+
t.datetime "created_at"
|
46
|
+
t.datetime "updated_at"
|
47
|
+
end
|
48
|
+
|
49
|
+
create_table "spud_users", force: :cascade do |t|
|
50
|
+
t.string "first_name", limit: 255
|
51
|
+
t.string "last_name", limit: 255
|
52
|
+
t.boolean "super_admin", limit: 1
|
53
|
+
t.string "login", limit: 255, null: false
|
54
|
+
t.string "email", limit: 255, null: false
|
55
|
+
t.string "crypted_password", limit: 255, null: false
|
56
|
+
t.string "password_salt", limit: 255, null: false
|
57
|
+
t.string "persistence_token", limit: 255, null: false
|
58
|
+
t.string "single_access_token", limit: 255, null: false
|
59
|
+
t.string "perishable_token", limit: 255, null: false
|
60
|
+
t.integer "login_count", limit: 4, default: 0, null: false
|
61
|
+
t.integer "failed_login_count", limit: 4, default: 0, null: false
|
62
|
+
t.datetime "last_request_at"
|
63
|
+
t.datetime "current_login_at"
|
64
|
+
t.datetime "last_login_at"
|
65
|
+
t.string "current_login_ip", limit: 255
|
66
|
+
t.string "last_login_ip", limit: 255
|
67
|
+
t.datetime "created_at"
|
68
|
+
t.datetime "updated_at"
|
69
|
+
t.string "time_zone", limit: 255
|
70
|
+
t.integer "spud_role_id", limit: 4
|
71
|
+
end
|
72
|
+
|
73
|
+
add_index "spud_users", ["email"], name: "index_spud_users_on_email", using: :btree
|
74
|
+
add_index "spud_users", ["login"], name: "index_spud_users_on_login", using: :btree
|
75
|
+
add_index "spud_users", ["spud_role_id"], name: "index_spud_users_on_spud_role_id", using: :btree
|
76
|
+
|
77
|
+
create_table "tb_checkout_basic_products", force: :cascade do |t|
|
78
|
+
t.string "description", limit: 255
|
79
|
+
t.decimal "price", precision: 8, scale: 2
|
80
|
+
t.datetime "created_at"
|
81
|
+
t.datetime "updated_at"
|
82
|
+
end
|
83
|
+
|
84
|
+
create_table "tb_checkout_cart_items", force: :cascade do |t|
|
85
|
+
t.integer "cart_id", limit: 4, null: false
|
86
|
+
t.integer "item_id", limit: 4, null: false
|
87
|
+
t.string "item_type", limit: 255, null: false
|
88
|
+
t.string "item_description", limit: 255
|
89
|
+
t.decimal "item_price", precision: 8, scale: 2
|
90
|
+
t.integer "quantity", limit: 4, default: 1
|
91
|
+
t.datetime "created_at"
|
92
|
+
t.datetime "updated_at"
|
93
|
+
end
|
94
|
+
|
95
|
+
add_index "tb_checkout_cart_items", ["cart_id"], name: "index_tb_checkout_cart_items_on_cart_id", using: :btree
|
96
|
+
add_index "tb_checkout_cart_items", ["item_id", "item_type"], name: "index_tb_checkout_cart_items_on_item_id_and_item_type", using: :btree
|
97
|
+
|
98
|
+
create_table "tb_checkout_carts", force: :cascade do |t|
|
99
|
+
t.integer "spud_user_id", limit: 4
|
100
|
+
t.string "session_id", limit: 32
|
101
|
+
t.boolean "is_completed", limit: 1, default: false
|
102
|
+
t.boolean "is_abandoned", limit: 1, default: false
|
103
|
+
t.datetime "created_at"
|
104
|
+
t.datetime "updated_at"
|
105
|
+
end
|
106
|
+
|
107
|
+
add_index "tb_checkout_carts", ["spud_user_id"], name: "index_tb_checkout_carts_on_spud_user_id", using: :btree
|
108
|
+
|
109
|
+
create_table "tb_checkout_transactions", force: :cascade do |t|
|
110
|
+
t.integer "cart_id", limit: 4
|
111
|
+
t.string "status", limit: 255, default: "pending"
|
112
|
+
t.string "invoice_num", limit: 255
|
113
|
+
t.integer "gateway_transaction_id", limit: 8
|
114
|
+
t.decimal "amount_charged", precision: 8, scale: 2
|
115
|
+
t.string "card_display", limit: 255
|
116
|
+
t.string "card_type", limit: 255
|
117
|
+
t.string "billing_first_name", limit: 255
|
118
|
+
t.string "billing_last_name", limit: 255
|
119
|
+
t.string "billing_address_1", limit: 255
|
120
|
+
t.string "billing_address_2", limit: 255
|
121
|
+
t.string "billing_city", limit: 255
|
122
|
+
t.string "billing_state", limit: 255
|
123
|
+
t.string "billing_postal", limit: 255
|
124
|
+
t.text "response_text", limit: 65535
|
125
|
+
t.datetime "created_at"
|
126
|
+
t.datetime "updated_at"
|
127
|
+
t.integer "spud_user_id", limit: 4
|
128
|
+
t.string "session_id", limit: 32
|
129
|
+
end
|
130
|
+
|
131
|
+
add_index "tb_checkout_transactions", ["cart_id"], name: "index_tb_checkout_transactions_on_cart_id", using: :btree
|
132
|
+
add_index "tb_checkout_transactions", ["session_id"], name: "index_tb_checkout_transactions_on_session_id", using: :btree
|
133
|
+
add_index "tb_checkout_transactions", ["spud_user_id"], name: "index_tb_checkout_transactions_on_spud_user_id", using: :btree
|
134
|
+
|
135
|
+
end
|
@@ -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
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
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
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
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>
|
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
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
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
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
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>
|
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
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
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
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
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>
|
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
|
@@ -0,0 +1,14 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :spud_user do
|
3
|
+
sequence :email do |n|
|
4
|
+
"john.doe.#{n}@example.com"
|
5
|
+
end
|
6
|
+
sequence :login do |n|
|
7
|
+
"johndoe#{n}"
|
8
|
+
end
|
9
|
+
password "password"
|
10
|
+
password_confirmation "password"
|
11
|
+
first_name "John"
|
12
|
+
last_name "Doe"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
require 'spec_helper'
|
4
|
+
require File.expand_path('../../config/environment', __FILE__)
|
5
|
+
require 'rspec/rails'
|
6
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
7
|
+
|
8
|
+
require 'database_cleaner'
|
9
|
+
require 'factory_girl_rails'
|
10
|
+
require 'simplecov'
|
11
|
+
require "authlogic/test_case"
|
12
|
+
include Authlogic::TestCase
|
13
|
+
SimpleCov.start 'rails'
|
14
|
+
|
15
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
16
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
17
|
+
# run as spec files by default. This means that files in spec/support that end
|
18
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
19
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
20
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
21
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
22
|
+
#
|
23
|
+
# The following line is provided for convenience purposes. It has the downside
|
24
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
25
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
26
|
+
# require only the support files necessary.
|
27
|
+
#
|
28
|
+
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
29
|
+
Dir[TbCommerce::Engine.root.join("spec/concerns/**/*.rb")].each { |f| require f }
|
30
|
+
|
31
|
+
# Checks for pending migrations before tests are run.
|
32
|
+
# If you are not using ActiveRecord, you can remove this line.
|
33
|
+
ActiveRecord::Migration.maintain_test_schema!
|
34
|
+
|
35
|
+
RSpec.configure do |config|
|
36
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
37
|
+
# examples within a transaction, remove the following line or assign false
|
38
|
+
# instead of true.
|
39
|
+
config.use_transactional_fixtures = true
|
40
|
+
|
41
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
42
|
+
# based on their file location, for example enabling you to call `get` and
|
43
|
+
# `post` in specs under `spec/controllers`.
|
44
|
+
#
|
45
|
+
# You can disable this behaviour by removing the line below, and instead
|
46
|
+
# explicitly tag your specs with their type, e.g.:
|
47
|
+
#
|
48
|
+
# RSpec.describe UsersController, :type => :controller do
|
49
|
+
# # ...
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# The different available types are documented in the features, such as in
|
53
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
54
|
+
config.infer_spec_type_from_file_location!
|
55
|
+
|
56
|
+
# Clean the database as needed
|
57
|
+
config.before(:suite) do
|
58
|
+
DatabaseCleaner.strategy = :transaction
|
59
|
+
DatabaseCleaner.clean_with(:truncation)
|
60
|
+
end
|
61
|
+
config.around(:each) do |example|
|
62
|
+
DatabaseCleaner.cleaning do
|
63
|
+
example.run
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|