Skip to content

Instantly share code, notes, and snippets.

Failure/Error: @f.audit!
Mocha::ExpectationError:
unexpected invocation: ChecksumAuditLog(id: integer, pid: string, dsid: string, version: string, pass: boolean, expected_result: string, actual_result: string, created_at: datetime, updated_at: datetime).create!(:pass => true, :pid => 'scholarsphere:05741r680', :dsid => 'DC', :version => 'DC1.0')
unsatisfied expectations:
- expected exactly once, not yet invoked: #<AnyInstance:FileContentDatastream>.dsChecksumValid(any_parameters)
- expected exactly once, not yet invoked: #<AnyInstance:FitsDatastream>.dsChecksumValid(any_parameters)
expected exactly once, not yet invoked: #<AnyInstance:ActiveFedora::RelsExtDatastream>.dsChecksumValid(any_parameters)
- expected exactly once, not yet invoked: ChecksumAuditLog(id: integer, pid: string, dsid: string, version: string, pass: boolean, expected_result: string, actual_result: string, created_at: datetime, updated_at: datetime).create!(:pass => false, :pid => 'scholarsphere:0
@carolyncole
carolyncole / gist:4707764
Created February 4, 2013 16:22
rspec errors
1) BatchController#update should not be editable
Failure/Error: ability.can?(:edit, @file2).should be_false
expected: false value
got: true
# ./spec/controllers/batch_controller_spec.rb:47:in `block (3 levels) in <top (required)>'
2) BatchController#update when user does not have edit permissions on a file should not modify the object
Failure/Error: file.title.should == ["Original Title"]
expected: ["Original Title"]
got: ["Title Wont Change"] (using ==)
@carolyncole
carolyncole / PRstats.md
Last active August 29, 2015 14:16
How to get Git PR Stats

Ever wonder how long your PRs take to get merged... I did.

  1. Grab the data using api.github.com and save it to a file
  • note: I had to do this in a browser as curl did not get it correctly. (Modify projecthydra/sufia to be your repo) https://api.github.com/repos/projecthydra/sufia/pulls?per_page=100&state=closed
  1. Parse it in the ruby console The code below will give you the average PR close time in hours.
f = File.new("prs.json”)
json = f.read
https://github.com/projecthydra/active_fedora/blob/7.x-stable/lib/active_fedora/reload_on_save.rb was removed
GenericFile it reloads if needed when reload is true calls reload
Failure/Error: file2.save
Ldp::EtagMismatch:
ETag mismatch
# /Users/cam156/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ldp-0.3.1/lib/ldp/client/methods.rb:108:in `block in check_for_errors'
# /Users/cam156/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ldp-0.3.1/lib/ldp/client/methods.rb:106:in `tap'
# /Users/cam156/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ldp-0.3.1/lib/ldp/client/methods.rb:106:in `check_for_errors'
CurationConcerns::CharacterizationService
characterize
characterizes, extracts fulltext and stores the results (FAILED - 1)
Failures:
1) CurationConcerns::CharacterizationService characterize characterizes, extracts fulltext and stores the results
Failure/Error: expect(generic_file.mime_type).to eq 'application/vnd.oasis.opendocument.text'
expected: "application/vnd.oasis.opendocument.text"
cam156@its-sas-tsb-88[~/archivesphere]> rails s
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/cam156/.rbenv/versions/2.2.2/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
-B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
@prefix nt: <http://www.jcp.org/jcr/nt/1.0> .
@prefix ns001: <http://purl.org/dc/terms/> .
@prefix test: <info:fedora/test/> .
@prefix ns002: <info:fedora/fedora-system:def/model#> .
@prefix ns003: <http://id.loc.gov/vocabulary/relators/> .
@prefix ns004: <http://www.w3.org/ns/auth/acl#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema> .
@prefix mode: <http://www.modeshape.org/1.0> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ns006: <http://scholarsphere.psu.edu/ns#> .
@carolyncole
carolyncole / gist:235e684f56c89849598a
Created November 4, 2015 20:18
Blacklight Search Build Ad Hock Query
class MySearchBuilder < Blacklight::Solr::SearchBuilder
def my_search_stuff(solr_parameters)
# optionally change facets
solr_parameters[:"facet.field"].concat([Solrizer.solr_name("my field", :symbol)])
# Optionally change facet limit
solr_parameters[:"facet.limit"] = my_count
# optionally filter the records
old
{"qt"=>"search", "facet.field"=>["resource_type_sim", "collection_sim", "creator_sim", "tag_sim", "subject_sim", "language_sim", "based_near_sim", "publisher_sim", "file_format_sim", "active_fedora_model_ssi"], "facet.query"=>[], "facet.pivot"=>[], "fq"=>["edit_access_group_ssim:public OR edit_access_group_ssim:registered OR edit_access_person_ssim:archivist1", "_query_:\"{!raw f=depositor_ssim}archivist1\"", "_query_:\"{!raw f=has_model_ssim}GenericFile\""], "hl.fl"=>[], "rows"=>10, "q"=>"titletitle", "facet"=>true, "f.resource_type_sim.facet.limit"=>6, "f.collection_sim.facet.limit"=>6, "f.creator_sim.facet.limit"=>6, "f.tag_sim.facet.limit"=>6, "f.subject_sim.facet.limit"=>6, "f.language_sim.facet.limit"=>6, "f.based_near_sim.facet.limit"=>6, "f.publisher_sim.facet.limit"=>6, "f.file_format_sim.facet.limit"=>6, "sort"=>"score desc, date_uploaded_dtsi desc", "qf"=>"title_tesim description_tesim tag_tesim subject_tesim creator_tesim contributor_tesim publisher_tesim based_near_tesim language_tesim date_
config.add_search_field('all_fields', label: 'All Fields', include_in_advanced_search: false) do |field|
all_names = config.index.search_fields.join(" ")
field.solr_parameters = {
qf: "#{all_names} id all_text_timv",
pf: "title_ssi"
}
end