<commit_before>require 'helper'

describe IFormat do

  after do
    IFormat.reset
  end

  describe '.wsdl' do
    it 'returns the default wsdl' do
      IFormat.wsdl.must_equal 'http://wsdl.iformat.pl/api.xml'
    end
  end

  describe '.wsdl=' do
    it 'sets custom wsdl' do
      IFormat.wsdl = 'http://example.com/wsdl.xml'
      IFormat.wsdl.must_equal 'http://example.com/wsdl.xml'
    end
  end

  describe '.username' do
    it 'returns the default username' do
      IFormat.username.must_equal nil
    end
  end

  describe '.username=' do
    it 'sets the username' do
      IFormat.username = 'iFormat Username'
      IFormat.username.must_equal 'iFormat Username'
    end
  end

  describe '.password' do
    it 'returns the default password' do
      IFormat.password.must_equal nil
    end
  end

  describe '.password=' do
    it 'sets the password' do
      IFormat.password = '<PASSWORD>'
      IFormat.password.must_equal '<PASSWORD>'
    end
  end

end<commit_msg>Add tests for configuration in block and reading configuration options as Hash<commit_after>require 'helper'

describe IFormat do

  after do
    IFormat.reset
  end

  describe '.wsdl' do
    it 'returns the default wsdl' do
      IFormat.wsdl.must_equal 'http://wsdl.iformat.pl/api.xml'
    end
  end

  describe '.wsdl=' do
    it 'sets custom wsdl' do
      IFormat.wsdl = 'http://example.com/wsdl.xml'
      IFormat.wsdl.must_equal 'http://example.com/wsdl.xml'
    end
  end

  describe '.username' do
    it 'returns the default username' do
      IFormat.username.must_equal nil
    end
  end

  describe '.username=' do
    it 'sets the username' do
      IFormat.username = 'iFormat Username'
      IFormat.username.must_equal 'iFormat Username'
    end
  end

  describe '.password' do
    it 'returns the default password' do
      IFormat.password.must_equal nil
    end
  end

  describe '.password=' do
    it 'sets the password' do
      IFormat.password = '<PASSWORD>'
      IFormat.password.must_equal '<PASSWORD>'
    end
  end

  describe '.configure' do
    it 'sets the configuration in a block' do
      IFormat.configure do |config|
        config.wsdl     = 'http://example.com/wsdl.xml'
        config.username = 'iFormat Username'
        config.password = '<PASSWORD>'
      end

      IFormat.wsdl.must_equal 'http://example.com/wsdl.xml'
      IFormat.username.must_equal 'iFormat Username'
      IFormat.password.must_equal '<PASSWORD>'
    end
  end

  describe '.options' do
    it 'returns configuration as Hash' do
      IFormat.configure do |config|
        config.wsdl     = 'http://example.com/wsdl.xml'
        config.username = 'iFormat Username'
        config.password = '<PASSWORD>'
      end

      options = IFormat.options
      options[:wsdl].must_equal 'http://example.com/wsdl.xml'
      options[:username].must_equal 'iFormat Username'
      options[:password].must_equal '<PASSWORD>'
    end
  end

end
{'fraction_non_alphanumeric': 0.09935352160598843, 'fraction_numerical': 0.0, 'mean_word_length': 2.572296476306197, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '3059104', 'n_tokens_mistral': 965, 'n_tokens_neox': 941, 'n_words': 258}