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, InstanceMethods

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#file(relative) ⇒ Object



74
75
76
# File 'lib/ammeter/rspec/generator/example/generator_example_group.rb', line 74

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

#migration_file(relative) ⇒ Object



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

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