<commit_before>require "test_helper"
require_relative 'support/ui_test_helper'

class CreateNewServiceVersionTest < Capybara::Rails::TestCase
  include UITestHelper
  include Warden::Test::Helpers
  after { Warden.test_reset! }

  setup do
    login_as users(:pablito), scope: :user
    visit root_path
    find('#user-menu').click
    within '#user-menu' do
      click_link('Mis Servicios')
    end
    page.find(:xpath, '//table/tbody/tr[1]').click
    assert_content ('servicio_1')
    click_link('Nueva Revisión')
    assert_content page, "Seleccionar Archivo"
    page.execute_script('$("input[type=file]").show()')
  end

  test "attempt to create a service without an attached file" do
    click_button "Subir Nueva Revisión"
    assert_content page, "No se pudo crear la revisión"
  end

  test "attempt to create a service with an invalid file" do
    attach_file 'service_version_spec_file', Rails.root.join('README.md')
    click_button "Subir Nueva Revisión"
    assert_content page, "Archivo no está en formato JSON o YAML"
  end

  test "create a valid service" do
    attach_file 'service_version_spec_file', Rails.root.join(
      'test', 'files', 'sample-services', 'petsfull.yaml')
    click_button "Subir Nueva Revisión"
    assert_content page, "Nueva revisión creada correctamente"
  end
end
<commit_msg>Remove new service version test for no valid specs<commit_after>require "test_helper"
require_relative 'support/ui_test_helper'

class CreateNewServiceVersionTest < Capybara::Rails::TestCase
  include UITestHelper
  include Warden::Test::Helpers
  after { Warden.test_reset! }

  setup do
    login_as users(:pablito), scope: :user
    visit root_path
    find('#user-menu').click
    within '#user-menu' do
      click_link('Mis Servicios')
    end
    page.find(:xpath, '//table/tbody/tr[1]').click
    assert_content ('servicio_1')
    click_link('Nueva Revisión')
    assert_content page, "Seleccionar Archivo"
    page.execute_script('$("input[type=file]").show()')
  end

  test "attempt to create a service without an attached file" do
    click_button "Subir Nueva Revisión"
    assert_content page, "No se pudo crear la revisión"
  end

  test "create a valid service" do
    attach_file 'service_version_spec_file', Rails.root.join(
      'test', 'files', 'sample-services', 'petsfull.yaml')
    click_button "Subir Nueva Revisión"
    assert_content page, "Nueva revisión creada correctamente"
  end
end

{'fraction_non_alphanumeric': 0.10282671036460467, 'fraction_numerical': 0.0016386726751331422, 'mean_word_length': 4.262931034482759, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3100546', 'n_tokens_mistral': 798, 'n_tokens_neox': 789, 'n_words': 215}