Skip to content

Commit

Permalink
Starting datastore presenters and specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
erinesullivan committed Feb 21, 2025
1 parent a73a3d0 commit 42b1e64
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 0 deletions.
63 changes: 63 additions & 0 deletions config/datastores.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
- slug: everything
title: Everything
description: Explore the University of Michigan Library Search for comprehensive results across catalogs, articles, databases, online journals, and more. Begin your search now for detailed records and specific resources.
search_options:
- keyword
- title
- author
- slug: catalog
title: Catalog
description: Discover the University of Michigan Library Catalog to access an extensive collection of physical and online materials, including books, audio, video, maps, musical scores, and more. Find everything you need in one place.
search_options:
- keyword
- title
- title_starts_with
- author
- journal_title
- subject
- lc_subject_starts_with
- call_number_starts_with
- series
- isn
- browse_by_callnumber
- browse_by_author
- browse_by_subject
- slug: articles
title: Articles
description: Utilize the Articles gateway at the University of Michigan Library to access scholarly journal articles, newspaper articles, book chapters, and conference proceedings. For subject-specific searches, explore our comprehensive databases.
search_options:
- keyword_contains
- exact
- title
- author
- subject
- publication_date
- issn
- isbn
- slug: databases
title: Databases
description: Explore University of Michigan Library's databases, tailored to specific subjects and formats. Access subscription databases, locally created collections, and open-access resources. Browse by alphabetical order or academic discipline to find what you need.
search_options:
- keyword
- title
- title_starts_with
- academic_discipline
- publisher
- slug: onlinejournals
title: Online Journals
description: Access University of Michigan Library's Online Journals, including scholarly journals, newspapers, trade publications, and magazines. Find subscription and open-access journals, with detailed access and date information. Browse by title or discipline.
search_options:
- keyword
- title
- title_starts_with
- subject
- lc_subject_starts_with
- academic_discipline
- call_number_starts_with
- isn
- slug: guidesandmore
title: Guides and More
description: Discover University of Michigan Library's Guides and More section for research guides, specialty sites, blogs, and online exhibits. Explore services, spaces, and collections, and visit lib.umich.edu for staff info, news, events, and physical exhibits.
search_options:
- keyword
- title
1 change: 1 addition & 0 deletions lib/search/presenters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Search
module Presenters
end
end
require "search/presenters/datastores"
require "search/presenters/icons"
require "search/presenters/search_options"

Expand Down
33 changes: 33 additions & 0 deletions lib/search/presenters/datastores.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module Search
module Presenters
class Datastores
DATASTORES = YAML.load_file(File.join(S.config_path, "datastores.yaml"))

def initialize(datastores = [])
@datastores = datastores
end
end

class Datastore
def initialize(datastore)
@datastore = datastore
end

def slug
@datastore["slug"]
end

def title
@datastore["title"]
end

def description
@datastore["description"]
end

def search_options
@datastore["search_options"]
end
end
end
end
46 changes: 46 additions & 0 deletions spec/presenters/datastores_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# RSpec.describe Search::Presenters::Datastores do
# context "#sdatastores" do
# it "lists datastores in the config file" do
# expect(described_class.new.datastores).to include("...")
# end
# end
# end

RSpec.describe Search::Presenters::Datastore do
before(:each) do
@datastore = {
"slug" => "everything",
"title" => "Everything",
"description" => "Explore the University of Michigan Library Search for comprehensive results across catalogs, articles, databases, online journals, and more. Begin your search now for detailed records and specific resources.",
"search_options" => ["keyword", "title", "author"]
}
end

subject do
described_class.new(@datastore)
end

context "#slug" do
it "has a slug" do
expect(subject.slug).to eq(@datastore["slug"])
end
end

context "#title" do
it "has a title" do
expect(subject.title).to eq(@datastore["title"])
end
end

context "#description" do
it "has a description" do
expect(subject.description).to eq(@datastore["description"])
end
end

context "#search_options" do
it "has search options" do
expect(subject.search_options).to eq(@datastore["search_options"])
end
end
end
File renamed without changes.

0 comments on commit 42b1e64

Please sign in to comment.