<commit_before>require_relative '../test_case'
require 'tunit/spec'

MyThing = Class.new

module Tunit
  class SpecDSLTest < TestCase
    def test_it_blocks_are_converted_to_test_methods
      klass = Class.new(Spec) {
        it "does the thing" do end
      }

      assert_includes klass.runnable_methods, "test_0001_does_the_thing"
    end

    def test_before_is_converted_to_setup
      klass = Class.new(Spec)
      klass.before { "here!" }

      k = klass.new :test

      assert_respond_to k, :setup
      assert_equal "here!", k.setup
    end

    def test_after_is_converted_to_teardown
      klass = Class.new(Spec)
      klass.after { "there!" }

      k = klass.new :test

      assert_respond_to k, :teardown
      assert_equal "there!", k.teardown
    end

    def test_describe_is_converted_to_a_test_klass_with_test_methods
      my_thing = describe MyThing do
        it 'dances all night long' do end
      end

      assert_includes my_thing.ancestors, ::Tunit::Test
      assert_includes my_thing.runnable_methods, "test_0001_dances_all_night_long"<commit_msg>Explicitly state in the namespace<commit_after>require_relative '../test_case'
require 'tunit/spec'

MyThing = Class.new

module Tunit
  class SpecDSLTest < TestCase
    def test_it_blocks_are_converted_to_test_methods
      klass = Class.new(Spec) {
        it "does the thing" do end
      }

      assert_includes klass.runnable_methods, "test_0001_does_the_thing"
    end

    def test_before_is_converted_to_setup
      klass = Class.new(Spec)
      klass.before { "here!" }

      k = klass.new :test

      assert_respond_to k, :setup
      assert_equal "here!", k.setup
    end

    def test_after_is_converted_to_teardown
      klass = Class.new(Spec)
      klass.after { "there!" }

      k = klass.new :test

      assert_respond_to k, :teardown
      assert_equal "there!", k.teardown
    end

    def test_describe_is_converted_to_a_test_klass_with_test_methods
      my_thing = describe MyThing do
        it 'dances all night long' do end
      end

      assert_includes my_thing.ancestors, Tunit::Test
      assert_includes my_thing.ancestors, Tunit::Runnable
      assert_includes my_thing.runnable_methods, "test_0001_dances_all_night_long"
{'fraction_non_alphanumeric': 0.07136485280999108, 'fraction_numerical': 0.007136485280999108, 'mean_word_length': 3.1005484460694697, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1852135', 'n_tokens_mistral': 781, 'n_tokens_neox': 761, 'n_words': 160}