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/support/clean_solr.rb | Ruby | apache-2.0 | 197 | main | 245 | # frozen_string_literal: true
RSpec.configure do |config|
config.before(:each, clean_index: true) do
client = Valkyrie::IndexingAdapter.find(:solr_index).connection
client.delete_by_query("*:*", params: { softCommit: true })
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/factory_helpers.rb | Ruby | apache-2.0 | 197 | main | 3,844 | # frozen_string_literal: true
module Hyrax
module FactoryHelpers
module_function
FIELDS = { mime_type: 'text/plain',
content: 'content',
file_size: [],
format_label: [],
height: [],
width: [],
filename: [],
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/optional_example.rb | Ruby | apache-2.0 | 197 | main | 537 | # frozen_string_literal: true
module OptionalExample
RSpec.configure do |config|
config.after do |example|
if example.metadata[:optional] && (RSpec::Core::Pending::PendingExampleFixedError === example.display_exception) # rubocop:disable Style/CaseEquality
ex = example.display_exception
exam... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/speedup.rb | Ruby | apache-2.0 | 197 | main | 231 | # frozen_string_literal: true
# Prevent recompiling assets in test.
# See: https://github.com/rails/rails/pull/27271
# This can be removed when we use Rails 5.1.0
class << ActionView::LookupContext::DetailsKey
def clear; end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/book_resource.rb | Ruby | apache-2.0 | 197 | main | 1,413 | # frozen_string_literal: true
module Hyrax
module Test
##
# A simple Hyrax::Resource with some metadata.
#
# Use this for testing valkyrie models generically, with Hyrax assumptions
# but no PCDM modelling behavior.
class BookResource < Hyrax::Resource
attribute :author, Valkyrie::Typ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/features.rb | Ruby | apache-2.0 | 197 | main | 451 | # frozen_string_literal: true
# spec/support/features.rb
require File.expand_path('../features/session_helpers', __FILE__)
require File.expand_path('../features/workflow', __FILE__)
require File.expand_path('../features/batch_edit_actions', __FILE__)
require File.expand_path('../selectors', __FILE__)
require File.expan... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/flexible_metadata_setup.rb | Ruby | apache-2.0 | 197 | main | 5,033 | # frozen_string_literal: true
# This module handles the setup of flexible metadata for the test suite.
# It's extracted from spec_helper.rb to improve organization and maintainability.
module FlexibleMetadataSetup
class << self
def setup_flexible_metadata
return unless Hyrax.config.flexible?
registe... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/controller_level_helpers.rb | Ruby | apache-2.0 | 197 | main | 835 | # frozen_string_literal: true
module ControllerLevelHelpers
# This provides some common mock methods for view tests.
# These are normally provided by the controller.
module ControllerViewHelpers
def search_state
@search_state ||= CatalogController.search_state_class.new(params, blacklight_config, contr... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/logging_formatter.rb | Ruby | apache-2.0 | 197 | main | 2,035 | # frozen_string_literal: true
RSpec::Support.require_rspec_core "formatters/base_text_formatter"
class LoggingFormatter < RSpec::Core::Formatters::ProgressFormatter
RSpec::Core::Formatters.register self, :example_started, :example_passed, :dump_profile
def initialize(output)
@profile = []
reset!
ActiveS... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/rake.rb | Ruby | apache-2.0 | 197 | main | 926 | # frozen_string_literal: true
require 'rake'
module RakeHelper
def load_rake_environment(files)
@rake = Rake::Application.new
Rake.application = @rake
Rake::Task.define_task(:environment)
files.each { |file| load file }
end
def run_task(task, arg = nil)
capture_stdout_stderr do
@rake[t... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/wings_models.rb | Ruby | apache-2.0 | 197 | main | 417 | # frozen_string_literal: true
return if Hyrax.config.disable_wings
# Clear existing Collection mapping to allow reverse lookups to resolve CollectionResource.
# Then restore PcdmCollection for any code directly using that model.
Wings::ModelRegistry.unregister(Hyrax::PcdmCollection)
Wings::ModelRegistry.register(Coll... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/with_indexing.rb | Ruby | apache-2.0 | 197 | main | 382 | # frozen_string_literal: true
module WithIndexing
def with_live_indexing
if Hyrax.config.index_adapter.is_a?(Valkyrie::Indexing::NullIndexingAdapter)
Hyrax.config.index_adapter = :solr_index
r = yield
Hyrax.config.index_adapter = :null_index
r
else
yield
end
end
RSpec.co... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/input_support.rb | Ruby | apache-2.0 | 197 | main | 287 | # frozen_string_literal: true
module InputSupport
extend ActiveSupport::Concern
include RSpec::Rails::HelperExampleGroup
def input_for(object, attribute_name, options = {})
helper.simple_form_for object, url: '' do |f|
f.input attribute_name, options
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/form_with_validations.rb | Ruby | apache-2.0 | 197 | main | 327 | # frozen_string_literal: true
module Hyrax
module Test
class FormWithValidations < Hyrax::Forms::ResourceForm
property :title
validates :title, presence: true
# Added to comply with Hyrax::Forms::FailedSubmissionFormWrapper
def permitted_params
{ title: [] }
end
end
e... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/selectors.rb | Ruby | apache-2.0 | 197 | main | 3,838 | # frozen_string_literal: true
module Selectors
module Dashboard
def db_item_actions_toggle(item)
within "#document_#{item.id}" do
find '.dropdown-toggle'
end
end
# For use with javascript user selector that allows for searching for an existing user
# and granting them permission t... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/time_helpers.rb | Ruby | apache-2.0 | 197 | main | 466 | # frozen_string_literal: true
RSpec.configure do |config|
# Include ActiveSupport::Testing::TimeHelpers in all examples
config.include ActiveSupport::Testing::TimeHelpers
# Hook for :frozen_time tag - freezes time to Nov 17, 2011 14:23 EST
config.around(:example, :frozen_time) do |example|
# Nov 17, 2011 ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/features/batch_edit_actions.rb | Ruby | apache-2.0 | 197 | main | 1,181 | # frozen_string_literal: true
def batch_edit_fields
# skipping based_near because it's a select2 field, which is hard to test via capybara
[
"creator", "contributor", "description", "keyword", "publisher", "date_created",
"subject", "language", "identifier", "related_url"
]
end
def fill_in_batch_edit_fie... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/features/workflow.rb | Ruby | apache-2.0 | 197 | main | 375 | # frozen_string_literal: true
def ensure_deposit_available_for(user)
template = create(:permission_template, with_admin_set: true, with_workflows: true)
# Grant the user access to deposit into an admin set.
create(:permission_template_access,
:deposit,
permission_template: template,
age... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/features/session_helpers.rb | Ruby | apache-2.0 | 197 | main | 449 | # frozen_string_literal: true
# spec/support/features/session_helpers.rb
module Features
module SessionHelpers
def sign_in(who = :user)
logout
user = who.is_a?(User) ? who : build(:user).tap(&:save!)
visit new_user_session_path
fill_in 'Email', with: user.email
fill_in 'Password', wi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/matchers/embargo.rb | Ruby | apache-2.0 | 197 | main | 350 | # frozen_string_literal: true
RSpec::Matchers.define :be_an_embargo_matching do |embargo_args|
match do |embargo|
(embargo.visibility_after_embargo == embargo_args[:after]) &&
(embargo.visibility_during_embargo == embargo_args[:during]) &&
embargo.embargo_release_date.to_s.start_with?(embargo_args[:r... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/matchers/match_valkyrie_ids_with_af_ids.rb | Ruby | apache-2.0 | 197 | main | 396 | # frozen_string_literal: true
module Hyrax::Matchers
class MatchValkyrieIdsWithActiveFedoraIds < RSpec::Matchers::BuiltIn::ContainExactly
def match_when_sorted?
values_match?(safe_sort(expected), safe_sort(actual.map(&:id)))
end
end
def match_valkyrie_ids_with_active_fedora_ids(expected_fedora_ids)... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/matchers/pcdm_matchers.rb | Ruby | apache-2.0 | 197 | main | 1,122 | # frozen_string_literal: true
RSpec::Matchers.define :have_file_set_members do |*expected_file_sets|
match do |actual_work|
actual_file_sets = Hyrax.custom_queries.find_child_file_sets(resource: actual_work)
expect(actual_file_sets).to contain_exactly(*expected_file_sets)
end
end
RSpec::Matchers.define :h... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/matchers/permission.rb | Ruby | apache-2.0 | 197 | main | 737 | # frozen_string_literal: true
RSpec::Matchers.define :grant_permission do |acl_type|
match do |permission|
access_match = permission.access == acl_type.to_s
agent_match =
if user_id
permission.type == 'person' &&
permission.agent.first.id.include?(user_id.to_s)
elsif group_id
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/matchers/collection_type_property_matchers.rb | Ruby | apache-2.0 | 197 | main | 578 | # frozen_string_literal: true
RSpec::Matchers.define :require_membership do
match do |actual|
actual&.require_membership?
end
end
RSpec::Matchers.define :allow_multiple_membership do
match do |actual|
actual&.allow_multiple_membership?
end
end
RSpec::Matchers.define :assign_visibility do
match do |a... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/matchers/response_matchers.rb | Ruby | apache-2.0 | 197 | main | 261 | # frozen_string_literal: true
RSpec::Matchers.define :fail_redirect_and_flash do |path, flash_message|
match do |response|
expect(response.status).to eq 302
expect(response).to redirect_to(path)
expect(flash[:alert]).to eq flash_message
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/matchers/api_responses.rb | Ruby | apache-2.0 | 197 | main | 1,468 | # frozen_string_literal: true
# RSpec matchers for API default JSON responses.
# Creates a matcher like respond_forbidden or respond_not_found corresponding to each of the Api::V1.default_responses
# Accepts optional overrides to the expected response body.
# @example Override the description expected in the JSON body ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/matchers/lease.rb | Ruby | apache-2.0 | 197 | main | 328 | # frozen_string_literal: true
RSpec::Matchers.define :be_a_lease_matching do |lease_args|
match do |lease|
(lease.visibility_after_lease == lease_args[:after]) &&
(lease.visibility_during_lease == lease_args[:during]) &&
lease.lease_expiration_date.to_s.start_with?(lease_args[:release_date][0..9])
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/fakes/fake_search_builder_scope.rb | Ruby | apache-2.0 | 197 | main | 1,586 | # frozen_string_literal: true
##
# +Blacklight::SearchBuilder+ requires a 'scope' object, which its documentation
# describes as "the scope where the filter methods reside in."
#
# Often (usually?) this is a Controller with:
# - +#blacklight_config+
# - +#current_ability+
# - +#current_user+
# - +#params+
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/fakes/test_hydra_group_service.rb | Ruby | apache-2.0 | 197 | main | 1,322 | # frozen_string_literal: true
##
# A fake group service implementation for use in test suites as a drop-in
# replacement for `RoleMapper` or the `hydra-role-management` gem, allowing
# dynamic group assignment backed by in-memory data structures.
#
# @example setup the group service for an rspec test suite
# config.... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/fakes/indexing_adapter.rb | Ruby | apache-2.0 | 197 | main | 317 | # frozen_string_literal: true
class FakeIndexingAdapter
attr_reader :deleted_resources, :saved_resources
def initialize
@deleted_resources = []
@saved_resources = []
end
def save(resource:)
@saved_resources << resource
end
def delete(resource:)
@deleted_resources << resource
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/support/fakes/fake_actor.rb | Ruby | apache-2.0 | 197 | main | 305 | # frozen_string_literal: true
class FakeActor < Hyrax::Actors::AbstractActor
attr_accessor :created, :destroyed, :updated
def create(env)
self.created = env
true
end
def destroy(env)
self.destroyed = env
true
end
def update(env)
self.updated = env
true
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/tasks/rake_spec.rb | Ruby | apache-2.0 | 197 | main | 5,328 | # frozen_string_literal: true
require 'rake'
RSpec.describe "Rake tasks" do
describe "hyrax:embargo:deactivate_expired", :clean_repo, :frozen_time do
let!(:active) do
[FactoryBot.valkyrie_create(:hyrax_work, :under_embargo),
FactoryBot.valkyrie_create(:hyrax_work, :under_embargo)]
end
let!(... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/user_stat_importer_spec.rb | Ruby | apache-2.0 | 197 | main | 12,953 | # frozen_string_literal: true
# NOTE: This importer service seems to be ActiveFedora-specific. May need to be
# Valkyrized in the future.
RSpec.describe Hyrax::UserStatImporter, skip: 'Needs fixes for new analytics' do
before do
allow(Hyrax.config).to receive(:analytic_start_date) { dates[0] }
allow(FileV... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/lease_service_spec.rb | Ruby | apache-2.0 | 197 | main | 4,885 | # frozen_string_literal: true
RSpec.describe Hyrax::LeaseService, :clean_repo, :frozen_time do
subject { described_class }
context 'wings enabled', :active_fedora do
let(:future_date) { 2.days.from_now }
let(:past_date) { 2.days.ago }
let!(:work_with_expired_lease1) do
build(:generic_work, lease... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/fixity_check_failure_service_spec.rb | Ruby | apache-2.0 | 197 | main | 2,573 | # frozen_string_literal: true
RSpec.describe Hyrax::FixityCheckFailureService do
subject(:service) { described_class.new(file_set, checksum_audit_log: checksum_audit_log) }
let(:depositor) { FactoryBot.create(:user) }
let(:inbox) { depositor.mailbox.inbox }
context "with Valkyrie models", valkyrie_adapter: :te... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/admin_set_service_spec.rb | Ruby | apache-2.0 | 197 | main | 7,221 | # frozen_string_literal: true
RSpec.describe Hyrax::AdminSetService do
let(:controller) { ::CatalogController.new }
let(:context) do
double(current_ability: Ability.new(user),
repository: controller.blacklight_config.repository,
blacklight_config: controller.blacklight_config,
s... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/lockable_spec.rb | Ruby | apache-2.0 | 197 | main | 1,832 | # frozen_string_literal: true
RSpec.describe Hyrax::Lockable do
let(:lockable_class) { Class.new.include(described_class) }
let(:lock_manager) { instance_double(Hyrax::LockManager) }
subject { lockable_class.new }
describe "lock_manager" do
it "lazily creates a new lock manager with the default configurat... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/admin_set_create_service_spec.rb | Ruby | apache-2.0 | 197 | main | 12,246 | # frozen_string_literal: true
require 'hyrax/specs/spy_listener'
RSpec.describe Hyrax::AdminSetCreateService do
let(:user) { FactoryBot.create(:user) }
let(:persister) { Hyrax.persister }
let(:query_service) { Hyrax.query_service }
describe '.find_or_create_default_admin_set', :clean_repo do
context "when... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/admin_set_member_service_spec.rb | Ruby | apache-2.0 | 197 | main | 842 | # frozen_string_literal: true
RSpec.describe Hyrax::AdminSetMemberService, clean_repo: true do
subject(:builder) { described_class.new(scope: scope, collection: admin_set, params: { "id" => admin_set.id.to_s }) }
let(:admin_set) { valkyrie_create(:hyrax_admin_set) }
let(:scope) { FakeSearchBuilderScope.new(curren... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/lease_manager_spec.rb | Ruby | apache-2.0 | 197 | main | 3,957 | # frozen_string_literal: true
RSpec.describe Hyrax::LeaseManager, :frozen_time do
subject(:manager) { described_class.new(resource: resource) }
let(:resource) { Hyrax::Resource.new }
shared_context 'when under lease' do
let(:resource) { FactoryBot.build(:hyrax_resource, :under_lease) }
end
shared_co... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/file_set_derivatives_service_spec.rb | Ruby | apache-2.0 | 197 | main | 2,396 | # frozen_string_literal: true
require 'hyrax/specs/shared_specs'
RSpec.describe Hyrax::FileSetDerivativesService do
context 'for active_fedora', :active_fedora do
let(:valid_file_set) do
FileSet.new.tap do |f|
allow(f).to receive(:mime_type).and_return('image/png')
end
end
it_behaves... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/resource_status_spec.rb | Ruby | apache-2.0 | 197 | main | 3,044 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Hyrax::ResourceStatus do
subject(:status) { described_class.new(resource: resource) }
let(:resource) { fake_with_status.new }
let(:fake_with_status) do
Class.new do
attr_reader :state
def initialize(state = nil)
@stat... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/edit_permissions_service_spec.rb | Ruby | apache-2.0 | 197 | main | 9,331 | # frozen_string_literal: true
RSpec.describe Hyrax::EditPermissionsService do
let(:my_user) { FactoryBot.create(:user) }
let(:ability) { Ability.new(my_user) }
# build users for testing
let(:mgr1) { FactoryBot.create(:user) }
let(:mgr2) { FactoryBot.create(:user) }
let(:mgr3) { FactoryBot.create(:user) }
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/tolerant_select_service_spec.rb | Ruby | apache-2.0 | 197 | main | 2,651 | # frozen_string_literal: true
RSpec.describe Hyrax::TolerantSelectService do
subject(:select_service) { described_class.new(authority_name) }
let(:authority) { FakeAuthority }
let(:authority_name) { 'fake_authority' }
let(:authority_map) { [] }
before do
allow(Qa::Authorities::Local)
.to receive(:... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/graph_exporter_spec.rb | Ruby | apache-2.0 | 197 | main | 2,317 | # frozen_string_literal: true
# NOTE: This service focuses solely on interacting with ActiveFedora methods and connections.
RSpec.describe Hyrax::GraphExporter, :active_fedora do
subject(:service) { described_class.new(document, hostname: 'localhost') }
let(:work) { FactoryBot.create(:work_with_one_file, visibilit... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/thumbnail_path_service_spec.rb | Ruby | apache-2.0 | 197 | main | 2,978 | # frozen_string_literal: true
RSpec.describe Hyrax::ThumbnailPathService do
include Hyrax::FactoryHelpers
subject { described_class.call(object) }
context 'with a Valkyrie resource' do
subject(:service) { described_class }
let(:object) { FactoryBot.build(:hyrax_resource) }
describe '#call' do
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/abstract_message_service_spec.rb | Ruby | apache-2.0 | 197 | main | 605 | # frozen_string_literal: true
RSpec.describe Hyrax::AbstractMessageService do
let(:file_set) { double }
let(:user) { build(:user) }
let(:klass) do
Class.new(described_class) do
def message
'You have won!'
end
def subject
'Attention!'
end
end
end
subject { klas... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/find_objects_via_solr_service_spec.rb | Ruby | apache-2.0 | 197 | main | 1,824 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Hyrax::FindObjectsViaSolrService do
describe ".find_for_model_by_field_pairs", clean_repo: true do
let(:collection_ids) { [collection1.id, collection2.id] }
let(:field_pairs) do
{ id: collection_ids.map(&:to_s) }
end
subject(:re... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/curation_concern_spec.rb | Ruby | apache-2.0 | 197 | main | 502 | # frozen_string_literal: true
RSpec.describe Hyrax::CurationConcern do
let(:work) { GenericWork.new }
let(:user) { double(current_user: double) }
describe ".actor" do
subject { described_class.actor }
it { is_expected.to be_kind_of Hyrax::Actors::AbstractActor }
end
describe ".actor_factory" do
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/batch_create_failure_service_spec.rb | Ruby | apache-2.0 | 197 | main | 610 | # frozen_string_literal: true
RSpec.describe Hyrax::BatchCreateFailureService do
let(:depositor) { create(:user) }
let(:inbox) { depositor.mailbox.inbox }
let(:messages) { ['You did a bad'] }
describe "#call" do
subject { described_class.new(depositor, messages) }
it "sends failing mail" do
subj... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/versioning_service_spec.rb | Ruby | apache-2.0 | 197 | main | 6,289 | # frozen_string_literal: true
RSpec.describe Hyrax::VersioningService do
let(:user) { build(:user) }
let(:file) { create(:file_set) }
describe 'using ActiveFedora', :active_fedora do
before do
# Add the original_file (this service creates a version after saving when you call it with versioning: true)
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/work_form_service_spec.rb | Ruby | apache-2.0 | 197 | main | 854 | # frozen_string_literal: true
RSpec.describe Hyrax::WorkFormService, :active_fedora do
subject(:form_service) { described_class }
let(:work) { GenericWork.new }
describe '.form_class' do
it 'returns a form class by constant name convention' do
expect(form_service.form_class(work)).to eq Hy... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/file_set_file_service.rb | Ruby | apache-2.0 | 197 | main | 1,599 | # frozen_string_literal: true
RSpec.describe Hyrax::FileSetFileService do
describe '#original_file' do
let(:original_file) { FactoryBot.valkyrie_create(:hyrax_file_metadata) }
let(:other_file) { FactoryBot.valkyrie_create(:hyrax_file_metadata, use: :thumbnail_file) }
context 'when an original file is set... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/messenger_service_spec.rb | Ruby | apache-2.0 | 197 | main | 627 | # frozen_string_literal: true
RSpec.describe Hyrax::MessengerService do
describe '#deliver' do
let(:sender) { create(:user) }
let(:recipients) { create(:user) }
let(:body) { 'Quite an excellent message' }
let(:subject) { 'IMPORTANT' }
let(:other_arg) { 'Did I make it?' }
it 'invokes Hyrax::Me... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/valkyrie_persist_derivatives_spec.rb | Ruby | apache-2.0 | 197 | main | 3,604 | # frozen_string_literal: true
RSpec.describe Hyrax::ValkyriePersistDerivatives, valkyrie_adapter: :test_adapter do
let(:fits_response) { IO.read('spec/fixtures/png_fits.xml') }
before do
allow(Hyrax.config)
.to receive(:derivatives_path)
.and_return('/app/samvera/hyrax-webapp/derivatives/')
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/license_service_spec.rb | Ruby | apache-2.0 | 197 | main | 1,266 | # frozen_string_literal: true
RSpec.describe Hyrax::LicenseService do
before do
# Configure QA to use fixtures
qa_fixtures = { local_path: File.expand_path('spec/fixtures/authorities') }
allow(Qa::Authorities::Local).to receive(:config).and_return(qa_fixtures)
end
let(:service) { described_class.new }... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/change_depositor_service_spec.rb | Ruby | apache-2.0 | 197 | main | 5,076 | # frozen_string_literal: true
RSpec.describe Hyrax::ChangeDepositorService do
let!(:depositor) { FactoryBot.create(:user) }
let!(:receiver) { FactoryBot.create(:user) }
context "for Active Fedora objects", :active_fedora do
let!(:work) do
create(:work, title: ['Test work'], user: depositor)
end
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/file_set_fixity_check_service_spec.rb | Ruby | apache-2.0 | 197 | main | 3,152 | # frozen_string_literal: true
RSpec.describe Hyrax::FileSetFixityCheckService,
pending: Hyrax.config.disable_wings ? 'Valkyrie rewrite needed' : false do
let(:f) { create(:file_set, :image) }
let(:service_by_object) { described_class.new(f) }
let(:service_by_id) { described_clas... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/embargo_manager_spec.rb | Ruby | apache-2.0 | 197 | main | 6,572 | # frozen_string_literal: true
RSpec.describe Hyrax::EmbargoManager, :frozen_time do
subject(:manager) { described_class.new(resource: resource) }
let(:resource) { Hyrax::Resource.new }
shared_context 'when under embargo' do
let(:resource) { FactoryBot.build(:hyrax_resource, :under_embargo) }
end
sha... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/change_content_depositor_service_spec.rb | Ruby | apache-2.0 | 197 | main | 4,124 | # frozen_string_literal: true
RSpec.describe Hyrax::ChangeContentDepositorService do
let!(:depositor) { create(:user) }
let!(:receiver) { create(:user) }
it "is deprecated" do
work = build(:work)
expect(Deprecation).to receive(:warn).at_least(:once)
described_class.call(work, receiver, false)
end
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/caching_iiif_manifest_builder_spec.rb | Ruby | apache-2.0 | 197 | main | 798 | # frozen_string_literal: true
RSpec.describe Hyrax::CachingIiifManifestBuilder, :clean_repo do
let(:id) { "123" }
let(:manifest_url) { File.join("https://samvera.org", "show", id) }
let(:etag) { 'my_etag' }
let(:work_presenter) { double("Work Presenter") }
let(:file_set_presenter) { double("File Set Presente... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/permission_template_applicator_spec.rb | Ruby | apache-2.0 | 197 | main | 2,310 | # frozen_string_literal: true
RSpec.describe Hyrax::PermissionTemplateApplicator do
subject(:applicator) { described_class.new(template: template) }
let(:manage_groups) { ['edit_group_1', 'edit_group_2'] }
let(:manage_users) { [FactoryBot.create(:user).user_key, FactoryBot.create(:user).user_key] }
let(:temp... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/quick_classification_query_spec.rb | Ruby | apache-2.0 | 197 | main | 842 | # frozen_string_literal: true
RSpec.describe Hyrax::QuickClassificationQuery do
let(:user) { create(:user) }
context "with no options" do
let(:query) { described_class.new(user) }
describe "#all?" do
subject { query.all? }
it { is_expected.to be true }
end
describe '#each' do
l... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/embargo_service_spec.rb | Ruby | apache-2.0 | 197 | main | 4,793 | # frozen_string_literal: true
RSpec.describe Hyrax::EmbargoService, :clean_repo, :frozen_time do
subject(:service) { described_class }
let(:future_date) { 2.days.from_now }
let(:past_date) { 2.days.ago }
let!(:work_with_expired_enforced_embargo1) { valkyrie_create(:hyrax_work, :with_expired_enforced_embargo) }
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/qa_select_service_spec.rb | Ruby | apache-2.0 | 197 | main | 3,931 | # frozen_string_literal: true
RSpec.describe Hyrax::QaSelectService do
let(:authority_map) do
[
HashWithIndifferentAccess.new(term: 'Active Label', label: 'Active Label', id: 'active-id', active: true),
HashWithIndifferentAccess.new(term: 'Inactive Label', label: 'Inactive Label', id: 'inactive-id', a... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/working_directory_spec.rb | Ruby | apache-2.0 | 197 | main | 602 | # frozen_string_literal: true
RSpec.describe Hyrax::WorkingDirectory do
let(:path1) { described_class.send(:full_filename, 'abcdefghijklmnop1', 'foo.tif') }
let(:path2) { described_class.send(:full_filename, 'abcdefghijklmnop2', 'foo.tif') }
describe "#full_filename" do
it "generates unique filenames for dif... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/valkyrie_upload_spec.rb | Ruby | apache-2.0 | 197 | main | 2,567 | # frozen_string_literal: true
require 'hyrax/specs/spy_listener'
RSpec.describe Hyrax::ValkyrieUpload do
let(:file_set) { FactoryBot.valkyrie_create(:hyrax_file_set) }
let(:file) { File.open('spec/fixtures/image.png') }
let(:filename) { File.basename(file.path).to_s }
let(:user) { create(:user) }
let(:list... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/persist_directly_contained_output_file_service_spec.rb | Ruby | apache-2.0 | 197 | main | 811 | # frozen_string_literal: true
RSpec.describe Hyrax::PersistDirectlyContainedOutputFileService, :active_fedora do
# PersistDirectlyContainedOutputFileService is used by FullTextExtract.output_file_service
let(:file_set) { create(:file_set, user: user) }
let(:user) { build(:user) }
let(:content) { "fake file cont... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/noid_spec.rb | Ruby | apache-2.0 | 197 | main | 1,053 | # frozen_string_literal: true
RSpec.describe Hyrax::Noid do
let(:class_with_noids) do
Class.new do
include Hyrax::Noid
attr_reader :id
def initialize(id:)
@id = id
end
end
end
let(:object) { class_with_noids.new(id: 1234) }
describe 'when noids are not enabled' do
be... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/collections_service_spec.rb | Ruby | apache-2.0 | 197 | main | 4,918 | # frozen_string_literal: true
RSpec.describe Hyrax::CollectionsService, :clean_repo do
let(:controller) { ::CatalogController.new }
let(:context) do
double(current_ability: Ability.new(user1),
repository: controller.blacklight_config.repository,
params: {},
blacklight_config: c... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/solr_query_builder_service_spec.rb | Ruby | apache-2.0 | 197 | main | 1,023 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Hyrax::SolrQueryBuilderService do
describe '.construct_query_for_ids' do
it "generates a useable solr query from an array of Fedora ids" do
expect(described_class.construct_query_for_ids(["my:_ID1_", "my:_ID2_", "my:_ID3_"])).to eq '{!terms... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/visibility_intention_spec.rb | Ruby | apache-2.0 | 197 | main | 4,898 | # frozen_string_literal: true
RSpec.describe Hyrax::VisibilityIntention do
subject(:intention) { described_class.new(**attributes) }
let(:attributes) { {} }
describe '#embargo_params' do
it 'is empty when no embargo is requested' do
expect(intention.embargo_params).to be_empty
end
context ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/contextual_path_spec.rb | Ruby | apache-2.0 | 197 | main | 694 | # frozen_string_literal: true
RSpec.describe Hyrax::ContextualPath, valkyrie_adapter: :test_adapter do
subject(:contextual_path) { described_class.new(object, parent) }
let(:object) { FactoryBot.valkyrie_create(:hyrax_file_set) }
let(:parent) { FactoryBot.valkyrie_create(:hyrax_work) }
describe '#show' do
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/flexible_schema_validator_service_spec.rb | Ruby | apache-2.0 | 197 | main | 5,439 | # frozen_string_literal: true
RSpec.describe Hyrax::FlexibleSchemaValidatorService, :clean_repo do
subject(:service) { described_class.new(profile: profile) }
let(:profile) { YAML.safe_load_file(yaml) }
let(:yaml) { Hyrax::Engine.root.join('spec', 'fixtures', 'files', 'm3_profile.yaml').to_s }
before do
a... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/visibility_reader_spec.rb | Ruby | apache-2.0 | 197 | main | 1,147 | # frozen_string_literal: true
RSpec.describe Hyrax::VisibilityReader do
subject(:reader) { described_class.new(resource: resource) }
let(:resource) { Hyrax::Resource.new }
let(:open) { Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC }
let(:auth) { Hydra::AccessControls::AccessRight::PERMISS... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/visibility_intention_applicator_spec.rb | Ruby | apache-2.0 | 197 | main | 2,474 | # frozen_string_literal: true
# NOTE: Leases and Embargoes have separate managers for Valkyrie objects.
RSpec.describe Hyrax::VisibilityIntentionApplicator, :active_fedora, :frozen_time do
subject(:applicator) { described_class.new(intention: intention) }
let(:work) { build(:work) }
let(:intention) do... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/solr_service_spec.rb | Ruby | apache-2.0 | 197 | main | 13,710 | # frozen_string_literal: true
RSpec.describe Hyrax::SolrService do
let(:mock_conn) { instance_double(RSolr::Client) }
let(:valkyrie_index) { double("valkyrie_index", connection: mock_conn) }
let(:use_valkyrie) { Hyrax.config.query_index_from_valkyrie }
before { allow(Hyrax).to receive(:index_adapter).and_retur... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/persist_derivatives_spec.rb | Ruby | apache-2.0 | 197 | main | 677 | # frozen_string_literal: true
RSpec.describe Hyrax::PersistDerivatives do
before do
allow(Hyrax.config).to receive(:derivatives_path).and_return('tmp')
end
describe '.output_file' do
subject { described_class.output_file(directives, &block) }
let(:directives) { { url: "file:/tmp/12/34/56/7-thumbnail... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/file_set_file_service_spec.rb | Ruby | apache-2.0 | 197 | main | 928 | # frozen_string_literal: true
RSpec.describe Hyrax::FileSetFileService do
subject(:service) { described_class.new(file_set: file_set) }
let(:file_set) { FactoryBot.valkyrie_create(:hyrax_file_set) }
describe "#primary_file" do
it "is nil when there are no files" do
expect(service.primary_file).to be_n... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/import_url_failure_service_spec.rb | Ruby | apache-2.0 | 197 | main | 714 | # frozen_string_literal: true
# NOTE: This class deals with accessing a FileSet's #errors attribute,
# which isn't a defined attribute in Valkyrie objects.
RSpec.describe Hyrax::ImportUrlFailureService, :active_fedora do
let!(:depositor) { create(:user) }
let(:inbox) { depositor.mailbox.inbox }
let(:file) do
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/derivative_path_spec.rb | Ruby | apache-2.0 | 197 | main | 1,796 | # frozen_string_literal: true
RSpec.describe Hyrax::DerivativePath do
let(:id) { '123' }
let(:object) { double(id: id) }
before { allow(Hyrax.config).to receive(:derivatives_path).and_return('tmp') }
context "for a single path" do
let(:destination_name) { 'thumbnail' }
describe '.derivative_path_... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/database_migrator_spec.rb | Ruby | apache-2.0 | 197 | main | 625 | # frozen_string_literal: true
RSpec.describe Hyrax::DatabaseMigrator do
describe '.copy' do
let(:mock_migrator) { double }
it 'creates an instance and calls #copy' do
expect(described_class).to receive(:new).once.and_return(mock_migrator)
expect(mock_migrator).to receive(:copy).once
describ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/schema_loader_spec.rb | Ruby | apache-2.0 | 197 | main | 3,089 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Hyrax::SchemaLoader do
subject(:schema_loader) { described_class.new }
describe '#definitions' do
it 'raises NotImplementedError' do
expect { schema_loader.send(:definitions, :some_schema, 1, nil) }
.to raise_error(NotImplement... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/iiif_authorization_service_spec.rb | Ruby | apache-2.0 | 197 | main | 1,269 | # frozen_string_literal: true
RSpec.describe Hyrax::IiifAuthorizationService do
let(:user) { create(:user) }
let(:ability) { Ability.new(user) }
let(:controller) { double(current_ability: ability) }
let(:service) { described_class.new(controller) }
let(:file_set_id) { 'mp48sc763' }
let(:image_id) { "#{file_... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/access_control_list_spec.rb | Ruby | apache-2.0 | 197 | main | 5,924 | # frozen_string_literal: true
require 'hyrax/specs/spy_listener'
RSpec.describe Hyrax::AccessControlList do
subject(:acl) do
described_class.new(resource: resource,
persister: persister,
query_service: query_service)
end
let(:permission) { FactoryBot.build... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/solr_query_service_spec.rb | Ruby | apache-2.0 | 197 | main | 11,333 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Hyrax::SolrQueryService, :clean_repo do
subject(:solr_query_service) { described_class.new(query: [initial_query]) }
let(:initial_query) { '_query_:"{!field f=subject_ssim:Science"' }
it do
is_expected.to respond_to :query
is_expected.to... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/resource_types_service_spec.rb | Ruby | apache-2.0 | 197 | main | 942 | # frozen_string_literal: true
RSpec.describe Hyrax::ResourceTypesService do
describe "select_options" do
subject { described_class.select_options }
it "has a select list" do
expect(subject.first).to eq ["Article", "Article"]
expect(subject.size).to eq 20
end
end
describe "label" do
s... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/repository_fixity_check_service_spec.rb | Ruby | apache-2.0 | 197 | main | 717 | # frozen_string_literal: true
# NOTE: This service is only optimized to process ActiveFedora objects.
RSpec.describe Hyrax::RepositoryFixityCheckService, :active_fedora do
let!(:file) do
create(:file_set).tap do |file|
file.add_file(File.open(fixture_path + '/world.png'), path: 'content', original_name: 'w... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/work_query_service_spec.rb | Ruby | apache-2.0 | 197 | main | 1,995 | # frozen_string_literal: true
module Hyrax
RSpec.describe WorkQueryService, :active_fedora do
let(:user) { create(:user) }
let(:work_id) { 'abc' }
let(:work_relation) { double('Work Relation') }
let(:work_query_service) { described_class.new(id: work_id, work_relation: work_relation) }
describe '... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/manifest_builder_service_spec.rb | Ruby | apache-2.0 | 197 | main | 2,517 | # frozen_string_literal: true
RSpec.describe Hyrax::ManifestBuilderService, :clean_repo do
# Presenters requires a whole lot of context and therefore a whole lot of preamble
let(:id) { "123" }
let(:title) { ["A Title"] }
let(:description) { ["A Treatise on Coding in Samvera"] }
let(:creator) { ["An Author"] ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/m3_schema_loader_spec.rb | Ruby | apache-2.0 | 197 | main | 11,959 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Hyrax::M3SchemaLoader do
subject(:schema_loader) { described_class.new }
let(:profile) { YAML.safe_load_file(Hyrax::Engine.root.join('spec', 'fixtures', 'files', 'm3_profile.yaml')) }
let(:schema) do
Hyrax::FlexibleSchema.create(
profi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/work_resource_query_service_spec.rb | Ruby | apache-2.0 | 197 | main | 1,239 | # frozen_string_literal: true
module Hyrax
RSpec.describe WorkResourceQueryService do
let(:user) { create(:user) }
let(:work) { FactoryBot.valkyrie_create(:monograph, title: ['Test work']) }
let(:work_query_service) { described_class.new(id: work.id) }
describe '#deleted_work?' do
subject { wor... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/rights_statement_service_spec.rb | Ruby | apache-2.0 | 197 | main | 398 | # frozen_string_literal: true
RSpec.describe Hyrax::RightsStatementService do
let(:service) { described_class.new }
describe "#select_active_options" do
it "returns active terms" do
expect(service.select_active_options).to include(["In Copyright", "http://rightsstatements.org/vocab/InC/1.0/"], ["No Known... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/location_service_spec.rb | Ruby | apache-2.0 | 197 | main | 1,293 | # frozen_string_literal: true
RSpec.describe Hyrax::LocationService do
let(:service) { described_class.new }
before do
stub_request(:get, 'http://www.geonames.org/getJSON')
.with(query: hash_including({ 'geonameId': '5037649' }))
.to_return(status: 200, body: File.open(File.join(fixture_path, 'geon... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/simple_schema_loader_spec.rb | Ruby | apache-2.0 | 197 | main | 5,660 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Hyrax::SimpleSchemaLoader do
subject(:schema_loader) { described_class.new }
describe '#attributes_for' do
it 'provides an attributes hash' do
expect(schema_loader.attributes_for(schema: :core_metadata))
.to include(title: Valky... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/collection_member_service_spec.rb | Ruby | apache-2.0 | 197 | main | 767 | # frozen_string_literal: true
RSpec.describe Hyrax::CollectionMemberService, :clean_repo do
let(:user) { FactoryBot.create(:user, groups: 'potato') }
let(:ability) { ::Ability.new(user) }
let(:col1) { FactoryBot.valkyrie_create(:hyrax_collection, user: user, with_index: true) }
let(:col2) { FactoryBot.valkyrie_... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/ensure_well_formed_admin_set_service_spec.rb | Ruby | apache-2.0 | 197 | main | 1,318 | # frozen_string_literal: true
RSpec.describe Hyrax::EnsureWellFormedAdminSetService do
let(:default_id) { Hyrax::AdminSetCreateService::DEFAULT_ID }
describe ".call" do
subject { described_class.call(admin_set_id: given_admin_set_id) }
context "with admin_set_id: nil" do
let(:given_admin_set_id) { nil... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/microdata_spec.rb | Ruby | apache-2.0 | 197 | main | 3,196 | # frozen_string_literal: true
module Hyrax
RSpec.describe Microdata do
let(:yml_path) { File.join(fixture_path, 'config', 'schema_org.yml') }
let(:yml_path_secondary) { File.join(fixture_path, 'config', 'schema_org_second.yml') }
before do
described_class.load_paths = yml_path
end
after do... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/child_types_spec.rb | Ruby | apache-2.0 | 197 | main | 924 | # frozen_string_literal: true
RSpec.describe Hyrax::ChildTypes do
subject(:child_types) { described_class.new(types) }
let(:types) { [GenericWork] }
describe '.for' do
let(:parent) { Hyrax::Test::SimpleWork }
it 'can have itself as a child by default' do
expect(described_class.for(paren... |
github | samvera/hyrax | https://github.com/samvera/hyrax | spec/services/hyrax/lock_manager_spec.rb | Ruby | apache-2.0 | 197 | main | 3,080 | # frozen_string_literal: true
RSpec.describe Hyrax::LockManager do
let(:ttl) { Hyrax.config.lock_time_to_live }
let(:retry_count) { Hyrax.config.lock_retry_count }
let(:retry_delay) { Hyrax.config.lock_retry_delay }
subject do
described_class.new(ttl, retry_count, retry_delay)
end
describe "lock", unl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.