Sha256: 62c2de0d1f66e43b4409d828cfd55d0fc68b406df07044791e20f1e276f39648
Contents?: true
Size: 755 Bytes
Versions: 11
Compression:
Stored size: 755 Bytes
Contents
module Souls module Generate class << self ## Generate Rspec Model def rspec_model class_name: "souls" file_path = "./spec/models/#{class_name}_spec.rb" return "RspecModel already exist! #{file_path}" if File.exist? file_path File.open(file_path, "w") do |f| f.write <<~EOS RSpec.describe "#{class_name.camelize} Model テスト", type: :model do describe "#{class_name.camelize} データを書き込む" do it "valid #{class_name.camelize} Model" do expect(FactoryBot.build(:#{class_name.singularize})).to be_valid end end end EOS end file_path end end end end
Version data entries
11 entries across 11 versions & 1 rubygems