Sha256: fb4c4d913881976052fcd28816a4110d333f2bd8a653ad4224c8c74199b9dfc4

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require_relative 'helper'
describe Loader::AutoLoad do

  before do
    Loader::Helpers.__send__(:define_singleton_method,:pwd){ __dir__ }
  end

  it 'should raise an constant missing error than' do

    -> {
      begin
        TEST
      rescue Exception => e
        e
      end
    }.call.is_a?(Exception).must_be :==, true

    Loader.autoload

    -> {
      begin
        TEST
      rescue Exception => e
        e
      end
    }.call.is_a?(Exception).must_be :==, false

    -> {
      begin
        Cat::Tail
      rescue Exception => e
        e
      end
    }.call.is_a?(Exception).must_be :==, false

    -> {
      begin

        class Cat
          Dog
        end

      rescue Exception => e
        e
      end
    }.call.is_a?(Exception).must_be :==, false

    -> {
      begin

        SamplesController

      rescue Exception => e
        e
      end
    }.call.is_a?(Exception).must_be :==, false

    -> {
      begin
        BOOOM
      rescue Exception => e
        e
      end
    }.call.is_a?(Exception).must_be :==, true

  end

  # require_relative_directory_r 'lib'

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loader-2.2.2 test/test_autoload.rb
loader-2.2.1 test/test_autoload.rb