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/forms/hyrax/forms/admin/collection_type_participant_form_spec.rb
Ruby
apache-2.0
197
main
547
# frozen_string_literal: true RSpec.describe Hyrax::Forms::Admin::CollectionTypeParticipantForm do let(:collection_type_participant) { build(:collection_type_participant) } let(:form) { described_class.new(collection_type_participant: collection_type_participant) } subject { form } it { is_expected.to delegat...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/inputs/controlled_vocabulary_input_spec.rb
Ruby
apache-2.0
197
main
2,717
# frozen_string_literal: true RSpec.describe 'ControlledVocabularyInput', type: :input do let(:work) { GenericWork.new } let(:builder) { SimpleForm::FormBuilder.new(:generic_work, work, view, {}) } let(:input) { ControlledVocabularyInput.new(builder, :based_near, nil, :multi_value, {}) } describe '#input' do ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/inputs/multifile_input_spec.rb
Ruby
apache-2.0
197
main
734
# frozen_string_literal: true RSpec.describe 'MultifileInput', type: :input do class Foo extend ActiveModel::Naming include ActiveModel::Conversion include ActiveModel::Validations def persisted? false end attr_accessor :bar def [](val) raise "Unknown attribute" unless val =...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/cleanup_file_sets_actor_spec.rb
Ruby
apache-2.0
197
main
753
# frozen_string_literal: true RSpec.describe Hyrax::Actors::CleanupFileSetsActor, :active_fedora do let(:ability) { ::Ability.new(depositor) } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:terminator) { Hyrax::Actors::Terminator.new } let(:depositor) { create(:user) } let(:attri...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/create_with_remote_files_actor_spec.rb
Ruby
apache-2.0
197
main
5,157
# frozen_string_literal: true RSpec.describe Hyrax::Actors::CreateWithRemoteFilesActor, :active_fedora do let(:terminator) { Hyrax::Actors::Terminator.new } let(:actor) { stack.build(terminator) } let(:stack) do ActionDispatch::MiddlewareStack.new.tap do |middleware| middleware.use described_class e...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/file_set_actor_spec.rb
Ruby
apache-2.0
197
main
12,006
# frozen_string_literal: true require 'redlock' RSpec.describe Hyrax::Actors::FileSetActor, :active_fedora do include ActionDispatch::TestProcess let(:user) { create(:user) } let(:file_path) { File.join(fixture_path, 'world.png') } let(:file) { fixture_file_upload(file_path, 'image/png')...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/create_with_remote_files_ordered_members_actor_spec.rb
Ruby
apache-2.0
197
main
2,042
# frozen_string_literal: true RSpec.describe Hyrax::Actors::CreateWithRemoteFilesOrderedMembersActor, :active_fedora do let(:terminator) { Hyrax::Actors::Terminator.new } let(:actor) { stack.build(terminator) } let(:stack) do ActionDispatch::MiddlewareStack.new.tap do |middleware| middleware.use describ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/valkyrie_to_active_fedora_spec.rb
Ruby
apache-2.0
197
main
1,879
# frozen_string_literal: true RSpec.describe Hyrax::Actors::ValkyrieToActiveFedora, :active_fedora do let(:ability) { :FAKE_ABILITY } let(:attrs) { {} } let(:env) { Hyrax::Actors::Environment.new(work, ability, attrs) } let(:spy) { middleware.next_actor } let(:terminator) { Hyrax::Actor...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/create_with_files_actor_spec.rb
Ruby
apache-2.0
197
main
2,285
# frozen_string_literal: true RSpec.describe Hyrax::Actors::CreateWithFilesActor, :active_fedora do let(:user) { create(:user) } let(:ability) { ::Ability.new(user) } let(:work) { create(:generic_work, user: user) } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:terminator) { Hyr...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/embargo_actor_spec.rb
Ruby
apache-2.0
197
main
3,548
# frozen_string_literal: true RSpec.describe Hyrax::Actors::EmbargoActor, :clean_repo, :frozen_time do let(:actor) { described_class.new(work) } let(:restricted_vis) { 'restricted' } let(:authenticated_vis) { 'authenticated' } let(:public_vis) { 'open' } def embargo_manager(work) Hyrax::EmbargoManager ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/lease_actor_spec.rb
Ruby
apache-2.0
197
main
3,893
# frozen_string_literal: true RSpec.describe Hyrax::Actors::LeaseActor, :active_fedora do let(:actor) { described_class.new(work) } let(:authenticated_vis) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED } let(:public_vis) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLI...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/apply_permission_template_actor_spec.rb
Ruby
apache-2.0
197
main
5,160
# frozen_string_literal: true RSpec.describe Hyrax::Actors::ApplyPermissionTemplateActor, :active_fedora do let(:ability) { ::Ability.new(depositor) } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:terminator) { Hyrax::Actors::Terminator.new } let(:depositor) { create(:user) } le...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/transactional_request_spec.rb
Ruby
apache-2.0
197
main
1,292
# frozen_string_literal: true RSpec.describe Hyrax::Actors::TransactionalRequest, :active_fedora do let(:bad_actor) do Class.new(Hyrax::Actors::AbstractActor) do def create(attributes) next_actor.create(attributes) && raise('boom') end end end let(:good_actor) do Class.new(Hyrax::...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/active_fedora_to_valkyrie_spec.rb
Ruby
apache-2.0
197
main
1,850
# frozen_string_literal: true RSpec.describe Hyrax::Actors::ActiveFedoraToValkyrie, :active_fedora do let(:ability) { :FAKE_ABILITY } let(:attrs) { {} } let(:env) { Hyrax::Actors::Environment.new(work, ability, attrs) } let(:spy) { middleware.next_actor } let(:terminator) { Hyrax::Actor...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/default_admin_set_actor_spec.rb
Ruby
apache-2.0
197
main
3,320
# frozen_string_literal: true RSpec.describe Hyrax::Actors::DefaultAdminSetActor, :active_fedora do let(:depositor) { build(:user) } let(:depositor_ability) { ::Ability.new(depositor) } let(:work) { build(:generic_work) } let(:admin_set) { build(:admin_set, id: 'admin_set_1') } let(:permission_template) { cre...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/interpret_visibility_actor_spec.rb
Ruby
apache-2.0
197
main
20,874
# frozen_string_literal: true RSpec.describe Hyrax::Actors::InterpretVisibilityActor, :active_fedora do let(:user) { create(:user) } let(:ability) { ::Ability.new(user) } let(:curation_concern) { GenericWork.new } let(:attributes) { { admin_set_id: admin_set.id } } let(:admin_set) { create(:admin_set) } let...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/model_actor_spec.rb
Ruby
apache-2.0
197
main
873
# frozen_string_literal: true module MusicalWork class Cover < ActiveFedora::Base end end class Hyrax::Actors::MusicalWork class CoverActor < ::Hyrax::Actors::AbstractActor end end RSpec.describe Hyrax::Actors::ModelActor, :active_fedora do let(:work) { MusicalWork::Cover.new } let(:depositor) { create(:u...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/attach_members_actor_spec.rb
Ruby
apache-2.0
197
main
5,880
# frozen_string_literal: true RSpec.describe Hyrax::Actors::AttachMembersActor, :active_fedora do let(:ability) { ::Ability.new(depositor) } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:terminator) { Hyrax::Actors::Terminator.new } let(:depositor) { create(:user) } let(:work) {...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/cleanup_trophies_actor_spec.rb
Ruby
apache-2.0
197
main
845
# frozen_string_literal: true RSpec.describe Hyrax::Actors::CleanupTrophiesActor, :active_fedora do let(:ability) { ::Ability.new(depositor) } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:terminator) { Hyrax::Actors::Terminator.new } let(:depositor) { create(:user) } let(:work)...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/file_set_ordered_members_actor_spec.rb
Ruby
apache-2.0
197
main
1,384
# frozen_string_literal: true RSpec.describe Hyrax::Actors::FileSetOrderedMembersActor, :active_fedora do include ActionDispatch::TestProcess let(:user) { create(:user) } let(:file_path) { File.join(fixture_path, 'world.png') } let(:file) { fixture_file_upload(file_path, 'image/png') } # ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/ordered_members_actor_spec.rb
Ruby
apache-2.0
197
main
1,876
# frozen_string_literal: true require 'redlock' RSpec.describe Hyrax::Actors::OrderedMembersActor, :active_fedora do include ActionDispatch::TestProcess let(:user) { create(:user) } let(:actor) { described_class.new([file_set], user) } let(:file_set) { build(:file_set) } let(:work) { create...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/apply_order_actor_spec.rb
Ruby
apache-2.0
197
main
3,457
# frozen_string_literal: true RSpec.describe Hyrax::Actors::ApplyOrderActor, :active_fedora do let(:curation_concern) { create(:work_with_two_children, user: user) } let(:ability) { ::Ability.new(user) } let(:user) { create(:admin) } let(:terminator) { Hyrax::Actors::Terminator.new } let(:env) { Hyrax::Actors...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/collections_membership_actor_spec.rb
Ruby
apache-2.0
197
main
9,295
# frozen_string_literal: true RSpec.describe Hyrax::Actors::CollectionsMembershipActor, :active_fedora, skip: (!(Hyrax.config.collection_class < ActiveFedora::Base) || Hyrax.config.use_valkyrie?) do let(:user) { create(:user) } let(:ability) { ::Ability.new(user) } let(:curation_concern) { build(:work, user: user...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/file_actor_spec.rb
Ruby
apache-2.0
197
main
5,426
# frozen_string_literal: true return if Hyrax.config.disable_wings require 'wings/valkyrie/query_service' RSpec.describe Hyrax::Actors::FileActor, :active_fedora do include ActionDispatch::TestProcess include Hyrax::FactoryHelpers let(:user) { create(:user) } let(:file_set) { create(:file_set) } let...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/featured_work_actor_spec.rb
Ruby
apache-2.0
197
main
1,262
# frozen_string_literal: true RSpec.describe Hyrax::Actors::FeaturedWorkActor, :active_fedora do let(:ability) { ::Ability.new(depositor) } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:terminator) { Hyrax::Actors::Terminator.new } let(:depositor) { create(:user) } let(:work) { ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/transfer_request_actor_spec.rb
Ruby
apache-2.0
197
main
1,230
# frozen_string_literal: true require 'rails_helper' RSpec.describe Hyrax::Actors::TransferRequestActor, :active_fedora do let(:ability) { ::Ability.new(depositor) } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:terminator) { Hyrax::Actors::Terminator.new } let(:depositor) { crea...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/null_actor_spec.rb
Ruby
apache-2.0
197
main
898
# frozen_string_literal: true RSpec.describe Hyrax::Actors::NullActor, :active_fedora do subject(:actor) { described_class.new(spy_actor) } let(:attributes) { {} } let(:work) { :FAKE_WORK } let(:ability) { :FAKE_ABILITY } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:spy_act...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/generic_work_actor_spec.rb
Ruby
apache-2.0
197
main
13,463
# frozen_string_literal: true return unless defined? Hyrax::Actors::GenericWorkActor require 'redlock' require 'hyrax/specs/spy_listener' RSpec.describe Hyrax::Actors::GenericWorkActor, :active_fedora do include ActionDispatch::TestProcess let(:env) { Hyrax::Actors::Environment.new(curation_concern, ability, att...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/optimistic_lock_validator_spec.rb
Ruby
apache-2.0
197
main
1,908
# frozen_string_literal: true RSpec.describe Hyrax::Actors::OptimisticLockValidator, :active_fedora do let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:ability) { ::Ability.new(depositor) } let(:terminator) { Hyrax::Actors::Terminator.new } let(:depositor) { create(:user) } let(:w...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/actors/hyrax/actors/create_with_files_ordered_members_actor_spec.rb
Ruby
apache-2.0
197
main
1,469
# frozen_string_literal: true RSpec.describe Hyrax::Actors::CreateWithFilesOrderedMembersActor, :active_fedora do let(:user) { create(:user) } let(:ability) { ::Ability.new(user) } let(:work) { create(:generic_work, user: user) } let(:env) { Hyrax::Actors::Environment.new(work, ability, attributes) } let(:ter...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/catalog_controller_spec.rb
Ruby
apache-2.0
197
main
6,998
# frozen_string_literal: true RSpec.describe CatalogController, :clean_repo, type: :controller do routes { Rails.application.class.routes } let(:user) { create(:user) } before { sign_in user } describe "#index" do let(:rocks) { valkyrie_create(:monograph, title: ['Rock Documents'], read_groups: ['public'...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/embargoes_controller_spec.rb
Ruby
apache-2.0
197
main
14,008
# frozen_string_literal: true RSpec.describe Hyrax::EmbargoesController do context 'with ActiveFedora', :active_fedora do let(:user) { create(:user) } let(:a_work) { create(:generic_work, user: user) } let(:not_my_work) { create(:generic_work) } before { sign_in user } describe '#index' do ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/resource_sync_controller_spec.rb
Ruby
apache-2.0
197
main
2,773
# frozen_string_literal: true RSpec.describe Hyrax::ResourceSyncController do before do Rails.cache.clear end describe "source_description" do let(:writer) { double } let(:document) { '<xml>' } let(:capability_list) { Hyrax::Engine.routes.url_helpers.capability_list_url(host: 'test.host') } ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/uploads_controller_spec.rb
Ruby
apache-2.0
197
main
5,562
# frozen_string_literal: true RSpec.describe Hyrax::UploadsController do let(:user) { create(:user) } let(:chunk) { fixture_file_upload('/world.png', 'image/png') } describe "#create" do let(:file) { fixture_file_upload('/world.png', 'image/png') } let!(:existing_file) { create(:uploaded_file, file: file...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/citations_controller_spec.rb
Ruby
apache-2.0
197
main
3,662
# frozen_string_literal: true RSpec.describe Hyrax::CitationsController do describe "#work" do let(:user) { create(:user) } let(:work) { valkyrie_create(:monograph, depositor: user.user_key, edit_users: [user]) } context "with an authenticated_user" do before do sign_in user request...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/workflow_actions_controller_spec.rb
Ruby
apache-2.0
197
main
2,027
# frozen_string_literal: true RSpec.describe Hyrax::WorkflowActionsController, type: :controller do let(:user) { FactoryBot.create(:user) } let(:work) { FactoryBot.valkyrie_create(:monograph) } let(:form) { instance_double(described_class::DEFAULT_FORM_CLASS, errors: {}) } routes { Rails.application.routes } ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/homepage_controller_spec.rb
Ruby
apache-2.0
197
main
4,402
# frozen_string_literal: true RSpec.describe Hyrax::HomepageController, type: :controller do routes { Hyrax::Engine.routes } describe "#index" do let(:user) { create(:user) } before do sign_in user end context 'with existing featured researcher' do let!(:frodo) { ContentBlock.create!(...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/static_controller_spec.rb
Ruby
apache-2.0
197
main
878
# frozen_string_literal: true RSpec.describe Hyrax::StaticController, type: :controller do routes { Hyrax::Engine.routes } describe "#mendeley" do it "renders page" do get "mendeley" expect(response).to be_successful expect(response).to render_template "layouts/homepage" end it "render...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/users_controller_spec.rb
Ruby
apache-2.0
197
main
4,698
# frozen_string_literal: true RSpec.describe Hyrax::UsersController, type: :controller do let(:user) { create(:user) } before { sign_in user } describe "#show" do it "show the user profile if user exists" do get :show, params: { id: user.user_key } expect(response).to be_successful expect(...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/trophies_controller_spec.rb
Ruby
apache-2.0
197
main
1,324
# frozen_string_literal: true RSpec.describe Hyrax::TrophiesController do describe "#toggle_trophy" do let(:user) { create(:user) } let(:work) { FactoryBot.valkyrie_create(:hyrax_work, depositor: user.user_key) } context "for a work we have edit access on" do before do sign_in user en...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/generic_works_controller_json_spec.rb
Ruby
apache-2.0
197
main
3,861
# frozen_string_literal: true # This tests the Hyrax::WorksControllerBehavior module RSpec.describe Hyrax::GenericWorksController, :active_fedora do routes { Rails.application.routes } let(:user) { create(:user) } before { sign_in user } context "JSON" do let(:admin_set) { create(:admin_set, id: 'admin_s...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/featured_works_controller_spec.rb
Ruby
apache-2.0
197
main
1,649
# frozen_string_literal: true RSpec.describe Hyrax::FeaturedWorksController, type: :controller do describe "#create" do before do sign_in create(:user) expect(controller).to receive(:authorize!).with(:create, FeaturedWork).and_return(true) end context "when there are no featured works" do ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/operations_controller_spec.rb
Ruby
apache-2.0
197
main
798
# frozen_string_literal: true RSpec.describe Hyrax::OperationsController do routes { Hyrax::Engine.routes } let(:parent) { create(:operation, :pending, user: user) } let!(:child1) { create(:operation, :failing, parent: parent, user: user) } let!(:child2) { create(:operation, :pending, parent: parent, user: user...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/collections_controller_spec.rb
Ruby
apache-2.0
197
main
7,529
# frozen_string_literal: true RSpec.describe Hyrax::CollectionsController, clean_repo: true do routes { Hyrax::Engine.routes } let(:user) { create(:user) } let(:other) { build(:user) } let(:collection) do FactoryBot.valkyrie_create(:hyrax_collection, :public, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/batch_uploads_controller_spec.rb
Ruby
apache-2.0
197
main
5,050
# frozen_string_literal: true RSpec.describe Hyrax::BatchUploadsController do let(:user) { create(:user) } let(:expected_types) do { '1' => 'Article', '2' => ['Article', 'Text'] } end let(:expected_individual_params) do { '1' => 'foo', '2' => 'bar' } end let(:expected_shared_params) do ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/fixity_checks_controller_spec.rb
Ruby
apache-2.0
197
main
1,661
# frozen_string_literal: true RSpec.describe Hyrax::FixityChecksController do routes { Hyrax::Engine.routes } let(:user) { FactoryBot.create(:user) } let(:file_set) { FactoryBot.valkyrie_create(:hyrax_file_set, :with_files, depositor: user.user_key) } context "when signed in" do describe "POST create" do ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/content_blocks_controller_spec.rb
Ruby
apache-2.0
197
main
2,632
# frozen_string_literal: true RSpec.describe Hyrax::ContentBlocksController, type: :controller do let!(:announcement_text) do create(:content_block, name: 'announcement_text') end let!(:marketing_text) do create(:content_block, name: 'marketing_text') end let!(:featured_researcher) do create(:cont...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/single_use_links_controller_spec.rb
Ruby
apache-2.0
197
main
3,367
# frozen_string_literal: true RSpec.describe Hyrax::SingleUseLinksController, type: :controller do routes { Hyrax::Engine.routes } let(:user) { FactoryBot.create(:user) } let(:file) do FactoryBot.valkyrie_create(:hyrax_file_set, depositor: user.user_key, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/monographs_controller_spec.rb
Ruby
apache-2.0
197
main
2,140
# frozen_string_literal: true # This tests the Hyrax::WorksControllerBehavior module with a Valkyrie resource. RSpec.describe Hyrax::MonographsController do routes { Rails.application.routes } let(:main_app) { Rails.application.routes.url_helpers } let(:hyrax) { Hyrax::Engine.routes.url_helpers } let(:user) { F...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/generic_works_controller_spec.rb
Ruby
apache-2.0
197
main
25,437
# frozen_string_literal: true # This tests the Hyrax::WorksControllerBehavior module require 'hyrax/specs/spy_listener' RSpec.describe Hyrax::GenericWorksController, :active_fedora do routes { Rails.application.routes } let(:main_app) { Rails.application.routes.url_helpers } let(:hyrax) { Hyrax::Engine.routes.ur...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/pages_controller_spec.rb
Ruby
apache-2.0
197
main
4,211
# frozen_string_literal: true RSpec.describe Hyrax::PagesController, type: :controller do let(:user) { create(:user) } before do sign_in user end describe "GET #show" do context "when content exists" do let!(:page) do ContentBlock.about_page = "foo bar" ContentBlock.for(:about) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/accepts_batches_controller_spec.rb
Ruby
apache-2.0
197
main
2,988
# frozen_string_literal: true class AcceptsBatchesController < ApplicationController include Hyrax::Collections::AcceptsBatches end RSpec.describe AcceptsBatchesController, type: :controller do describe 'batch' do it 'accepts batch from parameters' do controller.params['batch_document_ids'] = %w[abc xyz]...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/leases_controller_spec.rb
Ruby
apache-2.0
197
main
9,539
# frozen_string_literal: true RSpec.describe Hyrax::LeasesController do context 'with ActiveFedora', :active_fedora do let(:user) { create(:user) } let(:a_work) { create(:generic_work, user: user) } let(:not_my_work) { create(:generic_work) } before { sign_in user } describe '#index' do co...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/dashboard_controller_spec.rb
Ruby
apache-2.0
197
main
1,256
# frozen_string_literal: true RSpec.describe Hyrax::DashboardController, type: :controller do context "with an unauthenticated user" do it "redirects to sign-in page" do get :show expect(response).to be_redirect expect(flash[:alert]).to eq("You need to sign in or sign up before continuing.") ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/file_sets_controller_spec.rb
Ruby
apache-2.0
197
main
40,268
# frozen_string_literal: true RSpec.describe Hyrax::FileSetsController do routes { Rails.application.routes } let(:user) { FactoryBot.create(:user) } let(:work_user) { user } before do allow(Hyrax.config.characterization_service).to receive(:run).and_return(true) end describe "active fedora", :a...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/downloads_controller_spec.rb
Ruby
apache-2.0
197
main
12,384
# frozen_string_literal: true RSpec.describe Hyrax::DownloadsController do routes { Hyrax::Engine.routes } describe '#show' do let(:file_path) { fixture_path + '/image.png' } let(:original_file) { File.open(file_path) } let(:original_content) { IO.binread(file_path) } let(:uploaded_file) { Factory...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/batch_edits_controller_spec.rb
Ruby
apache-2.0
197
main
19,075
# frozen_string_literal: true require 'hyrax/specs/shared_specs' RSpec.describe Hyrax::BatchEditsController, type: :controller do let(:user) { create(:user) } before do sign_in user allow_any_instance_of(User).to receive(:groups).and_return([]) request.env["HTTP_REFERER"] = 'test.host/original_page' ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/transfers_controller_spec.rb
Ruby
apache-2.0
197
main
12,407
# frozen_string_literal: true RSpec.describe Hyrax::TransfersController, type: :controller do describe "without a signed in user" do describe "#index" do it "redirects to sign in" do get :index expect(flash[:alert]).to eq "You need to sign in or sign up before continuing." expect(res...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/contact_form_controller_spec.rb
Ruby
apache-2.0
197
main
3,462
# frozen_string_literal: true RSpec.describe Hyrax::ContactFormController do let(:user) { create(:user) } let(:required_params) do { category: "Depositing content", name: "Rose Tyler", email: "rose@timetraveler.org", subject: "The Doctor", message: "Run." } end before { si...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/depositors_controller_spec.rb
Ruby
apache-2.0
197
main
3,773
# frozen_string_literal: true RSpec.describe Hyrax::DepositorsController do let(:user) { create(:user) } let(:grantee) { create(:user) } let(:grant_proxy_params) do { user_id: user.user_key, grantee_id: grantee.user_key, format: 'json' } end let(:revoke_proxy_params) do { ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/single_use_links_viewer_controller_spec.rb
Ruby
apache-2.0
197
main
3,374
# frozen_string_literal: true RSpec.describe Hyrax::SingleUseLinksViewerController do routes { Hyrax::Engine.routes } let(:user) { build(:user) } let(:file) do Hyrax.query_service.find_by(id: work.member_ids.first) end let(:file_metadata) { Hyrax.custom_queries.find_file_metadata_by(id: file.original_file...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/permissions_controller_spec.rb
Ruby
apache-2.0
197
main
2,164
# frozen_string_literal: true RSpec.describe Hyrax::PermissionsController do let(:user) { FactoryBot.create(:user) } before { sign_in user } context 'with legacy AF models' do describe '#confirm_access' do let(:work) { FactoryBot.valkyrie_create(:monograph, edit_users: [user]) } it 'draws the p...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/featured_work_lists_controller_spec.rb
Ruby
apache-2.0
197
main
612
# frozen_string_literal: true RSpec.describe Hyrax::FeaturedWorkListsController, type: :controller do describe "#create" do before do expect(controller).to receive(:authorize!).with(:update, FeaturedWork) end let(:feature1) { create(:featured_work) } let(:feature2) { create(:featured_work) } ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/notifications_controller_spec.rb
Ruby
apache-2.0
197
main
979
# frozen_string_literal: true RSpec.describe Hyrax::NotificationsController, type: :controller do let(:mock_box) { {} } before do allow(controller).to receive(:authenticate_user!).and_return(true) allow(UserMailbox).to receive(:new).and_return(mock_box) end describe "#index" do it "shows message" ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/stats_controller_spec.rb
Ruby
apache-2.0
197
main
6,005
# frozen_string_literal: true RSpec.describe Hyrax::StatsController do let(:user) { create(:user) } let(:usage) { double } before do allow_any_instance_of(User).to receive(:groups).and_return([]) end routes { Hyrax::Engine.routes } shared_context('with user signed in and http referer set') do befo...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/my/shares_controller_spec.rb
Ruby
apache-2.0
197
main
2,050
# frozen_string_literal: true RSpec.describe Hyrax::My::SharesController, :clean_repo, type: :controller do describe "logged in user" do let(:user) { create(:user) } before { sign_in user } describe "#index" do let(:other_user) { create(:user) } let(:someone_else) { create(:user) } ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/my/collections_controller_spec.rb
Ruby
apache-2.0
197
main
1,959
# frozen_string_literal: true RSpec.describe Hyrax::My::CollectionsController, :clean_repo, type: :controller do context "with a logged in user" do let(:user) { FactoryBot.create(:user) } before { sign_in(user) } describe "#index" do it "sets breadcrumbs" do expect(controller).to receive(:...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/my/works_controller_spec.rb
Ruby
apache-2.0
197
main
2,245
# frozen_string_literal: true RSpec.describe Hyrax::My::WorksController, type: :controller do let(:user) { create(:user) } before { sign_in user } describe "#index" do let(:response) { instance_double(Blacklight::Solr::Response, response: { 'numFound' => 3 }) } let(:doc_list) { [double(id: 123), double(...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/my/highlights_controller_spec.rb
Ruby
apache-2.0
197
main
1,874
# frozen_string_literal: true RSpec.describe Hyrax::My::HighlightsController, :clean_repo, type: :controller do describe "logged in user" do let(:user) { create(:user) } before { sign_in user } describe "#index" do before do user.trophies.create(work_id: highlighted_work.id) other_...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/workflows_controller_spec.rb
Ruby
apache-2.0
197
main
1,805
# frozen_string_literal: true RSpec.describe Hyrax::Admin::WorkflowsController do describe "#index" do let(:user) { FactoryBot.create(:admin) } before { sign_in user } it "is successful" do expect(controller).to receive(:add_breadcrumb).with('Home', root_path) expect(controller).to receive(:...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/admin_sets_controller_spec.rb
Ruby
apache-2.0
197
main
13,765
# frozen_string_literal: true require 'hyrax/specs/shared_specs' RSpec.describe Hyrax::Admin::AdminSetsController, :clean_repo do routes { Hyrax::Engine.routes } let(:admin) { FactoryBot.create(:admin, email: 'admin@example.com') } let(:manager) { FactoryBot.create(:user, email: 'manager@example.com') } let...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/permission_templates_controller_spec.rb
Ruby
apache-2.0
197
main
4,408
# frozen_string_literal: true RSpec.describe Hyrax::Admin::PermissionTemplatesController do routes { Hyrax::Engine.routes } before do sign_in create(:user) allow(Hyrax::Forms::PermissionTemplateForm).to receive(:new).with(permission_template).and_return(form) end let(:hyrax) { Hyrax::Engine.routes.url_h...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/collection_type_participants_controller_spec.rb
Ruby
apache-2.0
197
main
5,419
# frozen_string_literal: true RSpec.describe Hyrax::Admin::CollectionTypeParticipantsController, type: :controller do context 'anonymous user' do let(:collection_type) { create(:collection_type) } let(:valid_attributes) do { hyrax_collection_type_id: collection_type.id, access: 'creator'...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/stats_controller_spec.rb
Ruby
apache-2.0
197
main
1,851
# frozen_string_literal: true RSpec.describe Hyrax::Admin::StatsController, type: :controller do let(:user) { create(:user) } context "a non admin" do describe "#show" do it 'is unauthorized' do get :show expect(response).to be_redirect end end end context "as an admin" do ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/permission_template_accesses_controller_spec.rb
Ruby
apache-2.0
197
main
7,731
# frozen_string_literal: true RSpec.describe Hyrax::Admin::PermissionTemplateAccessesController do routes { Hyrax::Engine.routes } let(:hyrax) { Hyrax::Engine.routes.url_helpers } let(:permission_template_access) { FactoryBot.create(:permission_template_access) } let(:source_id) { permission_template_access.per...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/appearances_controller_spec.rb
Ruby
apache-2.0
197
main
2,100
# frozen_string_literal: true RSpec.describe Hyrax::Admin::AppearancesController do describe "#show" do before do sign_in user end let(:user) { create(:user) } context "when not authorized" do it "renders the unauthorized template" do get :show expect(response).to render_t...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/collection_types_controller_spec.rb
Ruby
apache-2.0
197
main
13,031
# frozen_string_literal: true RSpec.describe Hyrax::Admin::CollectionTypesController, type: :controller, clean_repo: true do context "anonymous user" do describe "#index" do it "returns http redirect" do get :index expect(response).to have_http_status(:redirect) end end descri...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/features_controller_spec.rb
Ruby
apache-2.0
197
main
996
# frozen_string_literal: true RSpec.describe Hyrax::Admin::FeaturesController do describe "#index" do before do sign_in user end let(:user) { create(:user) } context "when not authorized" do it "redirects away" do get :index expect(response).to redirect_to root_path ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/users_controller_spec.rb
Ruby
apache-2.0
197
main
748
# frozen_string_literal: true RSpec.describe Hyrax::Admin::UsersController, type: :controller do before do expect(controller).to receive(:authorize!).with(:read, :admin_dashboard).and_return(true) end describe "#index" do it "is successful" do expect(controller).to receive(:add_breadcrumb).with(I18...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb
Ruby
apache-2.0
197
main
2,895
# frozen_string_literal: true RSpec.describe Hyrax::Admin::WorkflowRolesController do describe '#index' do context "when you have permission" do before do allow(controller).to receive(:authorize!).with(:read, :admin_dashboard).and_return(true) end it "is successful" do expect(co...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/strategies_controller_spec.rb
Ruby
apache-2.0
197
main
1,484
# frozen_string_literal: true RSpec.describe Hyrax::Admin::StrategiesController do describe "#update" do before do # Added when Flipflop bumped to 2.3.2. See also https://github.com/voormedia/flipflop/issues/26 Flipflop::FeatureSet.current.instance_variable_set(:@features, original_feature_hash.merge(...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/metadata_profiles_controller_spec.rb
Ruby
apache-2.0
197
main
2,596
# frozen_string_literal: true require 'rails_helper' RSpec.describe Hyrax::Admin::MetadataProfilesController, type: :controller do routes { Hyrax::Engine.routes } let(:admin) { FactoryBot.create(:admin) } let(:profile_file_path) { File.join(fixture_path, 'files', 'm3_profile.yaml') } let(:uploaded_file) { fix...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/admin/analytics/work_reports_controller_spec.rb
Ruby
apache-2.0
197
main
461
# frozen_string_literal: true require 'rails_helper' RSpec.describe Hyrax::Admin::Analytics::WorkReportsController, type: :controller do routes { Hyrax::Engine.routes } describe 'GET #index' do context 'when user is not logged in' do it 'redirects to the login page' do get :index expect(r...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/dashboard/works_controller_spec.rb
Ruby
apache-2.0
197
main
472
# frozen_string_literal: true RSpec.describe Hyrax::Dashboard::WorksController, type: :controller do describe "#search_builder_class" do subject { controller.blacklight_config.search_builder_class } it { is_expected.to eq Hyrax::Dashboard::WorksSearchBuilder } end describe "#search_facet_path" do su...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/dashboard/collections_controller_spec.rb
Ruby
apache-2.0
197
main
36,571
# frozen_string_literal: true require 'hyrax/specs/spy_listener' RSpec.describe Hyrax::Dashboard::CollectionsController, :clean_repo do ['Collection', 'CollectionResource'].each do |model| context "with model #{model}" do before { allow(Hyrax.config).to receive(:collection_model).and_return(model) } ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/dashboard/profiles_controller_spec.rb
Ruby
apache-2.0
197
main
6,756
# frozen_string_literal: true RSpec.describe Hyrax::Dashboard::ProfilesController do let(:user) { create(:user) } before do sign_in user allow(controller).to receive(:clear_session_user) ## Don't clear out the authenticated session end describe "#show" do it "show the user profile if user exists" ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb
Ruby
apache-2.0
197
main
21,305
# frozen_string_literal: true RSpec.describe Hyrax::Dashboard::CollectionMembersController, :clean_repo do routes { Hyrax::Engine.routes } let(:user) { FactoryBot.create(:user) } before { sign_in(user) } describe '#update_members' do let(:owned_work_1) { FactoryBot.valkyrie_create(:hyrax_work, edit_us...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/dashboard/nest_collections_controller_spec.rb
Ruby
apache-2.0
197
main
6,139
# frozen_string_literal: true RSpec.describe Hyrax::Dashboard::NestCollectionsController do routes { Hyrax::Engine.routes } let(:user) { FactoryBot.create(:user) } let(:parameters) { { child_id: child.id, parent_id: parent.id } } let(:child) do FactoryBot.valkyrie_create(:hyrax_collection, :public) end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/api/items_controller_spec.rb
Ruby
apache-2.0
197
main
14,805
# frozen_string_literal: true RSpec.describe Hyrax::API::ItemsController, type: :controller do let(:arkivo_actor) { double Hyrax::Arkivo::Actor } let(:user) { create(:user) } let(:default_work) do valkyrie_create(:monograph, title: ['Foo Bar'], edit_users: [user], arkivo_check...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/hyrax/api/zotero_controller_spec.rb
Ruby
apache-2.0
197
main
5,781
# frozen_string_literal: true RSpec.describe Hyrax::API::ZoteroController, type: :controller do let(:user) { create(:user) } subject { response } context 'with an HTTP GET to /api/zotero' do context 'with an unauthenticated client' do before { get :initiate } specify do expect(subject)....
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/concerns/hyrax/collections_controller_behavior_spec.rb
Ruby
apache-2.0
197
main
963
# frozen_string_literal: true RSpec.describe Hyrax::CollectionsControllerBehavior, :clean_repo, type: :controller do let(:paths) { controller.main_app } controller(ApplicationController) do include Hyrax::CollectionsControllerBehavior # rubocop:disable RSpec/DescribedClass end shared_context 'with a logg...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/concerns/hyrax/flexible_catalog_behavior_spec.rb
Ruby
apache-2.0
197
main
13,296
# frozen_string_literal: true require 'rails_helper' RSpec.describe Hyrax::FlexibleCatalogBehavior, type: :controller do let(:base_profile) { YAML.safe_load_file(Hyrax::Engine.root.join('spec', 'fixtures', 'files', 'm3_profile.yaml')) } # adds additional properties to the base profile to # include properties t...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/controllers/concerns/hyrax/works_controller_behavior_spec.rb
Ruby
apache-2.0
197
main
23,043
# frozen_string_literal: true require 'hyrax/specs/spy_listener' RSpec.describe Hyrax::WorksControllerBehavior, :clean_repo, type: :controller do let(:paths) { controller.main_app } let(:title) { ['Comet in Moominland'] } let(:work) { FactoryBot.valkyrie_create(:hyrax_work, alternate_ids: [id], title: title) }...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/matcher_tests/match_valkyrie_ids_with_af_ids_spec.rb
Ruby
apache-2.0
197
main
1,301
# frozen_string_literal: true require 'spec_helper' RSpec.describe Hyrax::Matchers::MatchValkyrieIdsWithActiveFedoraIds do context 'when valkyrie ids and active fedora ids match' do let(:valkyrie_ids) { [Valkyrie::ID.new('id1'), Valkyrie::ID.new('id2')] } let(:af_ids) { ['id1', 'id2'] } it 'returns true...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/channels/hyrax/notifications_channel_spec.rb
Ruby
apache-2.0
197
main
1,333
# frozen_string_literal: true RSpec.describe Hyrax::NotificationsChannel do subject { described_class.new(connection, nil) } let(:connection) { Hyrax::ApplicationCable::Connection.new(server, {}) } let(:server) { ActionCable::Server::Base.new } let(:user) { create(:user) } before do allow(connection).to...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/channels/hyrax/application_cable/channel_spec.rb
Ruby
apache-2.0
197
main
576
# frozen_string_literal: true RSpec.describe Hyrax::ApplicationCable::Channel do subject { described_class.new(connection, identifier) } let(:connection) { double('connection', identifiers: []) } let(:identifier) { double } describe 'behaves like an ActionCable::Channel::Base' do it { is_expected.to respo...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/channels/hyrax/application_cable/connection_spec.rb
Ruby
apache-2.0
197
main
1,097
# frozen_string_literal: true RSpec.describe Hyrax::ApplicationCable::Connection do subject { described_class.new(server, env) } let(:server) { ActionCable::Server::Base.new } let(:env) { {} } describe '#connect' do # rubocop:disable RSpec/SubjectStub before do allow(subject).to receive(:user_id...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/support/can_can_overrides.rb
Ruby
apache-2.0
197
main
1,685
# frozen_string_literal: true ## # This monkey-patch shim is for both active_fedora and valkyrie resources for tests # This shim handles the case where controllers are loaded with an ActiveFedora collection class # different than a test mocks Hyrax.config.collection_class. # This override checks the value in Hyrax.conf...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/support/spec_statistic.rb
Ruby
apache-2.0
197
main
569
# frozen_string_literal: true # This is a replacement for the OpenStruct usage. The idea is to expose # an object with a common interface. class SpecStatistic def initialize(**kargs) @attributes = kargs.symbolize_keys end def [](key) @attributes[key.to_sym] end def method_missing(method_name, *argum...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/support/shared_examples_for_collection_presenter.rb
Ruby
apache-2.0
197
main
1,347
# frozen_string_literal: true RSpec.shared_examples "a total_viewable method" do context('empty collection') { it { is_expected.to eq 0 } } context "null members" do let(:presenter) { described_class.new(SolrDocument.new(id: '123'), ability) } it { is_expected.to eq 0 } end end RSpec.shared_examples "...