<commit_before>require 'spec_helper'
require 'schemad/extensions'

class Demo
  class Foo
    class Bar
      include Schemad::Extensions
    end
  end
end

describe Schemad::Extensions do
  Given(:ext) { Demo::Foo::Bar.new }

  When(:class_base) { Demo::Foo::Bar.base_class_name }
  Then { class_base.should == "Bar" }

  When(:base) { ext.base_class_name }
  Then { base.should == "Bar" }

  When(:const) { ext.send :constantize, "Demo::Foo::Bar" }
  Then { const.should == Demo::Foo::Bar }
  context "indifferent hash wrapper" do
    When(:converted) { ext.send :indifferent_hash, {one: 1, "two" => 2, "Three and Four" => 34} }
    Then { converted["one"].should == 1 }
    And { converted[:two].should == 2 }
    And { converted["Three and Four"].should == 34 }
  end
end<commit_msg>scope specs better, add a spec for the classifier<commit_after>require 'spec_helper'
require 'schemad/extensions'

class Demo
  class Foo
    class Bar
      include Schemad::Extensions
    end
  end
end

describe Schemad::Extensions do
  Given(:ext) { Demo::Foo::Bar.new }

  context "base class name getter" do
    When(:class_base) { Demo::Foo::Bar.base_class_name }
    Then { class_base.should == "Bar" }
  end

  context "instance method for base class" do
    When(:base) { ext.base_class_name }
    Then { base.should == "Bar" }
  end

  context "constantizer" do
    When(:const) { ext.send :constantize, "Demo::Foo::Bar" }
    Then { const.should == Demo::Foo::Bar }
  end

  context "classifier" do
    When(:classy) { ext.send :classify, "demo_foo_bar" }
    Then { classy.should == "DemoFooBar" }
  end

  context "indifferent hash wrapper" do
    When(:converted) { ext.send :indifferent_hash, {one: 1, "two" => 2, "Three and Four" => 34} }
    Then { converted["one"].should == 1 }
    And { converted[:two].should == 2 }
    And { converted["Three and Four"].should == 34 }
  end
end
{'fraction_non_alphanumeric': 0.14528101802757157, 'fraction_numerical': 0.008483563096500531, 'mean_word_length': 3.5800970873786406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5684779', 'n_tokens_mistral': 668, 'n_tokens_neox': 629, 'n_words': 169}