Commit 0c61def1 by liyijie

feat: 更新脚手架的内容

parent 4129a9dd
# RSpec # RSpec
# spec/support/factory_bot.rb # spec/support/factory_bot.rb
RSpec.configure do |config| 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 config.include FactoryBot::Syntax::Methods
end end
...@@ -3,6 +3,12 @@ RSpec.configure do |config| ...@@ -3,6 +3,12 @@ RSpec.configure do |config|
config.before(:each) do |example| config.before(:each) do |example|
@modules = example.metadata[:tags]&.first&.split(' ') || [] @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
end end
...@@ -67,6 +67,8 @@ gem 'mina-multistage', require: false ...@@ -67,6 +67,8 @@ gem 'mina-multistage', require: false
gem 'sprockets' gem 'sprockets'
gem 'rails_com', git: 'https://git.tallty.com/ta-rails/rails_com.git'
gem_group :development, :test do gem_group :development, :test do
gem 'rspec-rails' gem 'rspec-rails'
gem 'shoulda-matchers' gem 'shoulda-matchers'
...@@ -115,8 +117,8 @@ after_bundle do ...@@ -115,8 +117,8 @@ after_bundle do
copy_file 'src/spec/support/shoulda_matches.rb', 'spec/support/shoulda_matches.rb' copy_file 'src/spec/support/shoulda_matches.rb', 'spec/support/shoulda_matches.rb'
# factory_bot_rails gem configuration # factory_bot_rails gem configuration
gsub_file 'spec/rails_helper.rb', gsub_file 'spec/rails_helper.rb',
"# 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')].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' copy_file 'src/spec/support/factory_bot.rb', 'spec/support/factory_bot.rb'
# simplecov configuration # 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