<commit_before>require_relative 'app_controller_test_base'

class DashboardControllerTest < AppControllerTestBase

  def setup_runner_class
    set_runner_class('StubRunner')
  end

  def prepare
    set_storer_class('FakeStorer')
    create_kata
  end

  #- - - - - - - - - - - - - - - -

  test '62A971',
  'dashboard when no avatars' do
    prepare
    dashboard
    options = [ false, true, 'xxx' ]
    options.each do |mc|
      options.each do |ar|
        dashboard minute_columns: mc, auto_refresh: ar
      end
    end
    # How do I test @attributes in the controller object?
  end

  #- - - - - - - - - - - - - - - -

  test '62A29E',
  'dashboard when avatars with no traffic-lights' do
    prepare
    4.times { start }
    dashboard
  end

  #- - - - - - - - - - - - - - - -

  test '62AE43',
  'dashboard when avatars with some traffic lights' do
    prepare
    3.times { start; 2.times { run_tests } }
    dashboard
  end

  #- - - - - - - - - - - - - - - -

  test '62A6CB',
  'heartbeat when no avatars' do
    prepare
    heartbeat
  end

  #- - - - - - - - - - - - - - - -

  test '62A1FB',
  'heartbeat when avatars with no traffic-lights' do
    prepare
    start
    heartbeat
  end

  #- - - - - - - - - - - - - - - -

  test '62A785',
  'heartbeat when some traffic-lights' do
    prepare
    3.times { start; 2.times { run_tests } }
    heartbeat
  end

  #- - - - - - - - - - - - - - - -

  test '62A330',
  'progress when no avatars' do
    prepare
    progress
  end

  #- - - - - - - - - - - - - - - -

  test '62A619',
  'progress when avatars with no traffic-lights' do
    prepare
    start # 0
    progress
  end

  #- - - - - - - - - - - - - - - -

  test '62A4FE',
  'progress when avatar has only amber traffic-lights' do
    prepare
    start # 0
    set_ragger_class('StubRagger')
    ragger.stub_colour(:amber)
    run_tests
    progress
  end

  #- - - - - - - - - - - - - - - -

  private

  def dashboard(params = {})
    params[:id] = @id
    get 'dashboard/show', params
    assert_response :success
  end

  def heartbeat
    params = { :format => :js, :id => @id }
    get 'dashboard/heartbeat', params
    assert_response :success
  end

  def progress
    params = { :format => :js, :id => @id }
    get 'dashboard/progress', params
    assert_response :success
  end

end
<commit_msg>added test for line missed by SimpleCov coverage - revealed by putting body of block onto its own line<commit_after>require_relative 'app_controller_test_base'

class DashboardControllerTest < AppControllerTestBase

  def setup_runner_class
    set_runner_class('StubRunner')
  end

  def prepare
    set_storer_class('FakeStorer')
    create_kata('Java, JUnit')
  end

  #- - - - - - - - - - - - - - - -

  test '62A971',
  'dashboard when no avatars' do
    prepare
    dashboard
    options = [ false, true, 'xxx' ]
    options.each do |mc|
      options.each do |ar|
        dashboard minute_columns: mc, auto_refresh: ar
      end
    end
    # How do I test @attributes in the controller object?
  end

  #- - - - - - - - - - - - - - - -

  test '62A29E',
  'dashboard when avatars with no traffic-lights' do
    prepare
    4.times { start }
    dashboard
  end

  #- - - - - - - - - - - - - - - -

  test '62AE43',
  'dashboard when avatars with some traffic lights' do
    prepare
    3.times { start; 2.times { run_tests } }
    dashboard
  end

  #- - - - - - - - - - - - - - - -

  test '62A6CB',
  'heartbeat when no avatars' do
    prepare
    heartbeat
  end

  #- - - - - - - - - - - - - - - -

  test '62A1FB',
  'heartbeat when avatars with no traffic-lights' do
    prepare
    start
    heartbeat
  end

  #- - - - - - - - - - - - - - - -

  test '62A785',
  'heartbeat when some traffic-lights' do
    prepare
    3.times { start; 2.times { run_tests } }
    heartbeat
  end

  #- - - - - - - - - - - - - - - -

  test '62A330',
  'progress when no avatars' do
    prepare
    progress
  end

  #- - - - - - - - - - - - - - - -

  test '62A619',
  'progress when avatars with no traffic-lights' do
    prepare
    start # 0
    progress
  end

  #- - - - - - - - - - - - - - - -

  test '62A4FE',
  'progress when avatar has only amber traffic-lights' do
    prepare
    start # 0
    set_ragger_class('StubRagger')
    ragger.stub_colour(:amber)
    run_tests
    progress
  end

  #- - - - - - - - - - - - - - - -

  test '62A920',
  'progress when avatar has only non-amber traffic-lights' do
    prepare
    start # 0
    set_ragger_class('StubRagger')
    ragger.stub_colour(:red)
    run_tests
    progress
  end

  private

  def dashboard(params = {})
    params[:id] = @id
    get 'dashboard/show', params
    assert_response :success
  end

  def heartbeat
    params = { :format => :js, :id => @id }
    get 'dashboard/heartbeat', params
    assert_response :success
  end

  def progress
    params = { :format => :js, :id => @id }
    get 'dashboard/progress', params
    assert_response :success
  end

end

{'fraction_non_alphanumeric': 0.13662849105887082, 'fraction_numerical': 0.018886879646373318, 'mean_word_length': 1.7172489082969433, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5202173', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1777, 'n_words': 432}