<commit_before>describe 'Pacto' do
  let(:contract_path) { 'spec/integration/data/simple_contract.json' }
  let(:strict_contract_path) { 'spec/integration/data/strict_contract.json' }

  before :all do
    WebMock.allow_net_connect!
  end

  context 'Contract validation' do
    before :all do
      @server = Pacto::Server::Dummy.new 8000, '/hello', '{"message": "Hello World!"}'
      @server.start
    end

    after :all do
      @server.terminate
    end

    it 'verifies the contract against a producer' do
      contract = Pacto.build_contracts(contract_path, 'http://localhost:8000')
      expect(contract.validate_all.flatten).to be_empty
    end
  end

  context 'Stubbing a collection of contracts' do
    it 'generates a server that stubs the contract for consumers' do
      contracts = Pacto.build_contracts(contract_path, 'http://dummyprovider.com')
      contracts.stub_all

      response = get_json('http://dummyprovider.com/hello')
      expect(response['message']).to eq 'bar'
    end<commit_msg>eq is diffable, be_empty is not<commit_after>describe 'Pacto' do
  let(:contract_path) { 'spec/integration/data/simple_contract.json' }
  let(:strict_contract_path) { 'spec/integration/data/strict_contract.json' }

  before :all do
    WebMock.allow_net_connect!
  end

  context 'Contract validation' do
    before :all do
      @server = Pacto::Server::Dummy.new 8000, '/hello', '{"message": "Hello World!"}'
      @server.start
    end

    after :all do
      @server.terminate
    end

    it 'verifies the contract against a producer' do
      contract = Pacto.build_contracts(contract_path, 'http://localhost:8000')
      expect(contract.validate_all.flatten).to eq([])
    end
  end

  context 'Stubbing a collection of contracts' do
    it 'generates a server that stubs the contract for consumers' do
      contracts = Pacto.build_contracts(contract_path, 'http://dummyprovider.com')
      contracts.stub_all

      response = get_json('http://dummyprovider.com/hello')
      expect(response['message']).to eq 'bar'
    end
{'fraction_non_alphanumeric': 0.1126829268292683, 'fraction_numerical': 0.007804878048780488, 'mean_word_length': 3.557777777777778, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '3489453', 'n_tokens_mistral': 654, 'n_tokens_neox': 631, 'n_words': 156}