<commit_before>module Greybox
  describe Configurable do

    def config
      @config ||= configuration_class.new
    end

    describe "setting a property" do
      def configuration_class
        Class.new do
          include Configurable

          def_property :regular
        end
      end

      it "lets you set valid properties" do
        config.regular = "abc"
        config.regular.must_equal "abc"
      end

      it "does not let you set invalid properties" do
        -> do
          config.unset = "abc"
        end.must_raise NoMethodError
      end
    end

    describe "required properties" do
      def configuration_class
        Class.new do
          include Configurable

          def_property :req, required: true
        end<commit_msg>Add test for the anonymous module's to_s, closes #4<commit_after>module Greybox
  describe Configurable do

    def config
      @config ||= configuration_class.new
    end

    describe "the inserted module" do
      it "shows what properties have been defined" do
        cls = Class.new do
          include Configurable

          def_property :some_property
          def_property :some_other_property
        end
        cls.ancestors.map(&:to_s).must_include "Properties(some_property, some_other_property)"
      end
    end

    describe "setting a property" do
      def configuration_class
        Class.new do
          include Configurable

          def_property :regular
        end
      end

      it "lets you set valid properties" do
        config.regular = "abc"
        config.regular.must_equal "abc"
      end

      it "does not let you set invalid properties" do
        -> do
          config.unset = "abc"
        end.must_raise NoMethodError
      end
    end

    describe "required properties" do
      def configuration_class
        Class.new do
          include Configurable

          def_property :req, required: true
        end
{'fraction_non_alphanumeric': 0.05015511892450879, 'fraction_numerical': 0.000517063081695967, 'mean_word_length': 1.9318181818181819, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4408315', 'n_tokens_mistral': 509, 'n_tokens_neox': 490, 'n_words': 171}