Commit 0c61def1 by liyijie

feat: 更新脚手架的内容

parent 4129a9dd
# 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
......@@ -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
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment