Class: Rspec::Generators::TransactionGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/rspec/transaction_generator.rb

Instance Method Summary collapse

Instance Method Details

#class_nameObject



22
23
24
# File 'lib/generators/rspec/transaction_generator.rb', line 22

def class_name
  "#{name.to_s.classify.chomp('Transaction')}Transaction"
end

#create_transaction_specObject



10
11
12
# File 'lib/generators/rspec/transaction_generator.rb', line 10

def create_transaction_spec
  template 'transaction_spec.rb.erb', "spec/models/#{module_path}/#{file_name}.rb"
end

#factory_nameObject



34
35
36
# File 'lib/generators/rspec/transaction_generator.rb', line 34

def factory_name
  class_name.underscore
end

#file_nameObject



14
15
16
# File 'lib/generators/rspec/transaction_generator.rb', line 14

def file_name
  "#{class_name.underscore}_spec"
end

#module_nameObject



26
27
28
# File 'lib/generators/rspec/transaction_generator.rb', line 26

def module_name
  module_path.classify
end

#module_pathObject



30
31
32
# File 'lib/generators/rspec/transaction_generator.rb', line 30

def module_path
  'ledger'
end

#qualified_class_nameObject



18
19
20
# File 'lib/generators/rspec/transaction_generator.rb', line 18

def qualified_class_name
  "#{module_name}::#{class_name}"
end