Skip to content

Commit

Permalink
More changes for Harvest Process logs #WEB-1939
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Leary committed Jan 5, 2011
1 parent bb7ff25 commit bf45460
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/views/admin/_navigation.html.haml
Expand Up @@ -72,8 +72,8 @@
= link_to 'content partner curated data', {:controller => 'administrator/content_partner_report', :action => 'report_partner_curated_data'}, {:class=>'toc_item active'}
%li
= link_to 'content partner objects stats', {:controller => 'administrator/content_partner_report', :action => 'report_partner_objects_stats'}, {:class=>'toc_item active'}


%li
= link_to 'view harvesting log', {:controller => 'administrator/harvesting_log', :action => 'index'}, {:class=>'toc_item active'}
%h3
Statistics
%li
Expand Down
7 changes: 7 additions & 0 deletions spec/factories.rb
Expand Up @@ -540,6 +540,13 @@ def attribution
hehe.association :status
end

Factory.define :harvest_process_log do |hpl|
hpl.process_name { Faker::Lorem.words[rand(4) + 1].titleize }
hpl.began_at { 2.hours.ago }
hpl.completed_at { 1.hours.ago }
end


Factory.define :hierarchy do |hierarchy|
hierarchy.label "A nested structure of divisions related to their probable evolutionary descent"
hierarchy.url ''
Expand Down
52 changes: 39 additions & 13 deletions spec/integration/admin_page_spec.rb
Expand Up @@ -83,6 +83,32 @@
end
end

describe ': harvesting logs' do
it 'should load an empty harvesting logs page' do
login_as(@user)
current_path.should == '/'
visit('/administrator/harvesting_log')
body.should include("No harvesting logs")
end

it 'should show harvesting_logs' do
harvest_process_log = HarvestProcessLog.gen(:process_name => 'Some test term that wont normally show up', :began_at => 1.day.ago)
login_as(@user)
visit('/administrator/harvesting_log')
body.should include(harvest_process_log.process_name)
body.should include(harvest_process_log.began_at.mysql_timestamp)

visit('/administrator/harvesting_log?date=')
body.should include(harvest_process_log.process_name)
body.should include(harvest_process_log.began_at.mysql_timestamp)

previous_day = 2.days.ago.strftime("%d-%b-%Y")
visit('/administrator/harvesting_log?date=' + previous_day)
body.should_not include(harvest_process_log.process_name)
body.should include("No harvesting logs")
end
end

describe ': monthly published partners' do
before(:all) do
last_month = Time.now - 1.month
Expand All @@ -100,14 +126,14 @@
visit("/administrator/content_partner_report/report_monthly_published_partners")
body.should include "New content partners for the month"
end

it "should get data from a form and display published partners" do
login_as(@user)
current_path.should == '/'
visit("/administrator/content_partner_report/report_monthly_published_partners", :method => :post, :params => {:year_month => @year_month})
#visit("/administrator/content_partner_report/report_monthly_published_partners")
#select "", :year_month => @year_month

body.should have_tag("form[action=/administrator/content_partner_report/report_monthly_published_partners]")
body.should include "New content partners for the month"
body.should include @agent.full_name
Expand All @@ -131,39 +157,39 @@

@taxon_concept = TaxonConcept.gen(:published => 1, :supercedure_id => 0)
@data_objects_taxon_concept = DataObjectsTaxonConcept.gen(:data_object_id => @data_object.id, :taxon_concept_id => @taxon_concept.id)

@action_with_object = ActionWithObject.gen()
@changeable_object_type = ChangeableObjectType.gen()#id = 1 = data_object
@action_history = ActionsHistory.gen(:object_id => @data_object.id, :action_with_object_id => @action_with_object.id, :changeable_object_type_id => @changeable_object_type.id)

end

it "should show report_partner_curated_data page" do
login_as(@user)
current_path.should == '/'
visit("/administrator/content_partner_report/report_partner_curated_data")
body.should include "Curation activity:"
end

it "should get data from a form and display curation activity" do
login_as(@user)
current_path.should == '/'
visit("/administrator/content_partner_report/report_partner_curated_data", :method => :post, :params => {:agent_id => @agent.id})
#visit("/administrator/content_partner_report/report_partner_curated_data")
#select "", :agent_id => @agent.id

body.should have_tag("form[action=/administrator/content_partner_report/report_partner_curated_data]")
body.should include "Curation activity:"
body.should include @agent.full_name
end

it "should get data from a form and display a month's curation activity" do
login_as(@user)
current_path.should == '/'
visit("/administrator/content_partner_report/report_partner_curated_data", :method => :post, :params => {:agent_id => @agent.id, :year_month => @year_month})
#visit("/administrator/content_partner_report/report_partner_curated_data")
#select "", :agent_id => @agent.id, :year_month => @year_month

body.should have_tag("form[action=/administrator/content_partner_report/report_partner_curated_data]")
body.should include "Curation activity:"
body.should include @agent.full_name
Expand All @@ -178,14 +204,14 @@
@agent_resource = AgentsResource.gen(:agent_id => @agent.id, :resource_id => @resource.id)
@harvest_event = HarvestEvent.gen(:resource_id => @resource.id, :published_at => last_month)
end

it "should show report_partner_objects_stats page" do
login_as(@user)
current_path.should == '/'
visit("/administrator/content_partner_report/report_partner_objects_stats")
body.should include "Viewing Partner:"
end

it "should get data from a form and display harvest events" do
login_as(@user)
current_path.should == '/'
Expand All @@ -197,7 +223,7 @@
body.should include @agent.full_name
body.should include @resource.title
end

it "should link to data objects stats per harvest event" do
login_as(@user)
current_path.should == '/'
Expand All @@ -207,15 +233,15 @@
body.should include "#{@harvest_event.id}\n"
end
end

describe ': table of contents breakdown' do
it "should show table of contents breakdown page" do
login_as(@user)
visit("/administrator/stats/toc_breakdown")
body.should include "Table of Contents Breakdown"
end
end

describe ': user activity view' do
before(:each) do
@activity = Activity.gen(:name => "sample activity")
Expand Down

0 comments on commit bf45460

Please sign in to comment.