Skip to content

Instantly share code, notes, and snippets.

cjcolvar

Block or report user

Report or block cjcolvar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6295759
it "should be able to change group name when authenticated and authorized" do
login_as('policy_editor')
new_group_name = Faker::Lorem.word
post 'update', group_name: new_group_name, new_user: "", id: group.name
new_group = Admin::Group.find(new_group_name)
new_group.should_not be_nil
p group.inspect
p new_group.inspect
View gist:6232417
diff --git a/lib/avalon/batch_ingest.rb b/lib/avalon/batch_ingest.rb
index 62d7c6d..9b2cc62 100644
--- a/lib/avalon/batch_ingest.rb
+++ b/lib/avalon/batch_ingest.rb
@@ -56,16 +56,18 @@ module Avalon
base_errors = []
email_address = package.manifest.email || Avalon::Configuration['email']['notification']
current_user = User.where(username: email_address).first || User.where(email: email_address).first
- ability = Ability.new current_user
- ability.instance_variable_set("@user", current_user)
@cjcolvar
cjcolvar / bar_history2.rb
Created Aug 12, 2013
Example of implementing ActiveModel::Dirty on a ActiveFedora::Base subclass
View bar_history2.rb
class BarHistory2 < ActiveFedora::Base
include ActiveModel::Dirty
has_metadata 'xmlish', :type=>BarStream2
delegate_to 'xmlish', [:donkey, :cow]
after_save :clear_changed_attributes
define_attribute_methods [:donkey, :cow]
@cjcolvar
cjcolvar / gist:6186776
Created Aug 8, 2013
Adding field_changed? methods to AF delegations
View gist:6186776
diff --git a/lib/active_fedora/delegating.rb b/lib/active_fedora/delegating.rb
index d2a3a29..d805514 100644
--- a/lib/active_fedora/delegating.rb
+++ b/lib/active_fedora/delegating.rb
@@ -72,6 +72,7 @@ module ActiveFedora
if ds_specs.has_key? to.to_s
create_delegate_reader(fields.first, options)
create_delegate_setter(fields.first, options)
+ create_delegate_changed?(fields.first, options)
else
@cjcolvar
cjcolvar / gist:6055470
Created Jul 22, 2013
fix for AMS loading issue?
View gist:6055470
diff --git a/src/flash/htmlelements/VideoElement.as b/src/flash/htmlelements/VideoElement.as
index 700ecdf..e1d460a 100644
--- a/src/flash/htmlelements/VideoElement.as
+++ b/src/flash/htmlelements/VideoElement.as
@@ -202,6 +202,14 @@ package htmlelements
sendEvent(HtmlMediaEvent.SEEKED);
break;
+ case "NetStream.Seek.Complete":
+ if (_isPreloading) {
@cjcolvar
cjcolvar / gist:6021472
Created Jul 17, 2013
bugfix/search merged into HH-6 test failures
View gist:6021472
Failures:
1) CatalogController#index as an un-authenticated user should show results for items that are public and published
Failure/Error: assigns(:document_list).count.should eql(1)
expected: 1
got: 0
(compared using eql?)
# ./spec/controllers/catalog_controller_spec.rb:11:in `block (4 levels) in <top (required)>'
@cjcolvar
cjcolvar / Failures
Created Jul 15, 2013
Failing search tests
View Failures
[cjcolvar@localhost avalon]$ rspec spec/controllers/catalog_controller_spec.rb
Run options: exclude {:scaffold=>true}
..FF..FF
Failures:
1) CatalogController#index as an un-authenticated user should not show results for items that are not published
Failure/Error: assigns(:document_list).count.should eql(0)
expected: 0
@cjcolvar
cjcolvar / gist:5976510
Created Jul 11, 2013
AF::Base.delegate override to allow ActiveSupport's delegate
View gist:5976510
def self.delegate(*methods)
options = methods.last
if options.include?(:at) || options.include?(:unique)
super
else
Module.delegate(*methods)
end
end
@cjcolvar
cjcolvar / gist:5860032
Last active Dec 18, 2015
Test results
View gist:5860032
[cjcolvar@localhost avalon]$ rspec spec
/home/cjcolvar/.rvm/gems/ruby-1.9.3-p194@avalon/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
F.FF.FFF.FFFFFFFFFFFF*F.FFF.FF***F..F..FFFFF.FFF/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
F/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
F/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
*/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
*/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
*......FFF..F...F...........F....**.**F**............*............*........*.....*...*...
@cjcolvar
cjcolvar / uniqueness_validator_spec.rb
Created Jun 18, 2013
spec/validators/uniqueness_validator_spec.rb
View uniqueness_validator_spec.rb
require 'spec_helper'
describe "UniquenessValidator" do
before(:all) do
@solr_field = "title_t"
@validator = UniquenessValidator.new({:attributes => {}, :solr_name => @solr_field})
@record = stub(pid:"avalon:2")
@record.stub("errors").and_return([])
@record.errors.stub('[]').and_return({})
You can’t perform that action at this time.