Sha256: f3330f9d9b5927c74fc28ff3f6916c27430225210559a10e050b88c7d30f245e

Contents?: true

Size: 813 Bytes

Versions: 4

Compression:

Stored size: 813 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 { self.instance_eval(&block) }
      end

      def after(type = nil, &block)
        teardown { self.instance_eval(&block) }
      end

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

      def described_class
        nil
      end
      
    end

    def described_class
      self.class.described_class
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
minitest-spec-rails-5.0.3 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-5.0.2 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-5.0.1 lib/minitest-spec-rails/dsl.rb
minitest-spec-rails-5.0.0 lib/minitest-spec-rails/dsl.rb