Sha256: 81ab69e3447b598b03793849a23973a54058390d0bab4e4dc84c8e42247ca6c1

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

require 'test_helper'
class TabHelperBenchmarks < ActiveSupport::TestCase
  def setup
    @adms = ["NYU50", "NYU51"]
    @tab_path = "/mnt/aleph_tab"
    Exlibris::Aleph::TabHelper.class_variable_set(:@@adms, [])
    [ :@@patrons_path,
      :@@items_path,
      :@@item_permissions_by_item_status_path,
      :@@item_permissions_by_item_process_status_path,
      :@@collections_path,
      :@@pickup_locations_path ].each { |class_variable|
        Exlibris::Aleph::TabHelper.class_variable_set(class_variable, {}) }
    @TESTS = 10
  end

  # Get benchmarks for the Aleph TabHelper
  test "benchmarks_init" do
    # Display performance benchmarks.
    time = Benchmark.bmbm do |results|
      results.report("TabHelper init:") { @TESTS.times { 
        Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
      } }
    end
  end

  # Get benchmarks for the Aleph TabHelper
  test "benchmarks_new" do
    Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
    # Display performance benchmarks.
    time = Benchmark.bmbm do |results|
      results.report("TabHelper new:") { @TESTS.times { 
        [ :@@patrons_path,
          :@@items_path,
          :@@item_permissions_by_item_status_path,
          :@@item_permissions_by_item_process_status_path,
          :@@collections_path,
          :@@pickup_locations_path ].each { |class_variable|
            Exlibris::Aleph::TabHelper.class_variable_set(class_variable, {}) }
        Exlibris::Aleph::TabHelper.send(:new)
      } }    
    end
  end

  # Get benchmarks for the Aleph TabHelper
  test "benchmarks_refresh" do
    Exlibris::Aleph::TabHelper.init(@tab_path, @adms)
    helper = Exlibris::Aleph::TabHelper.instance
    # Display performance benchmarks.
    time = Benchmark.bmbm do |results|
      results.report("TabHelper refresh:") { @TESTS.times { 
        helper.refresh
      } }    
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exlibris-aleph-0.0.2 test/unit/tab_helper_benchmarks.rb
exlibris-aleph-0.0.1 test/unit/tab_helper_benchmarks.rb