class Aruba::Initializers::MiniTestInitializer

Minitest Initializer. Adds Aruba + Minitest to project

@private

Public Class Methods

match?(framework) click to toggle source
# File lib/aruba/initializer.rb, line 124
def self.match?(framework)
  framework.downcase.to_sym == :minitest
end

Public Instance Methods

create_example() click to toggle source
# File lib/aruba/initializer.rb, line 145
      def create_example
        create_file 'test/use_aruba_with_minitest.rb', <<~EOS
          $LOAD_PATH.unshift File.expand_path('../test', __FILE__)

          require 'test_helper'
          require 'minitest/autorun'
          require 'aruba/api'

          class FirstRun < Minitest::Test
            include Aruba::Api

            def setup
              setup_aruba
            end

            def test_dummy
              skip "Add some real tests here"
            end
          end
        EOS
      end
create_helper() click to toggle source
# File lib/aruba/initializer.rb, line 129
      def create_helper
        file =  'test/test_helper.rb'
        creator = if File.exist? file
                    :append_to_file
                  else
                    :create_file
                  end

        send creator, file, <<~EOS
          $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

          ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
          ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
        EOS
      end