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/helpers/hyrax/collections_helper_spec.rb
Ruby
apache-2.0
197
main
9,781
# frozen_string_literal: true RSpec.describe Hyrax::CollectionsHelper, :clean_repo do let(:user) { FactoryBot.create(:user, groups: ['admin']) } let(:ability) { Ability.new(user) } before do # Stub route because helper specs don't handle engine routes # https://github.com/rspec/rspec-rails/issues/1250 ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/batch_edits_helper_spec.rb
Ruby
apache-2.0
197
main
1,836
# frozen_string_literal: true RSpec.describe Hyrax::BatchEditsHelper, type: :helper do describe "#render_check_all" do subject { helper.render_check_all } before do view.lookup_context.prefixes = ['hyrax/my'] allow(helper).to receive(:params).and_return(controller: controller_path) end c...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/charts_helper_spec.rb
Ruby
apache-2.0
197
main
1,098
# frozen_string_literal: true RSpec.describe Hyrax::ChartsHelper do describe '#hash_to_chart' do subject { helper.hash_to_chart(data) } let(:data) do { 'Foo' => 5, 'Bar' => 10 } end it do is_expected.to eq( drilldown: { series: [] }, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/permission_levels_helper_spec.rb
Ruby
apache-2.0
197
main
2,935
# frozen_string_literal: true RSpec.describe Hyrax::PermissionLevelsHelper do before { @old_locale = I18n.locale } after { I18n.locale = @old_locale } # rubocop:disable RSpec/InstanceVariable describe '#configured_permission_levels' do it 'gives a hash with default values' do expect(configured_permiss...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/workflows_helper_spec.rb
Ruby
apache-2.0
197
main
1,747
# frozen_string_literal: true RSpec.describe Hyrax::WorkflowsHelper do describe "#workflow_restriction?" do let(:ability) { double } before { allow(controller).to receive(:current_ability).and_return(ability) } subject { helper.workflow_restriction?(object) } describe "when given nil" do let(:o...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/file_set_helper_spec.rb
Ruby
apache-2.0
197
main
3,284
# frozen_string_literal: true RSpec.describe Hyrax::FileSetHelper do describe '#display_media_download_link?' do let(:ability) { double(Ability) } let(:file_set) { valkyrie_create(:hyrax_file_set) } before do allow(controller).to receive(:current_ability).and_return(ability) end it 'does ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/embargo_helper_spec.rb
Ruby
apache-2.0
197
main
6,111
# frozen_string_literal: true RSpec.describe Hyrax::EmbargoHelper do let(:resource) { build(:monograph) } describe 'embargo_enforced?' do # Including this stub to preserve the spec structure before the #4845 change before { allow(resource).to receive(:persisted?).and_return(true) } context 'with a no...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/content_block_helper_spec.rb
Ruby
apache-2.0
197
main
1,216
# frozen_string_literal: true RSpec.describe Hyrax::ContentBlockHelper, type: :helper do let(:content_block) { create(:content_block, value: "<p>foo bar</p>") } describe '#displayable_content_block' do let(:options) { {} } subject { helper.displayable_content_block(content_block, **options) } it 'is ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/contact_form_helper_spec.rb
Ruby
apache-2.0
197
main
281
# frozen_string_literal: true RSpec.describe Hyrax::ContactFormHelper, type: :helper do describe '#contact_form_issue_type_options' do it 'has string options' do expect(helper.contact_form_issue_type_options[1..-1]).to all(be_an_instance_of(String)) end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/work_form_helper_spec.rb
Ruby
apache-2.0
197
main
5,124
# frozen_string_literal: true require 'hyrax/specs/shared_specs' RSpec.describe Hyrax::WorkFormHelper do describe '.form_tabs_for' do context 'with a change set style form' do let(:work) { build(:hyrax_work) } let(:form) { Hyrax::Forms::ResourceForm.for(resource: work) } it 'returns a default...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/lease_helper_spec.rb
Ruby
apache-2.0
197
main
6,056
# frozen_string_literal: true RSpec.describe Hyrax::LeaseHelper do let(:resource) { FactoryBot.build(:monograph) } describe 'lease_enforced?' do # Including this stub to preserve the spec structure before the #4845 change before { allow(resource).to receive(:persisted?).and_return(true) } context 'wi...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/membership_helper_spec.rb
Ruby
apache-2.0
197
main
4,664
# frozen_string_literal: true RSpec.describe Hyrax::MembershipHelper do before { helper.class.include Hyrax::Engine.routes.url_helpers } describe '.member_of_collections_json' do context 'with a ChangeSet form' do let(:resource) { Hyrax::Forms::ResourceForm.for(resource: work) } let(:work) { build...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/blacklight_override_helper_spec.rb
Ruby
apache-2.0
197
main
2,255
# frozen_string_literal: true require 'rails_helper' RSpec.describe Hyrax::BlacklightOverride, type: :helper do include Hyrax::BlacklightOverride let(:document) { instance_double(SolrDocument, to_h: {}) } def index_fields(_document) { 'subject_tesim' => field_config } end describe '#index_field_label...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/iiif_helper_spec.rb
Ruby
apache-2.0
197
main
2,397
# frozen_string_literal: true RSpec.describe Hyrax::IiifHelper, type: :helper do let(:solr_document) { SolrDocument.new } let(:request) { double } let(:ability) { nil } let(:presenter) { Hyrax::WorkShowPresenter.new(solr_document, ability, request) } let(:uv_partial_path) { 'hyrax/base/iiif_viewers/universal_...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/trophy_helper_spec.rb
Ruby
apache-2.0
197
main
1,778
# frozen_string_literal: true RSpec.describe Hyrax::TrophyHelper, type: :helper do describe "#display_trophy_link" do let(:user) { create(:user) } let(:id) { '9999' } let(:text_attributes) { '[data-add-text="Highlight work on profile"][data-remove-text="Unhighlight work"]' } let(:url_attribute) { "[d...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/ability_helper_spec.rb
Ruby
apache-2.0
197
main
2,234
# frozen_string_literal: true RSpec.describe Hyrax::AbilityHelper do describe "#visibility_badge" do subject { helper.visibility_badge visibility } { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC => "<span class=\"badge badge-success\">Public</span>", Hydra::AccessContr...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/citations_behaviors/formatters/chicago_formatter_spec.rb
Ruby
apache-2.0
197
main
636
# frozen_string_literal: true RSpec.describe Hyrax::CitationsBehaviors::Formatters::ChicagoFormatter do subject(:formatter) { described_class.new(:no_context) } let(:solr_document) do if work.is_a? ActiveFedora::Base SolrDocument.new(work.to_solr) else SolrDocument.new(GenericWorkIndexer.new(re...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/helpers/hyrax/citations_behaviors/formatters/apa_formatter_spec.rb
Ruby
apache-2.0
197
main
651
# frozen_string_literal: true RSpec.describe Hyrax::CitationsBehaviors::Formatters::ApaFormatter do subject(:formatter) { described_class.new(:no_context) } let(:solr_document) do if work.is_a? ActiveFedora::Base SolrDocument.new(work.to_solr) else SolrDocument.new(GenericWorkIndexer.new(resour...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/valkyrie/indexing_adapter_spec.rb
Ruby
apache-2.0
197
main
628
# frozen_string_literal: true require 'valkyrie/indexing_adapter' RSpec.describe Valkyrie::IndexingAdapter do let(:adapter) do Class.new { ; } end describe ".register" do it "registers an adapter to a short name" do described_class.register adapter, :test_adapter expect(described_class.find...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/valkyrie/indexing/redis_queue/indexing_adapter_spec.rb
Ruby
apache-2.0
197
main
5,011
# frozen_string_literal: true require 'rails_helper' require 'valkyrie/indexing/redis_queue/indexing_adapter' RSpec.describe Valkyrie::Indexing::RedisQueue::IndexingAdapter, :frozen_time do let(:connection) { instance_double(Redis) } let(:index_queue_name) { 'toindex' } let(:delete_queue_name) { 'todelete' } l...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/valkyrie/indexing/solr/indexing_adapter_spec.rb
Ruby
apache-2.0
197
main
1,563
# frozen_string_literal: true require 'spec_helper' require 'valkyrie/indexing/solr/indexing_adapter' RSpec.describe Valkyrie::Indexing::Solr::IndexingAdapter, :clean_index, index_adapter: :solr_index do subject(:adapter) { Valkyrie::IndexingAdapter.find(:solr_index) } let(:resource) { FactoryBot.valkyrie_create(:...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/transfers_presenter_spec.rb
Ruby
apache-2.0
197
main
2,274
# frozen_string_literal: true RSpec.describe Hyrax::TransfersPresenter do let(:context) { ActionView::TestCase::TestController.new.view_context } let(:user) { create(:user) } let(:another_user) { create(:user) } let(:instance) { described_class.new(user, context) } describe "#incoming_proxy_deposits" do ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/file_usage_spec.rb
Ruby
apache-2.0
197
main
5,148
# frozen_string_literal: true # NOTE: This presenter is currently utilizing multiple classes that are solely focused on ActiveFedora objects and classes. # This class, as well as others involving Statistics and Analytics should be Valkyrized in the future. RSpec.describe Hyrax::FileUsage, type: :model do let(:user)...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/presenter_factory_spec.rb
Ruby
apache-2.0
197
main
1,556
# frozen_string_literal: true RSpec.describe Hyrax::PresenterFactory do describe "#build_for" do let(:presenter_class) { Hyrax::FileSetPresenter } before do allow(Hyrax::SolrService).to receive(:post) .with("{!terms f=id}12,13", rows: 1000) .and_return('response' => { 'docs' => results ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/file_set_presenter_spec.rb
Ruby
apache-2.0
197
main
18,152
# frozen_string_literal: true require 'iiif_manifest' RSpec.describe Hyrax::FileSetPresenter do subject(:presenter) { described_class.new(solr_document, ability) } let(:solr_document) { SolrDocument.new(attributes) } let(:ability) { Ability.new(user) } let(:attributes) { Hyrax::ValkyrieIndexer.for(resource: fi...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/page_title_decorator_spec.rb
Ruby
apache-2.0
197
main
885
# frozen_string_literal: true RSpec.describe Hyrax::PageTitleDecorator do subject(:decorated) { described_class.new(work) } let(:work) { build(:hyrax_work) } describe '#title' do it 'returns "No Title"' do expect(decorated.title).to eq 'No Title' end context 'with a title' do let(:work)...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/embargo_presenter_spec.rb
Ruby
apache-2.0
197
main
1,661
# frozen_string_literal: true RSpec.describe Hyrax::EmbargoPresenter do subject(:presenter) { described_class.new(document) } let(:document) { SolrDocument.new(attributes) } let(:attributes) { {} } describe "#visibility" do subject { presenter.visibility } it { is_expected.to eq 'restricted' } end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/twitter_presenter_spec.rb
Ruby
apache-2.0
197
main
972
# frozen_string_literal: true module Hyrax RSpec.describe TwitterPresenter do describe '.twitter_handle_for' do let(:user_key) { 'user_key' } subject { described_class.twitter_handle_for(user_key: user_key) } context "with a found user that has a twitter handle" do before { allow(::Use...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/select_collection_type_list_presenter_spec.rb
Ruby
apache-2.0
197
main
1,787
# frozen_string_literal: true RSpec.describe Hyrax::SelectCollectionTypeListPresenter, :clean_repo do let(:user) { create(:user) } let(:instance) { described_class.new(user) } let(:collection_type) { create(:collection_type, creator_user: user) } let(:user_collection_type) { create(:user_collection_type) } d...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/permission_badge_spec.rb
Ruby
apache-2.0
197
main
2,849
# frozen_string_literal: true RSpec.describe Hyrax::PermissionBadge do context "with a SolrDocument" do let(:badge) { described_class.new(solr_doc.visibility) } let(:solr_doc) { SolrDocument.new(attributes) } let(:attributes) { {} } describe "#render" do subject { badge.render } context ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/collection_presenter_spec.rb
Ruby
apache-2.0
197
main
12,915
# frozen_string_literal: true RSpec.describe Hyrax::CollectionPresenter do subject(:presenter) { described_class.new(solr_doc, ability) } let(:collection) do build(:hyrax_collection, id: 'adc12v', title: ['A clever title']) end let(:ability) { double(::Ability) } let(:solr_doc) { SolrD...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/inspect_work_presenter_spec.rb
Ruby
apache-2.0
197
main
2,353
# frozen_string_literal: true RSpec.describe Hyrax::InspectWorkPresenter do let(:solr_document) { SolrDocument.new(attributes) } let(:attributes) do { "id" => '888888', "has_model_ssim" => ["GenericWork"] } end let(:user) { create(:user) } let(:ability) { Ability.new(user) } let(:presenter) { des...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/model_proxy_spec.rb
Ruby
apache-2.0
197
main
1,516
# frozen_string_literal: true RSpec.describe Hyrax::ModelProxy do subject(:proxy) { proxy_class.new(solr_document) } let(:solr_document) { SolrDocument.new(attributes) } let(:model) { GenericWork } let(:attributes) do { "id" => '888888', "has_model_ssim" => [model.to_s] } end let(:p...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/fixity_status_presenter_spec.rb
Ruby
apache-2.0
197
main
2,745
# frozen_string_literal: true RSpec.describe Hyrax::FixityStatusPresenter do let(:file_set_id) { "xw42n7888" } let(:file_ids) do [ "#{file_set_id}/files/3ec4c460-db36-49d4-914c-2d2036b0bfc6", "#{file_set_id}/files/c3e8d90c-e47b-4c3b-9cff-50d20b5b0583" ] end let(:presenter) { described_class....
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/select_type_presenter_spec.rb
Ruby
apache-2.0
197
main
2,652
# frozen_string_literal: true RSpec.describe Hyrax::SelectTypePresenter do let(:instance) { described_class.new(model) } let(:model) { GenericWork } describe "#icon_class" do subject { instance.icon_class } # Koppie's associated locales are unset, so should default let(:expected_classes) { Hyrax.conf...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/single_use_link_presenter_spec.rb
Ruby
apache-2.0
197
main
1,382
# frozen_string_literal: true RSpec.describe Hyrax::SingleUseLinkPresenter do subject { described_class.new(link) } context "with any kind of link" do let(:link) { create(:download_link) } describe "#human_readable_expiration" do context "in more than one hour" do its(:human_readable_expirat...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/member_presenter_factory_spec.rb
Ruby
apache-2.0
197
main
2,033
# frozen_string_literal: true # NOTE: Valkyrie has it's own factory (Hyrax::PcdmMemberPresenterFactory). # This is the legacy ActiveFedora factory. RSpec.describe Hyrax::MemberPresenterFactory, :active_fedora do subject(:factory) { described_class.new(solr_document, ability, request) } let(:solr_document) { Sol...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/user_profile_presenter_spec.rb
Ruby
apache-2.0
197
main
1,165
# frozen_string_literal: true RSpec.describe Hyrax::UserProfilePresenter do subject(:presenter) { described_class.new(user, ability) } let(:ability) { Ability.new(user) } let(:user) { FactoryBot.create(:user) } its(:current_user?) { is_expected.to be true } describe "#trophies" do let(:wo...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/workflow_presenter_spec.rb
Ruby
apache-2.0
197
main
2,497
# frozen_string_literal: true RSpec.describe Hyrax::WorkflowPresenter do let(:solr_document) { SolrDocument.new(attributes) } let(:attributes) do { "id" => '888888', "has_model_ssim" => ["GenericWork"] } end let(:user) { create(:user) } let(:ability) { Ability.new(user) } let(:presenter) { descri...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/google_scholar_presenter_spec.rb
Ruby
apache-2.0
197
main
4,203
# frozen_string_literal: true RSpec.describe Hyrax::GoogleScholarPresenter do subject(:presenter) { described_class.new(work) } let(:work) { FactoryBot.build(:monograph, title: 'On Moomins') } describe '#scholarly?' do it { is_expected.to be_scholarly } context 'when the decorated object says it is not...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/iiif_manifest_presenter_spec.rb
Ruby
apache-2.0
197
main
20,240
# frozen_string_literal: true RSpec.describe Hyrax::IiifManifestPresenter, :clean_repo do subject(:presenter) { described_class.new(work) } let(:work) { build(:monograph) } let(:file_path) { fixture_path + '/world.png' } let(:original_file) { File.open(file_path) } let(:uploaded_file) { FactoryBot.create(:up...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/homepage_presenter_spec.rb
Ruby
apache-2.0
197
main
1,459
# frozen_string_literal: true RSpec.describe Hyrax::HomepagePresenter do let(:presenter) { described_class.new(ability, collections) } let(:ability) { Ability.new(user) } let(:collections) { double } let(:user) { build(:user) } describe "#collections" do subject { presenter.collections } it { is_exp...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/select_type_list_presenter_spec.rb
Ruby
apache-2.0
197
main
947
# frozen_string_literal: true # Note: test app generates multiple work types (concerns) now RSpec.describe Hyrax::SelectTypeListPresenter do let(:instance) { described_class.new(user) } let(:user) { nil } describe "#many?" do subject { instance.many? } context 'without a logged in user' do it { is...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin_set_presenter_spec.rb
Ruby
apache-2.0
197
main
5,442
# frozen_string_literal: true RSpec.describe Hyrax::AdminSetPresenter, :clean_repo do let(:admin_set) do mock_model('MockAdminSet', id: '123', description: ['An example admin set.'], title: ['Example Admin Set Title']) end let(:work) { build(:hyrax_work, title: ['...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin_stats_presenter_spec.rb
Ruby
apache-2.0
197
main
4,725
# frozen_string_literal: true RSpec.describe Hyrax::AdminStatsPresenter do let(:user1) { create(:user) } let(:user2) { create(:user) } let(:one_day_ago_date) { Time.zone.now - 1.day } let(:two_days_ago_date) { Time.zone.now - 2.days } let(:start_date) { '' } let(:end_date) { '' } let(:filters) { { star...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin_set_selection_presenter_spec.rb
Ruby
apache-2.0
197
main
2,390
# frozen_string_literal: true RSpec.describe Hyrax::AdminSetSelectionPresenter do subject(:presenter) { described_class.new(admin_sets: admin_sets) } let(:admin_sets) do [FactoryBot.valkyrie_create(:hyrax_admin_set, title: 'first'), FactoryBot.valkyrie_create(:hyrax_admin_set, title: 'second'), Fact...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/select_collection_type_presenter_spec.rb
Ruby
apache-2.0
197
main
479
# frozen_string_literal: true RSpec.describe Hyrax::SelectCollectionTypePresenter do subject { described_class.new(collection_type) } let(:collection_type) { create(:collection_type) } it { is_expected.to delegate_method(:title).to(:collection_type) } it { is_expected.to delegate_method(:description).to(:coll...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/version_presenter_spec.rb
Ruby
apache-2.0
197
main
3,166
# frozen_string_literal: true RSpec.describe Hyrax::VersionPresenter do # VERSIONING-TODO: Add Valkyrie specs here. context "for ActiveFedora", :active_fedora do let(:resource_version) do ActiveFedora::VersionsGraph::ResourceVersion.new.tap do |v| v.uri = 'http://example.com/version1' v.la...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/menu_presenter_spec.rb
Ruby
apache-2.0
197
main
3,325
# frozen_string_literal: true RSpec.describe Hyrax::MenuPresenter do let(:instance) { described_class.new(context) } let(:context) { ActionView::TestCase::TestController.new.view_context } let(:controller_name) { controller.controller_name } describe "#settings_section?" do before do allow(context).t...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/version_list_presenter_spec.rb
Ruby
apache-2.0
197
main
4,156
# frozen_string_literal: true RSpec.describe Hyrax::VersionListPresenter do context "for active fedora", :active_fedora do let(:file_set) { FactoryBot.create(:file_set) } subject(:enum) { described_class.for(file_set: file_set) } context "when the file set has no versions" do describe ".for" do ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/lease_presenter_spec.rb
Ruby
apache-2.0
197
main
1,642
# frozen_string_literal: true RSpec.describe Hyrax::LeasePresenter do subject(:presenter) { described_class.new(document) } let(:document) { SolrDocument.new(attributes) } let(:attributes) { {} } describe "#visibility" do subject { presenter.visibility } it { is_expected.to eq 'restricted' } end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/presenter_renderer_spec.rb
Ruby
apache-2.0
197
main
1,219
# frozen_string_literal: true RSpec.describe Hyrax::PresenterRenderer, type: :view do let(:ability) { double } let(:document) { SolrDocument.new(data) } let(:data) do { id: '123', date_created_tesim: 'foo', date_uploaded_tesim: 'bar', has_model_ssim: 'GenericWork' } end let(:presenter) { Hyrax::WorkShowPr...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/trophy_presenter_spec.rb
Ruby
apache-2.0
197
main
1,605
# frozen_string_literal: true RSpec.describe Hyrax::TrophyPresenter do subject(:presenter) { described_class.new(solr_document) } let(:solr_document) do SolrDocument.new(id: '123456', has_model_ssim: 'GenericWork', title_tesim: ['A Title'], thumbn...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/work_show_presenter_spec.rb
Ruby
apache-2.0
197
main
23,849
# frozen_string_literal: true require 'hyrax/specs/shared_specs' RSpec.describe Hyrax::WorkShowPresenter do subject(:presenter) { described_class.new(solr_document, ability, request) } let(:ability) { double Ability } let(:solr_document) { SolrDocument.new(attributes) } let(:request) { double(host: 'example.o...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin_set_options_presenter_spec.rb
Ruby
apache-2.0
197
main
4,717
# frozen_string_literal: true RSpec.describe Hyrax::AdminSetOptionsPresenter do let(:service) { instance_double(Hyrax::AdminSetService) } let(:current_ability) { double('an abilitiy', can?: false) } let(:presenter) { described_class.new(service, current_ability: current_ability) } describe "#select_options" do...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/pcdm_member_presenter_factory_spec.rb
Ruby
apache-2.0
197
main
6,549
# frozen_string_literal: true RSpec.describe Hyrax::PcdmMemberPresenterFactory do subject(:factory) { described_class.new(solr_doc, ability) } let(:ability) { :FAKE_ABILITY } let(:ids) { [] } let(:solr_doc) { SolrDocument.new(member_ids_ssim: ids) } RSpec::Matchers.define :be_presenter_for do...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/work_usage_spec.rb
Ruby
apache-2.0
197
main
4,223
# frozen_string_literal: true RSpec.describe Hyrax::WorkUsage, type: :model do let!(:work) { valkyrie_create(:monograph, date_uploaded: date_uploaded) } let(:date_uploaded) { Hyrax::TimeService.time_in_utc - 4.days } let(:dates) do ldates = [] 4.downto(0) { |idx| ldates << (Time.zone.today - idx.day) } ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin/users_presenter_spec.rb
Ruby
apache-2.0
197
main
1,442
# frozen_string_literal: true RSpec.describe Hyrax::Admin::UsersPresenter do let(:instance) { described_class.new } let!(:user) { create(:user) } let!(:admin_user) { create(:user, groups: 'admin') } let!(:system_user) { User.system_user } let!(:audit_user) { User.audit_user } let!(:batch_user) { User.batch_...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin/repository_object_presenter_spec.rb
Ruby
apache-2.0
197
main
743
# frozen_string_literal: true RSpec.describe Hyrax::Admin::RepositoryObjectPresenter do let(:instance) { described_class.new } describe "#as_json" do subject { instance.as_json } let(:response) { Blacklight::Solr::Response.new(solr_data, {}) } let(:solr_data) do { "facet_counts" => { "fa...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin/workflow_roles_presenter_spec.rb
Ruby
apache-2.0
197
main
357
# frozen_string_literal: true RSpec.describe Hyrax::Admin::WorkflowRolesPresenter do let(:presenter) { described_class.new } describe "#users" do subject { presenter.users } let!(:user) { create(:user) } before do create(:user, :guest) end it "doesn't include guests" do expect(sub...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin/dashboard_presenter_spec.rb
Ruby
apache-2.0
197
main
934
# frozen_string_literal: true RSpec.describe Hyrax::Admin::DashboardPresenter do let(:instance) { described_class.new } let(:start_date) { 2.days.ago } let(:end_date) { Time.zone.now } describe "#user_count" do before do create(:user) create(:user) create(:user, :guest) end subje...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin/user_activity_presenter_spec.rb
Ruby
apache-2.0
197
main
668
# frozen_string_literal: true RSpec.describe Hyrax::Admin::UserActivityPresenter do let(:start_date) { Time.zone.today - 6.days } let(:end_date) { Time.zone.today } let(:instance) { described_class.new(start_date, end_date) } describe "#to_json" do subject { instance.to_json } let(:users) do ins...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin/workflow_role_presenter_spec.rb
Ruby
apache-2.0
197
main
411
# frozen_string_literal: true RSpec.describe Hyrax::Admin::WorkflowRolePresenter do let(:presenter) { described_class.new(workflow_role) } let(:role) { Sipity::Role[:depositor] } let(:workflow) { create(:workflow) } let(:workflow_role) { Sipity::WorkflowRole.new(role: role, workflow: workflow) } describe '#l...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
Ruby
apache-2.0
197
main
910
# frozen_string_literal: true RSpec.describe Hyrax::Admin::RepositoryGrowthPresenter do let(:start_date) { 2.days.ago } let(:end_date) { Time.zone.now } let(:instance) { described_class.new(start_date, end_date) } describe "#to_json" do subject { instance.to_json } let(:works) do instance_double...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/presenters/hyrax/dashboard/user_presenter_spec.rb
Ruby
apache-2.0
197
main
1,749
# frozen_string_literal: true RSpec.describe Hyrax::Dashboard::UserPresenter do let(:since) { nil } let(:context) { ActionView::TestCase::TestController.new.view_context } let(:user) { create(:user) } let(:instance) { described_class.new(user, context, since) } describe "#activity" do subject { instance....
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/embargo_search_builder_spec.rb
Ruby
apache-2.0
197
main
536
# frozen_string_literal: true RSpec.describe Hyrax::EmbargoSearchBuilder do let(:context) { FakeSearchBuilderScope.new } let(:search_builder) { described_class.new(context) } describe "#processor_chain" do subject { search_builder.processor_chain } it { is_expected.to eq [:with_pagination, :with_sorting...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/abstract_type_relation_spec.rb
Ruby
apache-2.0
197
main
806
# frozen_string_literal: true RSpec.describe Hyrax::AbstractTypeRelation, :clean_repo do before do stub_const 'AnotherWork', Class.new end it 'returns nil when no allowable types exist' do allow(subject).to receive(:allowable_types).and_return([]) expect(subject.search_model_clause).to be_nil end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/single_admin_set_search_builder_spec.rb
Ruby
apache-2.0
197
main
697
# frozen_string_literal: true RSpec.describe Hyrax::SingleAdminSetSearchBuilder do let(:ability) { instance_double(Ability, admin?: true) } let(:context) do double(blacklight_config: CatalogController.blacklight_config, current_ability: ability, search_state_class: nil) end let(:builde...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/works_search_builder_spec.rb
Ruby
apache-2.0
197
main
212
# frozen_string_literal: true RSpec.describe Hyrax::WorksSearchBuilder do describe "::default_processor_chain" do it { expect(described_class.default_processor_chain).to end_with :filter_models } end end
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/file_set_search_builder_spec.rb
Ruby
apache-2.0
197
main
855
# frozen_string_literal: true RSpec.describe Hyrax::FileSetSearchBuilder do let(:processor_chain) { [:filter_models] } let(:ability) { double('ability') } let(:context) { FakeSearchBuilderScope.new } let(:user) { double('user') } let(:solr_params) { Blacklight::Solr::Request.new({ fq: [] }) } subject { des...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/collection_search_builder_spec.rb
Ruby
apache-2.0
197
main
2,840
# frozen_string_literal: true RSpec.describe Hyrax::CollectionSearchBuilder do subject(:builder) { described_class.new(scope).with_access(access) } let(:access) { :read } let(:user) { FactoryBot.create(:user) } let(:scope) { FakeSearchBuilderScope.new(current_user: user) } describe '#sort_field' do its(:...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/admin_set_search_builder_spec.rb
Ruby
apache-2.0
197
main
2,587
# frozen_string_literal: true RSpec.describe Hyrax::AdminSetSearchBuilder do let(:context) do double(blacklight_config: CatalogController.blacklight_config, current_ability: ability, search_state_class: nil) end let(:ability) do ::Ability.new(user) end let(:user) { create(:user) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/work_relation_spec.rb
Ruby
apache-2.0
197
main
689
# frozen_string_literal: true # NOTE: This is an ActiveFedora query service that is currently being used # in the following classes/modules: # Hyrax::SingularSubresourceController, Hyrax::WorkUsage, Hyrax::UserStatImporter, # Hyrax::WorkQueryService, Hyrax::Statistics::QueryService, Hyrax::Statistics::Works::Ove...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/catalog_search_builder_spec.rb
Ruby
apache-2.0
197
main
3,154
# frozen_string_literal: true RSpec.describe Hyrax::CatalogSearchBuilder do let(:context) { FakeSearchBuilderScope.new } let(:builder) { described_class.new(context).with(blacklight_params) } let(:solr_params) { Blacklight::Solr::Request.new } let(:blacklight_params) { { q: user_query, search_field: 'all_fields...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/lease_search_builder_spec.rb
Ruby
apache-2.0
197
main
532
# frozen_string_literal: true RSpec.describe Hyrax::LeaseSearchBuilder do let(:context) { FakeSearchBuilderScope.new } let(:search_builder) { described_class.new(context) } describe "#processor_chain" do subject { search_builder.processor_chain } it { is_expected.to eq [:with_pagination, :with_sorting, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/collection_member_search_builder_spec.rb
Ruby
apache-2.0
197
main
2,370
# frozen_string_literal: true RSpec.describe Hyrax::CollectionMemberSearchBuilder do subject(:builder) { described_class.new(scope: context, collection: collection, search_includes_models: include_models) } let(:context) { double("context", blacklight_config: CatalogController.blacklight_config, search_state_class:...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/single_collection_search_builder_spec.rb
Ruby
apache-2.0
197
main
1,802
# frozen_string_literal: true RSpec.describe Hyrax::SingleCollectionSearchBuilder do subject(:builder) { described_class.new(scope) } let(:scope) { FakeSearchBuilderScope.new } shared_context 'with search params' do let(:params) { { id: 'a_collection_id' } } before { builder.with(params) } end des...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/admin_admin_set_member_search_builder_spec.rb
Ruby
apache-2.0
197
main
1,410
# frozen_string_literal: true RSpec.describe Hyrax::AdminAdminSetMemberSearchBuilder do subject(:builder) { described_class.new(scope: scope, collection: admin_set) } let(:ability) { Ability.new(user) } let(:admin_set) { :FAKE_ADMIN_SET } let(:scope) { FakeSearchBuilderScope.new(current_ability: ability) } le...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/work_search_builder_spec.rb
Ruby
apache-2.0
197
main
3,943
# frozen_string_literal: true RSpec.describe Hyrax::WorkSearchBuilder do let(:me) { FactoryBot.create(:user) } let(:scope) { FakeSearchBuilderScope.new(current_user: me) } let(:builder) { described_class.new(scope).with(params) } let(:params) { { id: '123abc' } } before do allow(builder).to receive(:gate...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/parent_collection_search_builder_spec.rb
Ruby
apache-2.0
197
main
618
# frozen_string_literal: true RSpec.describe Hyrax::ParentCollectionSearchBuilder do let(:solr_params) { { fq: [] } } let(:item) { double(id: '12345', member_of_collection_ids: ['col1']) } let(:builder) { described_class.new(solr_params, context) } let(:context) { double("context", blacklight_config: CatalogCon...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/my/works_search_builder_spec.rb
Ruby
apache-2.0
197
main
806
# frozen_string_literal: true RSpec.describe Hyrax::My::WorksSearchBuilder do subject(:builder) { described_class.new(scope) } let(:me) { FactoryBot.create(:user) } let(:scope) { FakeSearchBuilderScope.new(current_user: me) } describe "#to_hash" do before do allow(ActiveFedora::SolrQueryBuilder).to r...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/my/find_works_search_builder_spec.rb
Ruby
apache-2.0
197
main
2,148
# frozen_string_literal: true RSpec.describe Hyrax::My::FindWorksSearchBuilder do let(:controller) { Qa::TermsController.new } let(:user) { create(:user) } let(:ability) { instance_double(Ability, admin?: false, user_groups: [], current_user: user) } let(:q) { "foo" } let(:params) { ActionController::Paramete...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/my/shares_search_builder_spec.rb
Ruby
apache-2.0
197
main
686
# frozen_string_literal: true RSpec.describe Hyrax::My::SharesSearchBuilder do subject(:builder) { described_class.new(scope) } let(:me) { FactoryBot.create(:user) } let(:scope) { FakeSearchBuilderScope.new(current_user: me) } before do allow(ActiveFedora::SolrQueryBuilder).to receive(:construct_query_for_...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/my/collections_search_builder_spec.rb
Ruby
apache-2.0
197
main
1,515
# frozen_string_literal: true RSpec.describe Hyrax::My::CollectionsSearchBuilder do let(:context) do double(blacklight_config: CatalogController.blacklight_config, current_ability: ability, current_user: user, search_state_class: nil) end let(:ability) do ::Ability.new(use...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/stats/work_status_search_builder_spec.rb
Ruby
apache-2.0
197
main
854
# frozen_string_literal: true RSpec.describe Hyrax::Stats::WorkStatusSearchBuilder do subject(:instance) { described_class.new(context) } let(:context) do double(blacklight_config: CatalogController.blacklight_config, current_ability: ability, search_state_class: nil) end let(:abilit...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/dashboard/works_search_builder_spec.rb
Ruby
apache-2.0
197
main
3,805
# frozen_string_literal: true RSpec.describe Hyrax::Dashboard::WorksSearchBuilder do let(:context) do double(blacklight_config: CatalogController.blacklight_config, current_ability: ability, current_user: user, search_state_class: nil) end let(:ability) do ::Ability.new(us...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/dashboard/nested_collections_search_builder_spec.rb
Ruby
apache-2.0
197
main
4,791
# frozen_string_literal: true RSpec.describe Hyrax::Dashboard::NestedCollectionsSearchBuilder do let(:scope) { double(current_ability: ability, blacklight_config: CatalogController.blacklight_config, search_state_class: nil) } let(:access) { :read } let(:user) { create(:user) } let(:ability) { ::Ability.new(use...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/search_builders/hyrax/dashboard/collections_search_builder_spec.rb
Ruby
apache-2.0
197
main
4,340
# frozen_string_literal: true RSpec.describe Hyrax::Dashboard::CollectionsSearchBuilder do let(:context) do double(blacklight_config: CatalogController.blacklight_config, current_ability: ability, current_user: user, search_state_class: nil) end let(:ability) do ::Ability....
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/authorities/qa/authorities/find_works_spec.rb
Ruby
apache-2.0
197
main
2,449
# frozen_string_literal: true RSpec.describe Qa::Authorities::FindWorks, :clean_repo do let(:controller) { Qa::TermsController.new } let(:user1) { create(:user) } let(:user2) { create(:user) } let(:ability) { instance_double(Ability, admin?: false, user_groups: [], current_user: user1) } let(:q) { "foo" } l...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/authorities/qa/authorities/collections_spec.rb
Ruby
apache-2.0
197
main
4,841
# frozen_string_literal: true # @todo FactoryBot.build seems to be used to force indexing. # this can probably be refactored to just index the content we want the # authority service to find and avoid DB round trips associated with # `with_permission_template`,etc... RSpec.describe Qa::Authorities::Collections, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/batch_create_job_spec.rb
Ruby
apache-2.0
197
main
4,577
# frozen_string_literal: true RSpec.describe BatchCreateJob do let(:user) { create(:user) } let(:operation) { create(:batch_create_operation, user: user) } let(:child_operation) { double } describe "#perform" do let(:file1) { File.open(fixture_path + '/world.png') } let(:file2) { File.open(fixture_path...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/stream_notifications_job_spec.rb
Ruby
apache-2.0
197
main
1,332
# frozen_string_literal: true RSpec.describe StreamNotificationsJob do let(:realtime_notifications) { true } before do allow(Hyrax.config).to receive(:realtime_notifications?).and_return(realtime_notifications) end describe '#perform' do context 'with zero users' do let(:users) { nil } it...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/valkyrie_create_derivatives_job_spec.rb
Ruby
apache-2.0
197
main
2,333
# frozen_string_literal: true require 'hyrax/specs/spy_listener' RSpec.describe ValkyrieCreateDerivativesJob, perform_enqueued: true do # Create a work with two files, the first will be the work's thumbnail let(:work) { FactoryBot.valkyrie_create(:hyrax_work, :with_member_file_sets, :with_thumbnail) } let(:uplo...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/create_derivatives_job_spec.rb
Ruby
apache-2.0
197
main
4,279
# frozen_string_literal: true RSpec.describe CreateDerivativesJob, :active_fedora do around do |example| ffmpeg_enabled = Hyrax.config.enable_ffmpeg Hyrax.config.enable_ffmpeg = true example.run Hyrax.config.enable_ffmpeg = ffmpeg_enabled end context "filepath parameter" do let(:file_set) { c...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/iiif_manifest_cache_prewarm_job_spec.rb
Ruby
apache-2.0
197
main
538
# frozen_string_literal: true RSpec.describe IiifManifestCachePrewarmJob do let(:work) { valkyrie_create(:monograph, :with_member_file_sets) } let(:cache_key) do Hyrax::CachingIiifManifestBuilder .new .send(:manifest_cache_key, presenter: Hyrax::IiifManifestPresenter.new(work)) end describe '....
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/change_depositor_event_job_spec.rb
Ruby
apache-2.0
197
main
2,405
# frozen_string_literal: true RSpec.describe ChangeDepositorEventJob do let(:previous_user) { create(:user) } let(:new_user) { create(:user) } let(:mock_time) { Time.zone.at(1) } let(:event) do { action: "User <a href=\"/users/#{previous_user.to_param}\">#{previous_user.user_key}</a> " \ "ha...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/characterize_job_spec.rb
Ruby
apache-2.0
197
main
9,012
# frozen_string_literal: true RSpec.describe CharacterizeJob, :active_fedora, :clean_repo do let(:file_set_id) { 'abc12345' } let(:upload_root) { Pathname.new(ENV.fetch('HYRAX_UPLOAD_PATH', Rails.root.join('tmp', 'uploads'))) } let(:filename) { upload_root.join('ab', 'c1', '23', '45', 'abc12345', 'picture.png'...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/embargo_expiry_job_spec.rb
Ruby
apache-2.0
197
main
3,513
# frozen_string_literal: true RSpec.describe EmbargoExpiryJob, :clean_repo, :frozen_time do subject { described_class } context "with Valkyrie resources" do let(:embargoed_work) { valkyrie_create(:hyrax_work, :under_embargo) } let!(:work_with_expired_embargo) { valkyrie_create(:hyrax_work, :with_expired_en...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/content_deposit_event_job_spec.rb
Ruby
apache-2.0
197
main
960
# frozen_string_literal: true RSpec.describe ContentDepositEventJob do let(:user) { create(:user) } let(:mock_time) { Time.zone.at(1) } let(:curation_concern) { valkyrie_create(:monograph, title: ['MacBeth'], depositor: user.user_key) } let(:event) do { action: "User <a href=\"/users/#{user.to_param}\...
github
samvera/hyrax
https://github.com/samvera/hyrax
spec/jobs/content_restored_version_event_job_spec.rb
Ruby
apache-2.0
197
main
2,051
# frozen_string_literal: true RSpec.describe ContentRestoredVersionEventJob do let(:user) { create(:user) } let(:mock_time) { Time.zone.at(1) } let(:event) do { action: "User <a href=\"/users/#{user.to_param}\">#{user.user_key}</a> " \ "has restored a version 'content.0' of " \ ...