<commit_before>$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'bundler'
Bundler.setup(:development)
require 'mail'
require 'postmark'
require 'active_support'
require 'json'
require 'fakeweb'
require 'fakeweb_matcher'
require 'timecop'
require 'rspec'
require 'rspec/autorun'
require File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'shared_examples.rb')

if ENV['JSONGEM']
  # `JSONGEM=Yajl rake spec`
  Postmark.response_parser_class = ENV['JSONGEM'].to_sym
  puts "Setting ResponseParser class to #{Postmark::ResponseParsers.const_get Postmark.response_parser_class}"
end

RSpec.configure do |config|
	config.filter_run_excluding :ruby => lambda { |version|
    RUBY_VERSION.to_s !~ /^#{version.to_s}/
  }
end

RSpec::Matchers.define :be_serialized_to do |json|
  match do |mail_message|
    Postmark.convert_message_to_options_hash(mail_message).should == JSON.parse(json)
  end
end
<commit_msg>Drop state before each RSpec example.<commit_after>$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'bundler'
Bundler.setup(:development)
require 'mail'
require 'postmark'
require 'active_support'
require 'json'
require 'fakeweb'
require 'fakeweb_matcher'
require 'timecop'
require 'rspec'
require 'rspec/autorun'
require File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'shared_examples.rb')

if ENV['JSONGEM']
  # `JSONGEM=Yajl rake spec`
  Postmark.response_parser_class = ENV['JSONGEM'].to_sym
  puts "Setting ResponseParser class to #{Postmark::ResponseParsers.const_get Postmark.response_parser_class}"
end

RSpec.configure do |config|
	config.filter_run_excluding :ruby => lambda { |version|
    RUBY_VERSION.to_s !~ /^#{version.to_s}/
  }

  config.before(:each) do
    %w(api_client response_parser_class secure api_key proxy_host proxy_port
       proxy_user proxy_pass host port path_prefix http_open_timeout 
       http_read_timeout max_retries).each do |var|
      Postmark.instance_variable_set(:"@#{var}", nil)
    end
  end
end

RSpec::Matchers.define :be_serialized_to do |json|
  match do |mail_message|
    Postmark.convert_message_to_options_hash(mail_message).should == JSON.parse(json)
  end
end

{'fraction_non_alphanumeric': 0.12392426850258176, 'fraction_numerical': 0.0, 'mean_word_length': 6.3575949367088604, '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': '191431', 'n_tokens_mistral': 814, 'n_tokens_neox': 806, 'n_words': 159}