module Crabfarm::Modes::Recorder::Snapshot

Public Instance Methods

start(_context, _navigator) click to toggle source
# File lib/crabfarm/modes/recorder/snapshot.rb, line 13
def start(_context, _navigator)
  return puts "Must provide a navigator name" unless _navigator.is_a? String

  begin
    puts "Navigating using last #{_navigator} spec, waiting to hit a reducer...".color(Console::Colors::NOTICE)
    Factories::Reducer.with_decorator Shared::SnapshotDecorator do
      @example = Utils::RSpecRunner.run_single_spec_for spec_for(_navigator)
    end
    puts "Navigation completed".color(Console::Colors::NOTICE)
  rescue Exception => e
    puts "#{e.to_s}".color Console::Colors::ERROR
    puts e.backtrace
  end
end

Private Instance Methods

spec_for(_class_name) click to toggle source
# File lib/crabfarm/modes/recorder/snapshot.rb, line 30
def spec_for(_class_name)
  route = Utils::Naming.route_from_constant(_class_name)
  route = route.join(File::SEPARATOR)
  route = route + '_spec.rb'
  File.join('spec','navigators', route)
end