generated from mlibrary/ruby-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting datastore presenters and specs.
- Loading branch information
1 parent
a73a3d0
commit 42b1e64
Showing
5 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.