<commit_before># encoding: utf-8

require 'watir-webdriver'
require_relative 'intra_page.rb'

class Branches < IntraPage
  def visit
    @browser.goto intranet(:branches)
    self
  end

  def filter(branch_name)
    @browser.div(:id => "branchest_filter").text_field().set branch_name
    self
  end

  def delete(branch_name, branch_code)
    @browser.link(:href => "?branchcode=" + branch_code + "&branchname=" + branch_name + "&op=delete").click
    form = @browser.form(:action => "/cgi-bin/koha/admin/branches.pl")
    if form.text.include?(branch_code)
      form.submit
    end
    self
  end

  def create(branch_name, branch_code)
    @browser.link(:id => "newbranch").click
    form = @browser.form(:name => "Aform")
    form.text_field(:id => "branchname").set branch_name
    form.text_field(:id => "branchcode").set branch_code
    form.submit
    @browser.form(:name => "Aform").should_not be_present
    self
  end

  def exists(branch_name, branch_code)
    # todo - rewrite as matcher?
    table = @browser.table(:id => "branchest")
    table.should be_present
    table.text.should include(branch_name)
    table.text.should include(branch_code)
    self
  end

  def show_all
    @browser.select_list(:name => "branchest_length").select_value("-1")
  end

  def all_exists(branches)
    # todo - split into better data table
    rows = @browser.table(:id => "branchest").tbody.rows
    orig = []
    rows.each do |row|
      orig << { :branchname => row[0].text, :branchcode => row[1].text }
    end

    csv = []
    CSV.foreach(branches, {
                             :headers => true,
                             :encoding => 'UTF-8',
                             :header_converters => :symbol
                         }) do |c|
      csv << { :branchname => c[:branchname], :branchcode => c[:branchcode] }
    end
    # Array comparison
    a = (orig & csv == orig)
    b = (csv & orig == csv)

    a.should != true
    b.should == true
    self
  end
end<commit_msg>Fix wrong use of 'should !='<commit_after># encoding: utf-8

require 'watir-webdriver'
require_relative 'intra_page.rb'

class Branches < IntraPage
  def visit
    @browser.goto intranet(:branches)
    self
  end

  def filter(branch_name)
    @browser.div(:id => "branchest_filter").text_field().set branch_name
    self
  end

  def delete(branch_name, branch_code)
    @browser.link(:href => "?branchcode=" + branch_code + "&branchname=" + branch_name + "&op=delete").click
    form = @browser.form(:action => "/cgi-bin/koha/admin/branches.pl")
    if form.text.include?(branch_code)
      form.submit
    end
    self
  end

  def create(branch_name, branch_code)
    @browser.link(:id => "newbranch").click
    form = @browser.form(:name => "Aform")
    form.text_field(:id => "branchname").set branch_name
    form.text_field(:id => "branchcode").set branch_code
    form.submit
    @browser.form(:name => "Aform").should_not be_present
    self
  end

  def exists(branch_name, branch_code)
    # todo - rewrite as matcher?
    table = @browser.table(:id => "branchest")
    table.should be_present
    table.text.should include(branch_name)
    table.text.should include(branch_code)
    self
  end

  def show_all
    @browser.select_list(:name => "branchest_length").select_value("-1")
  end

  def all_exists(branches)
    # todo - split into better data table
    rows = @browser.table(:id => "branchest").tbody.rows
    orig = []
    rows.each do |row|
      orig << { :branchname => row[0].text, :branchcode => row[1].text }
    end

    csv = []
    CSV.foreach(branches, {
                             :headers => true,
                             :encoding => 'UTF-8',
                             :header_converters => :symbol
                         }) do |c|
      csv << { :branchname => c[:branchname], :branchcode => c[:branchcode] }
    end
    # Array comparison
    a = (orig & csv == orig)
    b = (csv & orig == csv)

    a.should_not == true
    b.should == true
    self
  end
end
{'fraction_non_alphanumeric': 0.1383270911360799, 'fraction_numerical': 0.0024968789013732834, 'mean_word_length': 2.589605734767025, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 39, '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': '1675665', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1311, 'n_words': 280}