Module: Turnip::RSpec::Loader

Defined in:
lib/rutabaga/turnip.rb,
lib/rutabaga/no_turnip.rb

Instance Method Summary collapse

Instance Method Details

#load(*a, &b) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rutabaga/turnip.rb', line 11

def load(*a, &b)
  if a.first.end_with?('.feature')
    if legal_directories.none? { |d| a.first.end_with? d }
      ::RSpec.warning 'Features can only be called from turnip enable directories. These are configured ' \
                      "in RSpec.configuration.pattern which is currently '#{::RSpec.configuration.pattern}'"
    else
      require_if_exists 'turnip_helper'
      require_if_exists 'spec_helper'

      Turnip::RSpec.run(a.first)
    end
  else
    super
  end
end