<commit_before>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

class MockDecoder
  def self.decode(string, options = {})
    {'abc' => 'def'}
  end
  
  def self.encode(string)
    '{"abc":"def"}'
  end
end

describe "MultiJson" do
  context 'engines' do
    it 'should default to the best available gem' do
      require 'yajl'
      MultiJson.engine.name.should == 'MultiJson::Engines::Yajl'<commit_msg>Make the 'best available' test pending if yajl is missing.<commit_after>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

class MockDecoder
  def self.decode(string, options = {})
    {'abc' => 'def'}
  end
  
  def self.encode(string)
    '{"abc":"def"}'
  end
end

describe "MultiJson" do
  context 'engines' do
    it 'should default to the best available gem' do
      begin
        require 'yajl'
        MultiJson.engine.name.should == 'MultiJson::Engines::Yajl'
      rescue LoadError
        pending "YAJL (or a dependency) not available."
      end
{'fraction_non_alphanumeric': 0.12625250501002003, 'fraction_numerical': 0.0, 'mean_word_length': 3.44, 'pattern_counts': {'":': 2, '<': 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': '1645953', 'n_tokens_mistral': 323, 'n_tokens_neox': 322, 'n_words': 89}