Commit abeb2ebb9003691eaaad08871912932ed691c7d9

Authored by Evandro Jr
1 parent b6e87108

new unit tests added

plugins/virtuoso/test/unit/dspace_harvest_test.rb
@@ -23,6 +23,8 @@ class DspaceHarvestTest < ActiveSupport::TestCase @@ -23,6 +23,8 @@ class DspaceHarvestTest < ActiveSupport::TestCase
23 end 23 end
24 24
25 should 'create delayed job when start' do 25 should 'create delayed job when start' do
  26 + @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, mock_settings)
  27 + @settings.save!
26 harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace1.noosfero.com") 28 harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace1.noosfero.com")
27 assert !harvest.find_job.present? 29 assert !harvest.find_job.present?
28 harvest.start 30 harvest.start
@@ -30,16 +32,14 @@ class DspaceHarvestTest < ActiveSupport::TestCase @@ -30,16 +32,14 @@ class DspaceHarvestTest < ActiveSupport::TestCase
30 end 32 end
31 33
32 should 'not duplicate harvest job' do 34 should 'not duplicate harvest job' do
  35 + @settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin, mock_settings)
  36 + @settings.save!
33 harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace1.noosfero.com") 37 harvest = VirtuosoPlugin::DspaceHarvest.new(environment, "http://dspace1.noosfero.com")
34 assert_difference "harvest.find_job.count", 1 do 38 assert_difference "harvest.find_job.count", 1 do
35 5.times { harvest.start } 39 5.times { harvest.start }
36 end 40 end
37 end 41 end
38 42
39 - should 'harvest all dspaces from start' do  
40 - VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true)  
41 - end  
42 -  
43 should 'try to harvest all dspaces from start without any setting' do 43 should 'try to harvest all dspaces from start without any setting' do
44 VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true) 44 VirtuosoPlugin::DspaceHarvest.harvest_all(environment, true)
45 end 45 end