Sha256: b706deaba424d0bc5c53e56d12e121f2c49eb7bbb1956d657fe55a9ac0109336
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
require 'pry' require 'pry-factorybot' module PryFactoryBot # TODO FactoryBot::Internal::DEFAULT_STRATEGIESでとれるようになるかも? DEFAULT_STRATEGIES_NAMES = [:build, :create, :attributes_for, :build_stubbed, :null ] DEFAULT_STRATEGIES_NAMES.each do |strategy_name| class_eval <<-EOS class FactoryBot#{strategy_name.capitalize}Command < ::Pry::ClassCommand match "#{strategy_name}" group "FactorBot" description "FactorBot.#{strategy_name}" banner <<-BANNER Usage: #{strategy_name} FactorBot.create. BANNER def process(*args) ::FactoryBot.#{strategy_name}(args) rescue => e puts e.message end end EOS end DEFAULT_STRATEGIES_NAMES.each do |strategy_name| eval "Pry::Commands.add_command(PryFactoryBot::FactoryBot#{strategy_name.capitalize}Command)" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pry-factorybot-0.1.0 | lib/pry-factorybot.rb |