This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application. | |
ENGINE_ROOT = File.expand_path('../..', __FILE__) | |
ENGINE_PATH = File.expand_path('../../lib/hydramata/institution/engine', __FILE__) | |
require 'rails/all' | |
require 'rails/engine/commands' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GroupMembershipForm | |
include Virtus.model | |
include ActiveModel::Validations | |
extend ActiveModel::Naming | |
attributes :group_id, String | |
attributes :members, Array[MembershipRole] | |
validates :group_id, presence: true | |
def save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hydramata::Connection | |
include Virtus.model | |
include ActiveModel::Validations | |
extend ActiveModel::Naming | |
attribute :current_user, User | |
attribute :group_id, String | |
attribute :user_id, String | |
attribute :role, Sting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe GroupMembershipForm do | |
let(:group) { Group.new } | |
let(:group_id) { 'abc:123'} | |
let(:person) { Person.new } | |
let(:member_id) { 'abc:456'} | |
let(:params) { | |
{ | |
# These are the parameters that are generated in the existing form. | |
"group_id" => group_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubydora/repository' | |
require 'rubydora/rest_api_client' | |
require 'active_fedora/digital_object' | |
require 'active_fedora/base' | |
module Rubydora | |
class PerformedSoftDelete < RuntimeError | |
attr_reader :options | |
def initialize(method_name, pid, options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Do not create profile pages for new contributors when works are submitted | |
# https://jira.duraspace.org/browse/HYDRASIR-275 | |
Scenario Outline: Associate with contributor to a person | |
Given I am an authenticated user | |
And I am on the <action_name> work page | |
When I fill out the type ahead search for a contributor | |
And select a person | |
And submit a valid form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def datastream_to_show | |
super | |
rescue Exception => e | |
if params[:datastream_id] == 'thumbnail' | |
redirect_to 'path/to/default thumbnail' | |
return false | |
else | |
raise e | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a-gem/lib/hydra_permlink/spec_support.rb | |
require 'rspec' | |
shared_examples 'a permalinked object' do |options| | |
let(:model) { described_class.new } | |
included_services = options.fetch(:services) | |
if included_services.include?(:doi) | |
it 'should permalink to a DOI' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CurationConcern::GenericWorksController < CurationConcern::BaseController | |
before_filter :rip_out_viral_files, only: [:create, :update] | |
def rip_out_viral_files | |
files = attributes_for_actor(:files) | |
good_files = [] | |
viral_files = [] | |
files.each do |file| | |
if viral?(file) | |
viral_files << file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wU | |
content = `pbpaste`.strip | |
def columnize(line) | |
line.sub(/\A\|(.*)\|\s*\Z/, '\1').split("|") | |
end | |
lines = content.split("\n") | |
column_count = columnize(lines.first).size |
OlderNewer