source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/work_view_stat_spec.rb
Ruby
apache-2.0
197
main
3,247
# frozen_string_literal: true RSpec.describe WorkViewStat, :clean_repo, type: :model do let(:work_id) { work.id } let(:user_id) { 123 } let(:date) { DateTime.new.in_time_zone } let(:work_stat) { described_class.create(work_views: "25", date: date, work_id: work_id, user_id: user_id) } let(:work) { valkyrie_cr...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/collection_branding_info_spec.rb
Ruby
apache-2.0
197
main
2,189
# frozen_string_literal: true RSpec.describe CollectionBrandingInfo, type: :model do let(:storage_adapter) { Hyrax.config.branding_storage_adapter } let(:banner_info) do described_class.new( collection_id: "123", filename: "banner.gif", role: "banner", alt_txt: "banner alt txt", t...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/user_mailbox_spec.rb
Ruby
apache-2.0
197
main
4,518
# frozen_string_literal: true RSpec.describe UserMailbox do let(:user) { create(:user) } let(:another_user) { create(:user) } before do another_user.send_message(user, "Test Message", "Test Subject") user.send_message(another_user, "Test Message", "Test Subject") end subject { described_clas...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/proxy_deposit_request_spec.rb
Ruby
apache-2.0
197
main
8,031
# frozen_string_literal: true RSpec.describe ProxyDepositRequest, type: :model do include ActionView::Helpers::UrlHelper let(:sender) { create(:user) } let(:receiver) { create(:user) } let(:receiver2) { create(:user) } let(:admin) { create(:admin) } let(:work_id) { '123abc' } let(:stubbed_work_query_serv...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/solr_hit_spec.rb
Ruby
apache-2.0
197
main
248
# frozen_string_literal: true RSpec.describe SolrHit do subject(:solr_hit) { described_class.new "id" => "my:_ID1_" } describe "#id" do it "extracts the id from the solr hit" do expect(solr_hit.id).to eq "my:_ID1_" end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/file_download_stat_spec.rb
Ruby
apache-2.0
197
main
3,423
# frozen_string_literal: true RSpec.describe FileDownloadStat, type: :model do let(:file_id) { file.id } let(:date) { Time.current } let(:file_stat) { described_class.new(downloads: "2", date: date, file_id: file_id) } let(:file) { mock_model('MockFileSet', id: 99) } it "has attributes" do expect(file_st...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/solr_document_spec.rb
Ruby
apache-2.0
197
main
6,636
# frozen_string_literal: true RSpec.describe ::SolrDocument, type: :model do subject(:document) { described_class.new(attributes) } let(:attributes) { {} } describe "#itemtype" do let(:attributes) { { resource_type_tesim: ['Article'] } } its(:itemtype) { is_expected.to eq 'http://schema.org/Article' } ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/featured_work_list_spec.rb
Ruby
apache-2.0
197
main
1,987
# frozen_string_literal: true RSpec.describe FeaturedWorkList, type: :model do let(:user) { create(:user) } let(:work1) { valkyrie_create(:hyrax_work) } let(:work2) { valkyrie_create(:hyrax_work) } describe 'featured_works' do before do create(:featured_work, work_id: work1.id) create(:featured...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/user_spec.rb
Ruby
apache-2.0
197
main
9,957
# frozen_string_literal: true RSpec.describe User, type: :model do let(:user) { build(:user) } let(:another_user) { build(:user) } describe 'verifying factories' do describe ':user' do let(:user) { build(:user) } it 'will, by default, have no groups' do expect(user.groups).to eq([]) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/access_control_spec.rb
Ruby
apache-2.0
197
main
5,227
# frozen_string_literal: true require 'valkyrie/specs/shared_specs' RSpec.describe Hyrax::AccessControl do subject(:access_control) { described_class.new } let(:permission) { build(:permission, access_to: Valkyrie::ID.new('moomin')) } it_behaves_like 'a Valkyrie::Resource' do let(:resource_klass) {...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/resource_spec.rb
Ruby
apache-2.0
197
main
1,959
# frozen_string_literal: true require 'hyrax/specs/shared_specs/hydra_works' require 'valkyrie/specs/shared_specs' RSpec.describe Hyrax::Resource do subject(:resource) { described_class.new } let(:adapter) { Valkyrie::Persistence::Memory::MetadataAdapter.new } it_behaves_like 'a Hyrax::Resource' descri...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/pageview_spec.rb
Ruby
apache-2.0
197
main
442
# frozen_string_literal: true RSpec.describe Hyrax::Pageview, type: :model do it 'has a pageviews metric' do expect(described_class.metrics).to be == Legato::ListParameter.new(:metrics, [:pageviews]) end it 'has a date dimension' do expect(described_class.dimensions).to be == Legato::ListParameter.new(:d...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/operation_spec.rb
Ruby
apache-2.0
197
main
4,426
# frozen_string_literal: true RSpec.describe Hyrax::Operation do describe '#status' do it 'is protected by enum enforcement' do expect { described_class.new(status: 'not_valid') }.to raise_error(ArgumentError) end # Because the Rails documentation says "Declare an enum attribute where the values ma...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/virus_scanner_spec.rb
Ruby
apache-2.0
197
main
1,165
# frozen_string_literal: true require 'spec_helper' RSpec.describe Hyrax::VirusScanner, :virus_scan do let(:file) { '/tmp/path' } let(:logger) { Logger.new(nil) } before { allow(Hyrax).to receive(:logger).and_return(logger) } subject { described_class.new(file) } context 'when Clamby is defined' do # In...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/model_registry_spec.rb
Ruby
apache-2.0
197
main
1,123
# frozen_string_literal: true require 'spec_helper' RSpec.describe Hyrax::ModelRegistry do %i[admin_set file_set collection work].each do |type| describe ".#{type}_class_names" do subject { described_class.public_send("#{type}_class_names") } it { is_expected.to be_a(Array) } it { is_expected...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/base_spec.rb
Ruby
apache-2.0
197
main
1,011
# frozen_string_literal: true RSpec.describe Hyrax::Base do describe '.uncached' do let(:block) { proc { puts 'I do nothing' } } it 'calls ActiveFedora::Base.uncached' do allow(ActiveFedora::Base).to receive(:uncached) described_class.uncached(&block) expect(ActiveFedora::Base).to have_rec...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/collection_type_spec.rb
Ruby
apache-2.0
197
main
9,071
# frozen_string_literal: true RSpec.describe Hyrax::CollectionType, type: :model do subject(:collection_type) { FactoryBot.build(:collection_type) } shared_context 'with a collection' do let(:collection_type) { FactoryBot.create(:collection_type) } let!(:collection) { FactoryBot.valkyrie_create(:hyrax_coll...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/user_usage_stats_spec.rb
Ruby
apache-2.0
197
main
1,465
# frozen_string_literal: true RSpec.describe Hyrax::UserUsageStats do subject { create(:user) } describe 'with cached stats' do let!(:stat_1_day_ago) { UserStat.create!(user_id: subject.id, date: 1.day.ago, file_views: 3, file_downloads: 2, work_views: 5) } let!(:stat_2_days_ago) { UserStat.create!(user_id...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/administrative_set_spec.rb
Ruby
apache-2.0
197
main
942
# frozen_string_literal: true require 'spec_helper' require 'hyrax/specs/shared_specs/hydra_works' RSpec.describe Hyrax::AdministrativeSet do it_behaves_like 'a Hyrax::AdministrativeSet' context 'when saving' do context 'with wings adapter' do let(:admin_set) { described_class.new(title: 'AdminSet with...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/work_spec.rb
Ruby
apache-2.0
197
main
1,173
# frozen_string_literal: true require 'spec_helper' require 'hyrax/specs/shared_specs/hydra_works' RSpec.describe Hyrax::Work do subject(:work) { described_class.new } it_behaves_like 'a Hyrax::Work' it 'can set and unset values' do work.title = ['moomin'] id = Hyrax.persister.save(resource: work).id ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/counter_metric_spec.rb
Ruby
apache-2.0
197
main
793
# frozen_string_literal: true require 'spec_helper' require 'rails_helper' RSpec.describe Hyrax::CounterMetric, type: :model do context 'validations' do it 'is valid with valid attributes' do counter_metric = build(:counter_metric) expect(counter_metric).to be_valid end end context 'require...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/uploaded_file_spec.rb
Ruby
apache-2.0
197
main
489
# frozen_string_literal: true RSpec.describe Hyrax::UploadedFile do let(:file1) { File.open(fixture_path + '/world.png') } subject { described_class.create(file: file1) } it "is not in the public directory" do temp_dir = Rails.root + 'tmp' expect(subject.file.path).to start_with temp_dir.to_s end i...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/pcdm_collection_spec.rb
Ruby
apache-2.0
197
main
821
# frozen_string_literal: true require 'spec_helper' require 'hyrax/specs/shared_specs/hydra_works' RSpec.describe Hyrax::PcdmCollection do subject(:collection) { described_class.new } it_behaves_like 'a Hyrax::PcdmCollection' describe '#name' do it 'uses a Collection-like name' do expect(subject.mod...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/permission_template_access_spec.rb
Ruby
apache-2.0
197
main
4,752
# frozen_string_literal: true RSpec.describe Hyrax::PermissionTemplateAccess do let(:permission_template) { create(:permission_template) } let(:permission_template_access) do create(:permission_template_access, :manage, permission_template: permission_template, agent_type: agent...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/permission_spec.rb
Ruby
apache-2.0
197
main
926
# frozen_string_literal: true require 'valkyrie/specs/shared_specs' RSpec.describe Hyrax::Permission do subject(:permission) { described_class.new } let(:resource_id) { Valkyrie::ID.new('fake_resource_id') } let(:user_id) { 'fake_user_id' } it_behaves_like 'a Valkyrie::Resource' do let(:resourc...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/default_administrative_set_spec.rb
Ruby
apache-2.0
197
main
1,667
# frozen_string_literal: true RSpec.describe Hyrax::DefaultAdministrativeSet, type: :model do describe '.update' do context 'when a default already exists' do let!(:existing_default) { FactoryBot.create(:stored_default_admin_set_id) } let(:new_default_id) { '123' } it 'updates the saved id to th...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/group_spec.rb
Ruby
apache-2.0
197
main
1,256
# frozen_string_literal: true RSpec.describe Hyrax::Group, type: :model do let(:name) { 'etaoin' } let(:group) { described_class.new(name) } describe '.from_agent_key' do it 'returns an equivalent group' do expect(described_class.from_agent_key(group.agent_key)).to eq group end end describe '...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/permission_template_spec.rb
Ruby
apache-2.0
197
main
12,666
# frozen_string_literal: true RSpec.describe Hyrax::PermissionTemplate, valkyrie_adapter: :test_adapter do subject(:permission_template) { described_class.new(attributes) } let(:attributes) { { source_id: admin_set.id } } let(:admin_set) { FactoryBot.valkyrie_create(:hyrax_admin_set) } it { is_expected.to have...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/collection_type_participant_spec.rb
Ruby
apache-2.0
197
main
2,224
# frozen_string_literal: true RSpec.describe Hyrax::CollectionTypeParticipant, type: :model do let(:collection_type_participant) { create(:collection_type_participant) } it 'has basic metadata' do expect(collection_type_participant).to respond_to(:agent_id) expect(collection_type_participant.agent_id).not_...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/lease_spec.rb
Ruby
apache-2.0
197
main
660
# frozen_string_literal: true require 'valkyrie/specs/shared_specs' RSpec.describe Hyrax::Lease, :frozen_time do subject(:lease) { described_class.new } it_behaves_like 'a Valkyrie::Resource' do let(:resource_klass) { described_class } end describe '#active' do subject(:lease) { FactoryBot.build(:hy...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/work_behavior_spec.rb
Ruby
apache-2.0
197
main
1,447
# frozen_string_literal: true RSpec.describe Hyrax::WorkBehavior do before do class EssentialWork < ActiveFedora::Base include Hyrax::WorkBehavior end end after do Object.send(:remove_const, :EssentialWork) end subject { EssentialWork.new } it 'mixes together some junk' do expect(sub...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/flexible_schema_spec.rb
Ruby
apache-2.0
197
main
10,458
# frozen_string_literal: true require 'rails_helper' RSpec.describe Hyrax::FlexibleSchema, :clean_repo, type: :model do let(:profile_file_path) { File.join(fixture_path, 'files', 'm3_profile.yaml') } let(:profile_data) { YAML.load_file(profile_file_path) } subject { described_class.create(profile: profile_data)...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/download_spec.rb
Ruby
apache-2.0
197
main
479
# frozen_string_literal: true RSpec.describe Hyrax::Download, type: :model do it 'has an events metric' do expect(described_class.metrics).to be == Legato::ListParameter.new(:metrics, [:totalEvents]) end it 'has dimensions' do expect(described_class.dimensions).to be == Legato::ListParameter.new(:dimensi...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/file_set_spec.rb
Ruby
apache-2.0
197
main
1,651
# frozen_string_literal: true require 'spec_helper' require 'hyrax/specs/shared_specs/hydra_works' RSpec.describe Hyrax::FileSet do subject(:file_set) { described_class.new } it_behaves_like 'a Hyrax::FileSet' describe '#human_readable_type' do it 'has a human readable type' do expect(file_set.human...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/file_metadata_spec.rb
Ruby
apache-2.0
197
main
7,550
# frozen_string_literal: true require 'valkyrie/specs/shared_specs' RSpec.describe Hyrax do describe ".FileMetadata()" do let(:file_set) { FactoryBot.valkyrie_create(:hyrax_file_set) } context 'when trying to cast a resource class' do it 'raises an argument error' do expect { described_class:...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/embargo_spec.rb
Ruby
apache-2.0
197
main
640
# frozen_string_literal: true require 'valkyrie/specs/shared_specs' RSpec.describe Hyrax::Embargo do subject(:embargo) { described_class.new } it_behaves_like 'a Valkyrie::Resource' do let(:resource_klass) { described_class } end describe '#active' do subject(:embargo) { described_class.new(embargo_...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/change_set_spec.rb
Ruby
apache-2.0
197
main
2,601
# frozen_string_literal: true require 'spec_helper' require 'hyrax/specs/shared_specs/simple_work.rb' require 'hyrax/specs/shared_specs/change_set' RSpec.describe Hyrax::ChangeSet do subject(:change_set) { described_class.for(resource) } let(:resource) { build(:hyrax_work) } let(:titles) { ['comet...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/batch_create_operation_spec.rb
Ruby
apache-2.0
197
main
1,646
# frozen_string_literal: true RSpec.describe Hyrax::BatchCreateOperation do subject { create(:batch_create_operation) } describe 'callbacks' do before do allow(Hyrax.config.callback).to receive(:set?).with(callback).and_return(callback_set) end describe '#batch_success_message' do let(:cal...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/permissions/readable_permissions_spec.rb
Ruby
apache-2.0
197
main
1,548
# frozen_string_literal: true RSpec.describe Hyrax::Permissions::Readable do class SubjectClass include Hyrax::Permissions::Readable attr_accessor :read_groups end let(:subject) { SubjectClass.new } describe '#public?' do it 'returns true for public items' do subject.read_groups = %w[public o...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/hyrax/permissions/writable_permissions_spec.rb
Ruby
apache-2.0
197
main
342
# frozen_string_literal: true RSpec.describe Hyrax::Permissions::Writable do class SampleModel < ActiveFedora::Base include Hyrax::Permissions::Writable end let(:subject) { SampleModel.new } describe '#permissions' do it 'initializes with nothing specified' do expect(subject.permissions).to be_em...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/concerns/hyrax/valkyrie_lazy_migration_spec.rb
Ruby
apache-2.0
197
main
2,289
# frozen_string_literal: true require 'spec_helper' require 'wings' RSpec.describe Hyrax::ValkyrieLazyMigration, :active_fedora do before do class MigratingFromWork < ActiveFedora::Base include Hyrax::WorkBehavior include Hyrax::CoreMetadata end class MigratingToResource < Hyrax::Work e...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/concerns/hyrax/naming_spec.rb
Ruby
apache-2.0
197
main
636
# frozen_string_literal: true RSpec.describe Hyrax::Naming do subject(:class_with_naming) do Hyrax::Test::Naming::TestClass end before do module Hyrax::Test::Naming class TestClass include ActiveModel::Model include Hyrax::Naming end end end after { Hyrax::Test.send(...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/concerns/hyrax/flexibility_spec.rb
Ruby
apache-2.0
197
main
2,186
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Hyrax::Flexibility' do before(:all) do module Hyrax::Test::Flexibility class TestWork < Hyrax::Resource end end end after(:all) do Hyrax::Test::Flexibility.send(:remove_const, :TestWork) end subject(:flexibility_c...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/concerns/hyrax/ability_spec.rb
Ruby
apache-2.0
197
main
3,971
# frozen_string_literal: true require 'cancan/matchers' RSpec.describe Hyrax::Ability do subject(:ability) { ability_class.new(user) } let(:user) { FactoryBot.create(:user) } shared_context 'with guest user' do let(:user) { FactoryBot.create(:user, :guest) } end shared_context 'with deposit access on a...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/concerns/hyrax/collection_behavior_spec.rb
Ruby
apache-2.0
197
main
903
# frozen_string_literal: true RSpec.describe Hyrax::CollectionBehavior, :active_fedora, :clean_repo do let(:collection) { create(:collection_lw) } let(:work) { FactoryBot.valkyrie_create(:hyrax_work) } describe "#destroy" do it "removes the collection id from associated members" do Hyrax::Collections:...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/concerns/hyrax/with_events_spec.rb
Ruby
apache-2.0
197
main
1,403
# frozen_string_literal: true require 'spec_helper' RSpec.describe Hyrax::WithEvents do subject(:eventable) { model_with_events.new } let(:action) { 'FAKE EVENT ACTION' } let(:event) { Hyrax::Event.create_now(action) } let(:model_with_events) do module Hyrax module Test module WithEvents ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/concerns/hyrax/solr_document_behavior_spec.rb
Ruby
apache-2.0
197
main
8,494
# frozen_string_literal: true RSpec.describe Hyrax::SolrDocumentBehavior do subject(:solr_document) { solr_document_class.new(solr_hash) } let(:solr_hash) { {} } let(:solr_document_class) do Class.new do include Blacklight::Solr::Document include Hyrax::SolrDocumentBehavior end end desc...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/concerns/hyrax/solr_document/ordered_members_spec.rb
Ruby
apache-2.0
197
main
980
# frozen_string_literal: true # NOTE: This class specifically queries `ordered_targets_ssim`, which is only # indexed within Dassie. RSpec.describe Hyrax::SolrDocument::OrderedMembers, :active_fedora do subject(:decorated) { described_class.decorate(document) } let(:data) { { id: parent_id } } let(:document) {...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/agent_spec.rb
Ruby
apache-2.0
197
main
261
# frozen_string_literal: true module Sipity RSpec.describe Agent, type: :model do subject { described_class } its(:column_names) { is_expected.to include("proxy_for_id") } its(:column_names) { is_expected.to include("proxy_for_type") } end end
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/notification_spec.rb
Ruby
apache-2.0
197
main
515
# frozen_string_literal: true module Sipity RSpec.describe Notification, type: :model do subject { described_class.new } it 'will raise an ArgumentError if you provide an invalid #notification_type' do expect { subject.notification_type = '__incorrect_name__' }.to raise_error(ArgumentError) end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/workflow_spec.rb
Ruby
apache-2.0
197
main
4,032
# frozen_string_literal: true module Sipity RSpec.describe Workflow, type: :model do context 'class configuration' do subject { described_class } its(:column_names) { is_expected.to include('name') } end subject { create(:workflow, name: 'ETD Workflow') } it { is_expected.to belong_to(:...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/workflow_role_spec.rb
Ruby
apache-2.0
197
main
260
# frozen_string_literal: true module Sipity RSpec.describe WorkflowRole, type: :model do subject { described_class } its(:column_names) { is_expected.to include('workflow_id') } its(:column_names) { is_expected.to include('role_id') } end end
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/workflow_state_action_permission_spec.rb
Ruby
apache-2.0
197
main
299
# frozen_string_literal: true module Sipity RSpec.describe WorkflowStateActionPermission, type: :model do subject { described_class } its(:column_names) { is_expected.to include("workflow_role_id") } its(:column_names) { is_expected.to include("workflow_state_action_id") } end end
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/workflow_responsibility_spec.rb
Ruby
apache-2.0
197
main
276
# frozen_string_literal: true module Sipity RSpec.describe WorkflowResponsibility, type: :model do subject { described_class } its(:column_names) { is_expected.to include('agent_id') } its(:column_names) { is_expected.to include('workflow_role_id') } end end
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/notification_recipient_spec.rb
Ruby
apache-2.0
197
main
337
# frozen_string_literal: true module Sipity RSpec.describe NotificationRecipient, type: :model do subject { described_class.new } it 'will raise an ArgumentError if you provide an invalid recipient_strategy' do expect { subject.recipient_strategy = '__incorrect_name__' }.to raise_error(ArgumentError) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/entity_specific_responsibility_spec.rb
Ruby
apache-2.0
197
main
345
# frozen_string_literal: true module Sipity RSpec.describe EntitySpecificResponsibility, type: :model do subject { described_class } its(:column_names) { is_expected.to include('workflow_role_id') } its(:column_names) { is_expected.to include('entity_id') } its(:column_names) { is_expected.to include...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/workflow_state_spec.rb
Ruby
apache-2.0
197
main
624
# frozen_string_literal: true module Sipity RSpec.describe WorkflowState, type: :model do subject { described_class } its(:column_names) { is_expected.to include("workflow_id") } its(:column_names) { is_expected.to include("name") } describe "#entities" do let(:workflow_state) { create(:workfl...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/workflow_action_spec.rb
Ruby
apache-2.0
197
main
1,377
# frozen_string_literal: true require "spec_helper" module Sipity RSpec.describe WorkflowAction, type: :model do context 'database configuration' do subject { described_class } its(:column_names) { is_expected.to include('workflow_id') } its(:column_names) { is_expected.to include('resulting_...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/entity_spec.rb
Ruby
apache-2.0
197
main
1,000
# frozen_string_literal: true module Sipity RSpec.describe Entity, type: :model, valkyrie_adapter: :test_adapter do subject(:entity) { described_class.new } describe 'database configuration' do subject { described_class } its(:column_names) { is_expected.to include("proxy_for_global_id") } ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/comment_spec.rb
Ruby
apache-2.0
197
main
754
# frozen_string_literal: true module Sipity RSpec.describe Comment, type: :model do context 'database configuration' do subject { described_class } its(:column_names) { is_expected.to include('entity_id') } its(:column_names) { is_expected.to include('agent_id') } its(:column_names) { is_...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/role_spec.rb
Ruby
apache-2.0
197
main
1,353
# frozen_string_literal: true module Sipity RSpec.describe Role, type: :model do context 'class methods' do subject { described_class } its(:column_names) { is_expected.to include('name') } its(:column_names) { is_expected.to include('description') } context '.[]' do let(:valid_na...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/models/sipity/workflow_state_action_spec.rb
Ruby
apache-2.0
197
main
296
# frozen_string_literal: true module Sipity RSpec.describe WorkflowStateAction, type: :model do subject { described_class } its(:column_names) { is_expected.to include("originating_workflow_state_id") } its(:column_names) { is_expected.to include("workflow_action_id") } end end
github
samvera/hyrax
https://github.com/samvera/hyrax
db/seeds.rb
Ruby
apache-2.0
197
main
882
ActiveFedora.fedora.connection.send(:init_base_path) puts "\n== Creating default collection types" Hyrax::CollectionType.find_or_create_default_collection_type Hyrax::CollectionType.find_or_create_admin_set_type puts "\n== Loading workflows" Hyrax::Workflow::WorkflowImporter.load_workflows errors = Hyrax::Workflow::W...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/active_fedora_to_valkyrie.rb
Ruby
apache-2.0
197
main
1,871
# frozen_string_literal: true module Hyrax module Actors ## # Casts `env.curation_concern` from a `ActiveFedora::Base` model to a # `Valkyrie::Resource` resource. # # If the curation concern is not an `ActiveFedora::Base` this is a # no-op. # # This can be used in conjunction with `Va...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/base_actor.rb
Ruby
apache-2.0
197
main
4,968
# frozen_string_literal: true module Hyrax module Actors ## # Defines the basic save/destroy and callback behavior, intended to run # near the bottom of the actor stack. # # @example Defining a base actor for a custom work type # module Hyrax # module Actors # class MyWorkA...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/file_actor.rb
Ruby
apache-2.0
197
main
4,159
# frozen_string_literal: true module Hyrax module Actors # Actions for a file identified by file_set and relation (maps to use predicate) # @note Spawns asynchronous jobs class FileActor attr_reader :file_set, :relation, :user, :use_valkyrie # @param [FileSet] file_set the parent FileSet ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/create_with_files_ordered_members_actor.rb
Ruby
apache-2.0
197
main
1,849
# frozen_string_literal: true module Hyrax module Actors ## # When adding member {FileSetBehavior}s to a {WorkBehavior}, {Hyrax} saves # and reloads the work for each new member FileSet. This can significantly # slow down ingest for Works with many member FileSets. The saving and # reloading happe...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/null_actor.rb
Ruby
apache-2.0
197
main
368
# frozen_string_literal: true module Hyrax module Actors ## # @note this is effectively an alias for AbstractActor; it exists to # communicate to readers that this actor is intended to be a concrete, # do-nothing actor (and also in case `AbstractActor` ever becomes actually # abstract). ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/create_with_remote_files_actor.rb
Ruby
apache-2.0
197
main
5,426
# frozen_string_literal: true module Hyrax module Actors # If there is a key +:remote_files+ in the attributes, it attaches the files at the specified URIs # to the work. e.g.: # attributes[:remote_files] = filenames.map do |name| # { url: "https://example.com/file/#{name}", file_name: name ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/add_to_work_actor.rb
Ruby
apache-2.0
197
main
2,711
# frozen_string_literal: true module Hyrax module Actors class AddToWorkActor < AbstractActor # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if create was successful def create(env) work_ids = env.attributes.delete(:in_works_ids) can_edit_works?(env, work_ids...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/transfer_request_actor.rb
Ruby
apache-2.0
197
main
736
# frozen_string_literal: true module Hyrax module Actors # Notify the provided owner that their proxy wants to make a # deposit on their behalf class TransferRequestActor < AbstractActor # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if create was successful def creat...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/valkyrie_to_active_fedora.rb
Ruby
apache-2.0
197
main
1,902
# frozen_string_literal: true module Hyrax module Actors ## # Casts `env.curation_concern` from a `Valkyrie::Resource` to an # `ActiveFedora::Base` model. # # If the curation concern is not a `Valkyrie::Resource` this is a # no-op. # # This can be used in conjunction with `ActiveFedor...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/file_set_actor.rb
Ruby
apache-2.0
197
main
8,086
# frozen_string_literal: true module Hyrax module Actors # Actions are decoupled from controller logic so that they may be called from a controller or a background job. class FileSetActor # rubocop:disable Metrics/ClassLength include Lockable attr_reader :file_set, :user, :attributes def in...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/environment.rb
Ruby
apache-2.0
197
main
970
# frozen_string_literal: true module Hyrax module Actors class Environment # @param [ActiveFedora::Base] curation_concern work to operate on # @param [Ability] current_ability the authorizations of the acting user # @param [ActionController::Parameters] attributes user provided form attributes ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb
Ruby
apache-2.0
197
main
2,745
# frozen_string_literal: true module Hyrax module Actors ## # When adding member {FileSetBehavior}s to a {WorkBehavior}, {Hyrax} saves # and reloads the work for each new member FileSet. This can significantly # slow down ingest for Works with many member FileSets. The saving and # reloading happe...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/file_set_ordered_members_actor.rb
Ruby
apache-2.0
197
main
587
# frozen_string_literal: true module Hyrax module Actors class FileSetOrderedMembersActor < FileSetActor # Adds representative and thumbnail to work; sets file_set visibility # @param [ActiveFedora::Base] work the parent work # @param [Hash] file_set_params def attach_to_work(work, file_s...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/lease_actor.rb
Ruby
apache-2.0
197
main
826
# frozen_string_literal: true module Hyrax module Actors class LeaseActor attr_reader :work # @param [Hydra::Works::Work] work def initialize(work) @work = work end # Update the visibility of the work to match the correct state of the lease, then clear the lease date, etc. ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/abstract_actor.rb
Ruby
apache-2.0
197
main
3,338
# frozen_string_literal: true module Hyrax module Actors ## # `Hyrax::Actors::AbstractActor` implements the base (no-op) case for Hyrax Actor # middleware. Concrete implementations may override any or all of the three # primary actions: # # * #create # * #update # * #destroy # ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/collections_membership_actor.rb
Ruby
apache-2.0
197
main
5,641
# frozen_string_literal: true module Hyrax module Actors # Adds membership to and removes membership from collections. # This decodes parameters that follow the rails nested parameters conventions: # # @example a collections attribute hash # 'member_of_collections_attributes' => { # '0' ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/embargo_actor.rb
Ruby
apache-2.0
197
main
848
# frozen_string_literal: true module Hyrax module Actors class EmbargoActor attr_reader :work # @param [Hydra::Works::Work] work def initialize(work) @work = work end # Update the visibility of the work to match the correct state of the embargo, then clear the embargo date,...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/model_actor.rb
Ruby
apache-2.0
197
main
1,287
# frozen_string_literal: true module Hyrax module Actors # This is a proxy for the model specific actor class ModelActor < AbstractActor # See: https://github.com/bbatsov/rubocop/issues/5393 # rubocop:disable Rails/Delegate # @param [Hyrax::Actors::Environment] env # @return [Boolean]...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/create_with_files_actor.rb
Ruby
apache-2.0
197
main
2,287
# frozen_string_literal: true module Hyrax module Actors # Creates a work and attaches files to the work class CreateWithFilesActor < Hyrax::Actors::AbstractActor # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if create was successful def create(env) uploaded_file...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/apply_permission_template_actor.rb
Ruby
apache-2.0
197
main
1,451
# frozen_string_literal: true module Hyrax module Actors # Responsible for "applying" the various edit and read attributes to the given curation concern. # @see Hyrax::AdminSetService for release_date interaction class ApplyPermissionTemplateActor < Hyrax::Actors::AbstractActor # @param [Hyrax::Acto...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/terminator.rb
Ruby
apache-2.0
197
main
311
# frozen_string_literal: true module Hyrax module Actors # This is always the last middleware on the actor middleware stack. class Terminator def create(_env) true end def update(_env) true end def destroy(_env) true end end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/featured_work_actor.rb
Ruby
apache-2.0
197
main
953
# frozen_string_literal: true module Hyrax module Actors # Removes featured works if the work is deleted or becomes private class FeaturedWorkActor < Hyrax::Actors::AbstractActor # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if destroy was successful def destroy(env) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/cleanup_file_sets_actor.rb
Ruby
apache-2.0
197
main
1,086
# frozen_string_literal: true module Hyrax module Actors # Responsible for removing FileSets related to the given curation concern. class CleanupFileSetsActor < Hyrax::Actors::AbstractActor # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if destroy was successful def dest...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/attach_members_actor.rb
Ruby
apache-2.0
197
main
3,757
# frozen_string_literal: true module Hyrax module Actors ## # Attach or remove child works to/from this work. This decodes parameters # that follow the rails nested parameters conventions: # e.g. # 'work_members_attributes' => { # '0' => { 'id' => '12312412'}, # '1' => { 'id' => ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/transactional_request.rb
Ruby
apache-2.0
197
main
755
# frozen_string_literal: true module Hyrax module Actors # Wrap the stack in a database transaction. # This will roll back any database actions (particularly workflow) if there # is an error elsewhere in the actor stack. class TransactionalRequest < Actors::AbstractActor # @param [Hyrax::Actors:...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/apply_order_actor.rb
Ruby
apache-2.0
197
main
2,650
# frozen_string_literal: true module Hyrax module Actors class ApplyOrderActor < AbstractActor # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if update was successful def update(env) ordered_member_ids = env.attributes.delete(:ordered_member_ids) sync_members(...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/interpret_visibility_actor.rb
Ruby
apache-2.0
197
main
10,263
# frozen_string_literal: true module Hyrax module Actors class InterpretVisibilityActor < AbstractActor class Intention < VisibilityIntention def initialize(attributes) @attributes = attributes instance_vars_from_attributes end # returns a copy of attributes wit...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/optimistic_lock_validator.rb
Ruby
apache-2.0
197
main
1,157
# frozen_string_literal: true module Hyrax module Actors # Validates that the submitted version is the most recent version in the datastore. # Caveat: we are not detecting if the version is changed by a different process between # the time this validator is run and when the object is saved class Optim...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/ordered_members_actor.rb
Ruby
apache-2.0
197
main
829
# frozen_string_literal: true module Hyrax module Actors class OrderedMembersActor < FileSetActor include Lockable attr_reader :ordered_members, :user def initialize(ordered_members, user) @ordered_members = ordered_members @user = user end # Adds FileSets to the w...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/cleanup_trophies_actor.rb
Ruby
apache-2.0
197
main
544
# frozen_string_literal: true module Hyrax module Actors # Responsible for removing trophies related to the given curation concern. class CleanupTrophiesActor < Hyrax::Actors::AbstractActor # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if destroy was successful def dest...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/actors/hyrax/actors/default_admin_set_actor.rb
Ruby
apache-2.0
197
main
2,092
# frozen_string_literal: true module Hyrax module Actors # Ensures that the default AdminSet id is set if this form doesn't have # an admin_set_id provided. This should come before the # Hyrax::Actors::InitializeWorkflowActor, so that the correct # workflow can be kicked off. # # @see Hyrax::E...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/trophy_presenter.rb
Ruby
apache-2.0
197
main
1,539
# frozen_string_literal: true module Hyrax ## # @api public # # Presents works in context as "trophied" for a given user. # # @example # my_user = User.find(user_id) # # trophies = Hyrax::TrophyPresenter.find_by_user(my_user) # trophies.each do |trophy| # puts "Object name/title: #{trop...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/presenter_renderer.rb
Ruby
apache-2.0
197
main
1,583
# frozen_string_literal: true module Hyrax class PresenterRenderer include ActionView::Helpers::TranslationHelper def initialize(presenter, view_context) @presenter = presenter @view_context = view_context end ## # Renders a collection field partial # # @return [ActiveSupport...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/pcdm_member_presenter_factory.rb
Ruby
apache-2.0
197
main
3,730
# frozen_string_literal: true module Hyrax ## # constructs presenters for the pcdm:members of an Object, omitting those # not readable by a provided +Ability+. # # this implementation builds the presenters without recourse to the request # context and ActiveFedora-specific index structures (i.e. no `list_so...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/page_title_decorator.rb
Ruby
apache-2.0
197
main
951
# frozen_string_literal: true module Hyrax ## # Decorates Work-like objects with a `#title` and `#page_title` for display. class PageTitleDecorator < Draper::Decorator ## # overlays the `#title` of the object, making an effort to guarantee # a reasonable title is found. if one isn't found, it uses an...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/stats_usage_presenter.rb
Ruby
apache-2.0
197
main
1,387
# frozen_string_literal: true module Hyrax ## # @abstract methods used by both {WorkUsage} and {FileUsage} class StatsUsagePresenter attr_accessor :id, :model def created @created ||= date_for_analytics end private def user_id @user_id ||= begin user = Hydra...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/homepage_presenter.rb
Ruby
apache-2.0
197
main
1,449
# frozen_string_literal: true module Hyrax class HomepagePresenter class_attribute :create_work_presenter_class self.create_work_presenter_class = Hyrax::SelectTypeListPresenter attr_reader :current_ability, :collections def initialize(current_ability, collections) @current_ability = current_ab...