test/unit/tab_helper_test.rb in exlibris-aleph-0.1.2 vs test/unit/tab_helper_test.rb in exlibris-aleph-0.1.3

- old
+ new

@@ -1,12 +1,12 @@ require 'test_helper' class ConfigHelperTest < ActiveSupport::TestCase def setup - Exlibris::Aleph::TabHelper.class_variable_set(:@@adms, []) - Exlibris::Aleph::TabHelper.class_variable_set(:@@refresh_time, ->{1.day.ago}) + Exlibris::Aleph::TabHelper.send(:class_variable_set, :@@adms, []) + Exlibris::Aleph::TabHelper.send(:class_variable_set, :@@refresh_time, lambda{1.day.ago}) @adms = ["NYU50", "NYU51"] - @tab_path = "/mnt/aleph_tab" + @tab_path = "#{Rails.root}/../mnt/aleph_tab" dummy_path = "#{File.dirname(__FILE__)}/../dummy" @yml_path = File.join(dummy_path, "config/aleph") @log_path = File.join(dummy_path, "log/aleph") end @@ -26,21 +26,21 @@ end test "init" do Exlibris::Aleph::TabHelper.init(@tab_path, @adms) helper = Exlibris::Aleph::TabHelper.instance - assert_equal(@adms, helper.adms) + assert_equal(["nyu50", "nyu51"], helper.adms) end test "instance" do Exlibris::Aleph::TabHelper.init(@tab_path, @adms) assert_nothing_raised() { Exlibris::Aleph::TabHelper.send(:new) } assert_same(Exlibris::Aleph::TabHelper.instance, Exlibris::Aleph::TabHelper.instance) end test "refresh" do - Exlibris::Aleph::TabHelper.init(@tab_path, @adms, ->{1.second.ago}) + Exlibris::Aleph::TabHelper.init(@tab_path, @adms, lambda{1.second.ago}) helper = Exlibris::Aleph::TabHelper.instance helper.sub_libraries updated_at_1 = helper.updated_at helper.sub_libraries updated_at_2 = helper.updated_at @@ -200,12 +200,12 @@ test "refresh_yml" do Exlibris::Aleph::TabHelper.init(@tab_path, @adms) helper = Exlibris::Aleph::TabHelper.instance assert_nil(helper.sub_libraries["NEW__"]) - sub_library_file = "/mnt/aleph_tab/alephe/tab/tab_sub_library.eng" + sub_library_file = "#{Rails.root}/../mnt/aleph_tab/alephe/tab/tab_sub_library.eng" file = File.open(sub_library_file, 'r') - old_size = file.size + old_size = File.size(sub_library_file) file.close # Update the file. File.open(sub_library_file, 'a') {|f| f.puts "NEW__ 1 NYU50 L NYU TEST BOBST BOBST BOBST BOBST NYU50 ALEPH" } Exlibris::Aleph::TabHelper.refresh_yml helper.send(:refresh) \ No newline at end of file