Module: Workarea::TestCase::RunnerLocation

Included in:
IntegrationTest, PerformanceTest, SystemTest, Workarea::TestCase, Workarea::TestCase, ViewTest
Defined in:
lib/workarea/test_case.rb

Instance Method Summary collapse

Instance Method Details

#running_from_source?Boolean



92
93
94
95
96
97
98
99
100
101
# 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?Boolean



113
114
115
116
# File 'lib/workarea/test_case.rb', line 113

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?Boolean



103
104
105
106
107
108
109
110
111
# File 'lib/workarea/test_case.rb', line 103

def running_in_gem?
  warn "    DEPRECATION WARNING: running_in_gem? is deprecated, use running_from_dummy_app? if\n    you want to know if the test suite is running from a plugin or\n    running_from_source? if you want to know if the currently executing test\n    is defined in the current Rails project.\n  eos\n  running_from_source?\nend\n"