<commit_before>require 'mumukit/bridge'

describe 'Server' do
  let(:bridge) { Mumukit::Bridge::Bridge.new('http://localhost:4567') }

  before(:all) do
    @pid = Process.spawn 'rackup -p 4567', err: '/dev/null'
    sleep 3
  end
  after(:all) { Process.kill 'TERM', @pid }

  it 'answers a valid hash when submission passes' do
    response = bridge.run_tests!(test: %q{
public void testFoo() {
  Assert.assertEquals(Foo.bar(), 2);
}}, extra: '', content: %q{
class Foo {
  public static int bar() {
    return 1;
  }
}}, expectations: [])

    expect(response).to eq(status: :passed,
                           result: "```\n.\n\n```",
                           expectation_results: [],
                           test_results: [],
                           feedback: '',
                           response_type: :unstructured)
  end


  it 'answers a valid hash when submission fails' do
    response = bridge.run_tests!(test: %q{
public void testFoo() {
  Assert.assertEquals(Foo.bar(), 2);
}}, extra: '', content: %q{
class Foo {
  public static int bar() {
    return 2;
  }
}}, expectations: [])

    expect(response).to eq(status: :failed,
                           result: "```\n.\n\n```",
                           expectation_results: [],
                           test_results: [],
                           feedback: '',
                           response_type: :unstructured)
  end



end<commit_msg>Fixing integration tests<commit_after>require 'active_support/all'
require 'mumukit/bridge'

describe 'Server' do
  let(:bridge) { Mumukit::Bridge::Bridge.new('http://localhost:4568') }

  before(:all) do
    @pid = Process.spawn 'rackup -p 4568', err: '/dev/null'
    sleep 8
  end
  after(:all) { Process.kill 'TERM', @pid }

  it 'answers a valid hash when submission passes' do
    response = bridge.run_tests!(test: %q{
@Test
public void testFoo() {
  Assert.assertEquals(Foo.bar(), 2);
}}, extra: '', content: %q{
class Foo {
  public static int bar() {
    return 2;
  }
}}, expectations: [])

    expect(response[:result]).to include('OK')
    expect(response[:status]).to eq(:passed)
  end


  it 'answers a valid hash when submission fails' do
    response = bridge.run_tests!(test: %q{
public void testFoo() {
  Assert.assertEquals(Foo.bar(), 2);
}}, extra: '', content: %q{
class Foo {
  public static int bar() {
    return 1;
  }
}}, expectations: [])

    expect(response[:status]).to eq(:failed)
    expect(response[:result]).to include('There was 1 failure')
  end



end
{'fraction_non_alphanumeric': 0.15452011150935882, 'fraction_numerical': 0.010752688172043012, 'mean_word_length': 2.498607242339833, 'pattern_counts': {'":': 0, '<': 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': '1746765', 'n_tokens_mistral': 826, 'n_tokens_neox': 758, 'n_words': 203}