module Workarea::TestCase::RunnerLocation

Public Instance Methods

running_from_source?() click to toggle source
# File lib/workarea/test_case.rb, line 92
def running_from_source?
  return false unless running_in_dummy_app?

  calling_test = caller.detect do |path|
    /_test\.(rb|#{Rails::Decorators.extension})/.match?(path)
  end

  Rails.root.to_s.include?('test/dummy') &&
    Rails.root.to_s.split('/test/').first.eql?(calling_test.split('/test/').first)
end
running_in_dummy_app?() click to toggle source
# File lib/workarea/test_case.rb, line 116
def running_in_dummy_app?
  return @running_in_dummy_app if defined?(@running_in_dummy_app)
  @running_in_dummy_app = Rails.root.to_s.include?('test/dummy')
end
running_in_gem?() click to toggle source

TODO remove in v3.6

# File lib/workarea/test_case.rb, line 104
      def running_in_gem?
        Workarea.deprecation.warn(
          <<~eos.squish
            running_in_gem? is deprecated, use running_from_dummy_app? if
            you want to know if the test suite is running from a plugin or
            running_from_source? if you want to know if the currently executing test
            is defined in the current Rails project.
          eos
        )
        running_from_source?
      end