Sha256: f7c770558888f38cb2f064ce05515690aaf66b652e67218ca2fe58ca5cc95d43

Contents?: true

Size: 793 Bytes

Versions: 14

Compression:

Stored size: 793 Bytes

Contents

module MiniTestSpecRails
  module DSL
    def self.included(klass)
      klass.extend ClassMethods
      remove_method :test if method_defined?(:test)
    end

    module ClassMethods
      def describe(*args, &block)
        stack = Minitest::Spec.describe_stack
        stack.push self if stack.empty?
        super(*args) { class_eval(&block) }
        stack.pop if stack.length == 1
      end

      def before(_type = nil, &block)
        setup { instance_eval(&block) }
      end

      def after(_type = nil, &block)
        teardown { instance_eval(&block) }
      end

      def test(name, &block)
        instance_eval { it(name, &block) }
      end

      def described_class
        nil
      end
    end

    def described_class
      self.class.described_class
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
minitest-spec-rails-7.4.1 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-7.4.0 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-7.3.0 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-7.2.0 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-7.1.0 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-7.0.0 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-6.2.0 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-6.1.0 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-6.0.4 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-6.0.3 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-6.0.2 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-6.0.1 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-6.0.0 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-5.5.0 lib/minitest-spec-rails/dsl.rb