Top Level Namespace

Defined Under Namespace

Modules: RSpec Classes: String, TrunkAnalyticsListener

Instance Method Summary collapse

Instance Method Details

#escape(str) ⇒ Object



56
57
58
# File 'lib/trunk_spec_helper.rb', line 56

def escape(str)
  str.dump[1..-2]
end

#knapsack_detector_command?Boolean

Returns:

  • (Boolean)


67
68
69
70
71
# File 'lib/trunk_spec_helper.rb', line 67

def knapsack_detector_command?
  command_line = "#{$PROGRAM_NAME} #{ARGV.join(' ')}".strip
  command_line.include?('knapsack_pro:rspec_test_example_detector') ||
    command_line.include?('knapsack_pro:queue:rspec:initialize')
end

#knapsack_detector_mode?Boolean

Knapsack example detector instantiates all test cases in order to determine how to shard them These instantiations should not generate test bundles, so we disable the gem when running under knapsack_pro:rspec_test_example_detector

Returns:

  • (Boolean)


63
64
65
# File 'lib/trunk_spec_helper.rb', line 63

def knapsack_detector_mode?
  knapsack_detector_command?
end

#trunk_disabledObject



73
74
75
76
# File 'lib/trunk_spec_helper.rb', line 73

def trunk_disabled
  knapsack_detector_mode? || ENV['DISABLE_RSPEC_TRUNK_FLAKY_TESTS'] == 'true' ||
    ENV['TRUNK_ORG_URL_SLUG'].nil? || ENV['TRUNK_API_TOKEN'].nil?
end