Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rails-api-with-engine-template
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
rails-api-with-engine-template
Commits
0c61def1
Commit
0c61def1
authored
Nov 12, 2021
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新脚手架的内容
parent
4129a9dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
factory_bot.rb
src/spec/support/factory_bot.rb
+6
-0
spec_seeds.rb
src/spec/support/spec_seeds.rb
+7
-1
template.rb
template.rb
+4
-2
No files found.
src/spec/support/factory_bot.rb
View file @
0c61def1
# RSpec
# spec/support/factory_bot.rb
RSpec
.
configure
do
|
config
|
factories_directory
=
Rails
.
root
.
join
(
'..'
,
'factories'
)
engine_factory_directories
=
[
RailsCom
::
Engine
].
map
do
|
engine
|
engine
.
root
.
join
(
'spec'
,
'factories'
)
end
FactoryBot
.
definition_file_paths
=
[
factories_directory
,
*
engine_factory_directories
]
FactoryBot
.
find_definitions
config
.
include
FactoryBot
::
Syntax
::
Methods
end
src/spec/support/spec_seeds.rb
View file @
0c61def1
...
...
@@ -3,6 +3,12 @@ RSpec.configure do |config|
config
.
before
(
:each
)
do
|
example
|
@modules
=
example
.
metadata
[
:tags
]
&
.
first
&
.
split
(
' '
)
||
[]
@user
=
create
(
:user
,
org:
@org
)
@app
=
create
:app
@user
=
create
(
:user
,
app:
@app
)
user_account_info
=
{
account_type:
'User'
,
account:
@user
.
account
,
}
allow
(
User
).
to
receive
(
:auth!
).
and_return
(
user_account_info
)
end
end
template.rb
View file @
0c61def1
...
...
@@ -67,6 +67,8 @@ gem 'mina-multistage', require: false
gem
'sprockets'
gem
'rails_com'
,
git:
'https://git.tallty.com/ta-rails/rails_com.git'
gem_group
:development
,
:test
do
gem
'rspec-rails'
gem
'shoulda-matchers'
...
...
@@ -115,8 +117,8 @@ after_bundle do
copy_file
'src/spec/support/shoulda_matches.rb'
,
'spec/support/shoulda_matches.rb'
# factory_bot_rails gem configuration
gsub_file
'spec/rails_helper.rb'
,
"# Dir[Rails.root.join('spec', 'support', '**', '*.rb')]
.each { |f| require f }"
,
"Dir[Rails.root.join('spec', 'support', '**', '*.rb')]
.each { |f| require f }"
"# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort
.each { |f| require f }"
,
"Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort
.each { |f| require f }"
copy_file
'src/spec/support/factory_bot.rb'
,
'spec/support/factory_bot.rb'
# simplecov configuration
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment