Module: Ammeter::RSpec::Rails::GeneratorExampleGroup

Extended by:
ActiveSupport::Concern
Includes:
RSpec::Rails::RailsExampleGroup
Defined in:
lib/ammeter/rspec/generator/example/generator_example_group.rb

Overview

Delegates to Rails::Generators::TestCase to work with RSpec.

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

DELEGATED_METHODS =
[:destination_root, :current_path, :generator_class]

Instance Method Summary collapse

Instance Method Details

#file(relative) ⇒ Object



80
81
82
# File 'lib/ammeter/rspec/generator/example/generator_example_group.rb', line 80

def file relative
  File.expand_path(relative, destination_root)
end

#invoke_task(name) ⇒ Object



51
52
53
# File 'lib/ammeter/rspec/generator/example/generator_example_group.rb', line 51

def invoke_task name
  OutputCapturer.capture(:stdout) { generator.invoke_task(generator_class.all_tasks[name.to_s]) }
end

#migration_file(relative) ⇒ Object



83
84
85
86
87
88
# File 'lib/ammeter/rspec/generator/example/generator_example_group.rb', line 83

def migration_file relative
  file_path = file(relative)
  migration_file = Dir.glob("#{File.dirname(file_path)}/[0-9]*_#{File.basename(file_path)}").first
  migration_file = "#{File.dirname(file_path)}/TIMESTAMP_#{File.basename(file_path)}" if migration_file.nil?
  migration_file
end