<commit_before>require 'test/unit'
require 'watir-webdriver'

# FIXME: questions for Louise:
#
# * resolve exit status oddness if assert fails before browser is quit (something to do with subprocesses perhaps?)
# * correct way to list rail dependencies for makefile
# * how to specify the url to connect to - ENV perhaps?
# * achieve more DRY
# * what noob errors have I made :) ?



class Basics < Test::Unit::TestCase

  def test_exit_code_correctly_produced
    b = Watir::Browser.new :chrome
    b.goto 'http://test.127-0-0-1.org.uk:3000/'
    assert_match( /PopIt/, b.text )
    # flunk('before b.quit') # this will exit(0)
    b.quit
    flunk( 'after b.quit' ) # this will exit(1)
  end

end<commit_msg>Put repetetive test stuff into a class that we can inherit<commit_after>require 'test/unit'
require 'watir-webdriver'

# FIXME: questions for Louise:
#
# * resolve exit status oddness if assert fails before browser is quit (something to do with subprocesses perhaps?)
# * correct way to list rail dependencies for makefile
# * how to specify the url to connect to - ENV perhaps?
# * achieve more DRY
# * what noob errors have I made :) ?


class PopItWatirTestCase < Test::Unit::TestCase

  def setup
    @b = Watir::Browser.new :chrome
    @b.goto 'http://test.127-0-0-1.org.uk:3000/'
  end

  def teardown
    @b.quit
  end

end


class Basics < PopItWatirTestCase

  def test_exit_code_correctly_produced
    b = @b
    b.goto '/'
    assert_match( /PopIt/, b.text )
  end

end
{'fraction_non_alphanumeric': 0.10134228187919463, 'fraction_numerical': 0.01476510067114094, 'mean_word_length': 3.4909638554216866, 'pattern_counts': {'":': 0, '<': 6, '<?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': '7461435', 'n_tokens_mistral': 509, 'n_tokens_neox': 483, 'n_words': 169}