diff --git a/.lando.yml b/.lando.yml new file mode 100644 index 00000000..67af27c2 --- /dev/null +++ b/.lando.yml @@ -0,0 +1,15 @@ +name: franklin +services: + gibneysolr: + type: compose + scanner: false # solr isn't running after lando start + services: + user: root + image: quay.io/upennlibraries/upenn_solr:7.7.0 + ports: + - '8983:8983' + environment: + LANDO_DROP_USER: solr +proxy: + gibneysolr: + - franklin.solr.lndo.site:8983 diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..a35c44f4 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--require rails_helper diff --git a/Gemfile b/Gemfile index d224b50a..b509f876 100644 --- a/Gemfile +++ b/Gemfile @@ -41,4 +41,10 @@ end group :development, :test do gem 'byebug', platforms: :ruby + gem 'rspec-rails' +end + +group :test do + gem 'capybara' + gem 'cuprite' end diff --git a/Gemfile.lock b/Gemfile.lock index 3e8d921d..574c941e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -128,6 +128,15 @@ GEM sprockets (>= 3.6.0) builder (3.2.4) byebug (11.0.1) + capybara (3.15.1) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.2) + xpath (~> 3.2) + cliver (0.3.2) coffee-rails (4.2.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.2.x) @@ -139,6 +148,9 @@ GEM confstruct (1.0.2) hashie (~> 3.3) crass (1.0.6) + cuprite (0.11) + capybara (>= 2.1, < 4) + ferrum (~> 0.9.0) debug_inspector (0.0.3) deprecation (1.0.0) activesupport @@ -150,6 +162,7 @@ GEM warden (~> 1.2.3) devise-guests (0.5.0) devise + diff-lcs (1.4.4) dot-properties (0.1.3) dotenv (2.7.6) dotenv-rails (2.7.6) @@ -162,6 +175,11 @@ GEM nokogiri (~> 1.6) faraday (1.0.1) multipart-post (>= 1.2, < 3) + ferrum (0.9) + addressable (~> 2.5) + cliver (~> 0.3) + concurrent-ruby (~> 1.1) + websocket-driver (>= 0.6, < 0.8) ffi (1.13.1) font-awesome-rails (4.7.0.5) railties (>= 3.2, < 6.1) @@ -220,6 +238,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.4.10) + nio4r (2.5.2) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) oga (3.3) @@ -231,6 +250,8 @@ GEM orm_adapter (0.5.0) parslet (2.0.0) public_suffix (4.0.6) + puma (4.3.5) + nio4r (~> 2.0) rack (1.6.13) rack-test (0.6.3) rack (>= 1.0) @@ -264,11 +285,29 @@ GEM ffi (~> 1.0) rdoc (4.3.0) ref (2.0.0) + regexp_parser (1.7.1) responders (2.4.1) actionpack (>= 4.2.0, < 6.0) railties (>= 4.2.0, < 6.0) rsolr (1.1.2) builder (>= 2.1.2) + rspec-core (3.9.2) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.9.3) ruby-ll (2.1.2) ansi ast @@ -333,6 +372,11 @@ GEM binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) yell (2.2.2) PLATFORMS @@ -348,7 +392,9 @@ DEPENDENCIES blacklight_solrplugins! browserify-rails byebug + capybara coffee-rails (= 4.2.1) + cuprite devise (~> 4) devise-guests (= 0.5.0) dotenv-rails @@ -361,8 +407,10 @@ DEPENDENCIES mysql2 (~> 0.4.10) nokogiri (~> 1.10.0) oga + puma rails (~> 4.2.0) rsolr (= 1.1.2) + rspec-rails sass-rails (= 5.0.6) sdoc (= 0.4.2) sqlite3 (= 1.3.12) diff --git a/README.md b/README.md index 43d4d784..abcc761a 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,13 @@ # Nouveau Franklin -Installation: +## Development Setup -- Checkout this repo. - -- Make sure you have ruby 2.3.3 installed. It's recommended that you - use [rbenv](https://github.com/rbenv/rbenv), but it may be - quicker/easier to get running with [rvm](https://rvm.io/). +- Clone this repo +- Install Ruby `2.3.3` ([rbenv](https://github.com/rbenv/rbenv) recommended) - You may have issues installing Ruby 2.3.3 in recent Linux distributions due to an OpenSSL version incompatibility. See [this guide](https://www.garron.me/en/linux/install-ruby-2-3-3-ubuntu.html) for help. - - Run `bundle install` to install all gem dependencies. - - Run `npm install` to install javascript libraries. - - Edit the `local_dev_env` file and populate the variables with appropriate values. Then source it in your shell. @@ -25,41 +19,13 @@ Installation: also have run this again whenever you pull code that includes new migrations (if you forget, Rails will raise an exception when serving requests because there are unloaded migrations.) - -- If there isn't a Solr instance you can use, you'll need to install - Solr and add the - [solrplugins](https://github.com/upenn-libraries/solrplugins) - extensions to it. The following line should be added to the file - `solr-x.x.x/server/contexts/solr-jetty-context.xml` inside the - 'Configure' tag: - - ``` - /path/to/solrplugins-0.1-SNAPSHOT.jar - ``` - - Add the solr core from the - [library-solr-schema](https://gitlab.library.upenn.edu/discovery/library-solr-schema) - repo. You can copy the core's directory into `solr-x.x.x/server/solr` - - Load some test marc data into Solr: - - ```bash - bundle exec rake solr:marc:index_test_data - ``` - - This pulls 30 sample records from - [the Blacklight-Data repository](https://github.com/projectblacklight/blacklight-data). - - If the test data is successfully indexed, you should see output - something like: - - ``` - 2016-03-03T12:29:40-05:00 INFO Traject::SolrJsonWriter writing to 'http://127.0.0.1:8983/solr/blacklight-core/update/json' in batches of 100 with 1 bg threads - 2016-03-03T12:29:40-05:00 INFO Indexer with 1 processing threads, reader: Traject::MarcReader and writer: Traject::SolrJsonWriter - 2016-03-03T12:29:41-05:00 INFO Traject::SolrJsonWriter sending commit to solr at url http://127.0.0.1:8983/solr/blacklight-core/update/json... - 2016-03-03T12:29:41-05:00 INFO finished Indexer#process: 30 records in 0.471 seconds; 63.8 records/second overall. - ``` - +- Configure Solr + - You can get the production Solr URL and use that, assuming you're on the Penn VPN + - Otherwise, you can run Penn's custom Solr locally using Lando + - `franklin:start` to pull and start the Solr container and load the `stable` Solr config from the [Franklin Solr Config repo](https://gitlab.library.upenn.edu/franklin/franklin-solr-config) and create dev and test collections + - `franklin:solrconfig` can read the `SOLR_CONFIG_BRANCH` env var to pull from a different branch when and initialize new collections + - `franklin:stop` when you're done working + - `franklin:clean` when things get weird and you need to start fresh - Start the rails server: ```bash @@ -67,10 +33,9 @@ Installation: ``` - Open up [localhost:3000](localhost:3000) in a browser. If - everything went well, you should see the generic Blacklight homepage - and have 30 faceted records to search. + everything went well, you should see the Franklin homepage. -# Solr Indexing +## Solr Indexing This repository also contains Traject code for indexing MARC records into Solr. It isn't separate because we want to consolidate the MARC @@ -84,7 +49,7 @@ The commands in this section can be run directly, or in an application container. See the `run_in_container.sh` wrapper script in the ansible repository. -## Full exports +### Full exports Transfer the *.tar.gz files created by the Alma publishing job to the directory where they will be preprocessed and indexed. Run these commands: @@ -95,7 +60,7 @@ directory where they will be preprocessed and indexed. Run these commands: ./index_solr.sh /var/solr_input_data/alma_prod_sandbox/20170412_full/processed ``` -## Incremental updates (OAI) +### Incremental updates (OAI) This runs via a cron job, which fetches the updates available via OAI since the last time the job was run. @@ -113,7 +78,7 @@ you can do so like this: ./index_and_deletions.sh /var/solr_input_data/alma_prod_sandbox/oai/allTitles/2017_04_10_00_00 allTitles ``` -# Docker +## Building Docker Images There is a `build_docker_image.sh` script you can use to build docker images from specific branches that have been freshly pulled from @@ -131,6 +96,19 @@ See the repository for Ansible scripts that build Docker images and deploy containers to the test and production environments. +# Running Tests + +Tests require a locally-installed version of Chrome to support feature specs + +The usual ENV variables need to be set, for now + +- DL Chrome @ `https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/737173/` +- Extract to `PATH_OF_YOUR_CHOOSING` +- Load the required environment variables (e.g., `source local_dev_env`) + - include chrome path with ENV var: BROWSER_PATH=`PATH_OF_YOUR_CHOOSING` +- Start dockerized UPenn Solr `rake franklin:start` +- Run suite: `RAILS_ENV=test rspec` + # Auditing Secrets You can use [Gitleaks](https://github.com/upenn-libraries/gitleaks) to check the repository for unencrypted secrets that have been committed. diff --git a/config/blacklight.yml b/config/blacklight.yml index 36475445..f8ce70a0 100644 --- a/config/blacklight.yml +++ b/config/blacklight.yml @@ -1,21 +1,9 @@ -# = jetty_path key -# each environment can have a jetty_path with absolute or relative -# (to app root) path to a jetty/solr install. This is used -# by the rake tasks that start up solr automatically for testing -# and by rake solr:marc:index. -# -# jetty_path is not used by a running Blacklight application -# at all. In general you do NOT need to deploy solr in Jetty, you can deploy it -# however you want. -# jetty_path is only required for rake tasks that need to know -# how to start up solr, generally for automated testing. - development: adapter: solr - url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/blacklight-core" %> + url: <%= ENV['SOLR_URL'] || "http://franklin.solr.lndo.site:8983/solr/franklin-dev" %> test: &test adapter: solr - url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8888}/solr/blacklight-core" %> + url: <%= ENV['TEST_SOLR_URL'] || "http://franklin.solr.lndo.site:8983/solr/franklin-test" %> production: adapter: solr url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/blacklight-core" %> \ No newline at end of file diff --git a/lib/penn_lib/lando.rb b/lib/penn_lib/lando.rb new file mode 100644 index 00000000..d83b7975 --- /dev/null +++ b/lib/penn_lib/lando.rb @@ -0,0 +1,66 @@ +module PennLib + # helper methods for interacting with Lando for development + module Lando + SOLR_CONTAINER_NAME = 'gibneysolr'.freeze + SOLR_CONTAINER_USER = 'solr'.freeze + class << self + # Run a command in a Lando container + # @param [String] command + # @param [Hash] options + def run(command, options = {}) + cmd = "lando ssh #{options[:container]}" + cmd += " -u #{options[:user]}" if options[:user] + cmd += " '-c #{command}'" + system cmd + end + + # Run a command in the Solr container as solr user + # @param [String] command + def solr_run(command) + run command, solr_run_opts + end + + # Start GibneySolr + # @return [TrueClass, FalseClass, nil] + def start_solr + solr_run '/opt/solr/bin/solr start -c -m 2g -p 8983 -Dsolr.jetty.request.header.size=65536' + end + + # Create a Solr collection + # @param [String] name + # @param [String] config + # @return [TrueClass, FalseClass, nil] + def create_collection(name, config) + solr_run "/opt/solr/bin/solr create_collection -c #{name} -d #{config}" + end + + # Delete an existing collection + # @param [String] name + # @return [TrueClass, FalseClass, nil] + def delete_collection(name) + solr_run "/opt/solr/bin/solr delete -c #{name}" + end + + # Copy Solr config from Lando mount to Solr configset dir + # @param [String] name + # @return [TrueClass, FalseClass, nil] + def copy_config(name) + solr_run "cp -r /app/tmp/solr_conf/#{name} /opt/solr/server/solr/configsets/#{name}" + end + + # Check if collections exist in solr container + # @return [TrueClass, FalseClass] + def collections_exist? + status = Open3.capture2e("lando ssh #{SOLR_CONTAINER_NAME} -u #{SOLR_CONTAINER_USER} -c '/opt/solr/bin/solr status'") + status.join.include? '"collections":"2"' + end + + private + + # @return [Hash{Symbol->String}] + def solr_run_opts + { container: SOLR_CONTAINER_NAME, user: SOLR_CONTAINER_USER } + end + end + end +end diff --git a/lib/tasks/franklin.rake b/lib/tasks/franklin.rake new file mode 100644 index 00000000..b53cf1e5 --- /dev/null +++ b/lib/tasks/franklin.rake @@ -0,0 +1,93 @@ +require 'fileutils' +require 'open-uri' +require 'rubygems/package' +require 'zlib' +require 'penn_lib/lando' + +namespace :franklin do + desc 'Start development/test environment Solr instance' + task :start do + system('lando start') + + # Start solr + PennLib::Lando.start_solr + + if PennLib::Lando.collections_exist? + puts "\nServices initialized!" + else + Rake::Task['franklin:solrconfig'].invoke + end + + # No Lando DB for now + # # Create databases, if they aren't present. + # system('rake db:create') + # + # # Migrate test and development databases + # system('RACK_ENV=development rake db:migrate') + # system('RACK_ENV=test rake db:migrate') + end + + desc 'Stop development/test environment' + task :stop do + system('lando stop') + end + + desc 'Cleans development/test environment' + task :clean do + system('lando destroy -y') + end + + desc 'Update Solr config from repo and recreate Solr collections' + task :solrconfig do + solr_config_path = File.join Rails.root, 'tmp', 'solr_conf' + + # create solr_config_path if it doesnt already exist + FileUtils.mkdir solr_config_path unless Dir.exist? solr_config_path + + # clear out old config + FileUtils.rm_rf(Dir.glob(File.join(solr_config_path, '*'))) + + # Pull configset based on branch parameter, if present + solr_config_branch = ENV['SOLR_CONFIG_BRANCH'] || 'stable' + solr_config_name = "franklin-solr-config-#{solr_config_branch}" + # eventually, this will be a public URL - but not yet - VPN needed + config_download_path = "https://gitlab.library.upenn.edu/franklin/franklin-solr-config/-/archive/#{solr_config_branch}/#{solr_config_name}.tar.gz" + + # download file to Tempfile + begin + tar_file = URI(config_download_path).open + rescue StandardError => _e + puts "Problem retrieving Solr config - are you on the VPN? Are you sure branch '#{solr_config_branch}' exists?" + next # exit + end + + # extract files + tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open(tar_file)) + tar_extract.rewind + tar_extract.each do |entry| + if entry.directory? + Dir.mkdir File.join solr_config_path, entry.full_name + elsif entry.file? + File.open( + File.join(solr_config_path, entry.full_name), + 'a+:ASCII-8BIT' # use proper encoding for new files + ) do |f| + f.write entry.read + end + end + end + tar_extract.close + + # delete existing collections + if PennLib::Lando.collections_exist? + PennLib::Lando.delete_collection 'franklin-test' + PennLib::Lando.delete_collection 'franklin-dev' + end + + PennLib::Lando.copy_config solr_config_name + + # create solr collections + PennLib::Lando.create_collection 'franklin-test', solr_config_name + PennLib::Lando.create_collection 'franklin-dev', solr_config_name + end +end diff --git a/public/assets/.sprockets-manifest-851fce9ddcf2a284eeb9b2773dc025ad.json b/public/assets/.sprockets-manifest-851fce9ddcf2a284eeb9b2773dc025ad.json deleted file mode 100644 index 6cb657d7..00000000 --- a/public/assets/.sprockets-manifest-851fce9ddcf2a284eeb9b2773dc025ad.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"bento_search/large_loader-c297929a72964c7cfe17e2dfd5d17c15c2c03243b6cec7f67a3929030fbf8c3d.gif":{"logical_path":"bento_search/large_loader.gif","mtime":"2019-02-08T20:05:16+00:00","size":4750,"digest":"c297929a72964c7cfe17e2dfd5d17c15c2c03243b6cec7f67a3929030fbf8c3d","integrity":"sha256-wpeSmnKWTHz+F+Lf1dF8FcLAMkO2zsf2ejkpAw+/jD0="},"favicon-ebdb250da2d0d48765646df4758c2c10bc6c632ea4e6dc4c83f3d9493161c979.ico":{"logical_path":"favicon.ico","mtime":"2018-12-11T21:38:53+00:00","size":1150,"digest":"ebdb250da2d0d48765646df4758c2c10bc6c632ea4e6dc4c83f3d9493161c979","integrity":"sha256-69slDaLQ1IdlZG30dYwsELxsYy6k5txMg/PZSTFhyXk="},"flot/excanvas.min-39a325f42722afab6a881d53103be4a76f999942a97f97d0fe15478af19519cd.js":{"logical_path":"flot/excanvas.min.js","mtime":"2019-02-08T20:06:54+00:00","size":19315,"digest":"39a325f42722afab6a881d53103be4a76f999942a97f97d0fe15478af19519cd","integrity":"sha256-OaMl9Ccir6tqiB1TEDvkp2+ZmUKpf5fQ/hVHivGVGc0="},"footerboxshadow-2a8274141d656b5be1ac462efa8b941a8d17ce3538457f75268d97825ef41451.png":{"logical_path":"footerboxshadow.png","mtime":"2018-12-11T21:38:53+00:00","size":946,"digest":"2a8274141d656b5be1ac462efa8b941a8d17ce3538457f75268d97825ef41451","integrity":"sha256-KoJ0FB1la1vhrEYu+ouUGo0XzjU4RX91Jo2Xgl70FFE="},"holdnumbers-445d54d25c92e72fe77d7b814aaa4401f1745128136754325134a81958fc056c.png":{"logical_path":"holdnumbers.png","mtime":"2018-12-11T21:38:53+00:00","size":942,"digest":"445d54d25c92e72fe77d7b814aaa4401f1745128136754325134a81958fc056c","integrity":"sha256-RF1U0lyS5y/nfXuBSqpEAfF0USgTZ1QyUTSoGVj8BWw="},"logo-e6ead9b2545325f212dcb3d51e5a6299fa076a3ebc5183a579f0c57bf64b92bd.png":{"logical_path":"logo.png","mtime":"2018-12-11T21:38:53+00:00","size":5317,"digest":"e6ead9b2545325f212dcb3d51e5a6299fa076a3ebc5183a579f0c57bf64b92bd","integrity":"sha256-5urZslRTJfIS3LPVHlpimfoHaj68UYOlefDFe/ZLkr0="},"news-6dd00eae1bd5eda58e67678333b4bcd88f0de04fcbae8e2dc78abc0eb819db81.png":{"logical_path":"news.png","mtime":"2018-12-11T21:38:53+00:00","size":2687,"digest":"6dd00eae1bd5eda58e67678333b4bcd88f0de04fcbae8e2dc78abc0eb819db81","integrity":"sha256-bdAOrhvV7aWOZ2eDM7S82I8N4E/Lro4tx4q8DrgZ24E="},"orrerybg-6f5c9173d09abf557a4c54ddc6a4848cd0dd7fcd83e512a00752ef29db8b2767.jpg":{"logical_path":"orrerybg.jpg","mtime":"2018-12-11T21:38:53+00:00","size":30602,"digest":"6f5c9173d09abf557a4c54ddc6a4848cd0dd7fcd83e512a00752ef29db8b2767","integrity":"sha256-b1yRc9Cav1V6TFTdxqSEjNDdf82D5RKgB1LvKduLJ2c="},"ptswirl-11px-0c8980731196510695ec56ec3015146cb0c6ced1bade3ce4d9c14202b4702051.gif":{"logical_path":"ptswirl-11px.gif","mtime":"2018-12-11T21:38:53+00:00","size":1236,"digest":"0c8980731196510695ec56ec3015146cb0c6ced1bade3ce4d9c14202b4702051","integrity":"sha256-DImAcxGWUQaV7FbsMBUUbLDGztG63jzk2cFCArRwIFE="},"application-05cecc00158695ab61849e2ed9a5c72b87121d32992a4c60b0b88143bbfec6e4.js":{"logical_path":"application.js","mtime":"2019-02-08T21:52:12+00:00","size":696136,"digest":"05cecc00158695ab61849e2ed9a5c72b87121d32992a4c60b0b88143bbfec6e4","integrity":"sha256-Bc7MABWGlathhJ4u2aXHK4cSHTKZKkxgsLiBQ7v+xuQ="},"application-be5364daf28a0ff91b1bd28a64c70974f114aa095c1922746977cb1629350c59.css":{"logical_path":"application.css","mtime":"2019-02-08T21:52:12+00:00","size":391487,"digest":"be5364daf28a0ff91b1bd28a64c70974f114aa095c1922746977cb1629350c59","integrity":"sha256-vlNk2vKKD/kbG9KKZMcJdPEUqglcGSJ0aXfLFik1DFk="},"bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot":{"logical_path":"bootstrap/glyphicons-halflings-regular.eot","mtime":"2019-02-08T20:06:51+00:00","size":20127,"digest":"13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407","integrity":"sha256-E2NNqH2eI/jD7ZEIzhck0YOjmtBy5z4bPYy/ZG0tBAc="},"bootstrap/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2":{"logical_path":"bootstrap/glyphicons-halflings-regular.woff2","mtime":"2019-02-08T20:06:51+00:00","size":18028,"digest":"fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c","integrity":"sha256-/hhdEaSWdokNR7t4MxKgzaWkTEA5IUCU55V7TAQO8Rw="},"bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff":{"logical_path":"bootstrap/glyphicons-halflings-regular.woff","mtime":"2019-02-08T20:06:51+00:00","size":23424,"digest":"a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742","integrity":"sha256-omOU9+3hAMoRjv8u2ghZYnWpg5uVnCJuFUOVV6WoB0I="},"bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf":{"logical_path":"bootstrap/glyphicons-halflings-regular.ttf","mtime":"2019-02-08T20:06:51+00:00","size":45404,"digest":"e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456","integrity":"sha256-45UEQJN1fYKvyxOJV9BqHqk2G9zwtELQahioBRr1dFY="},"bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg":{"logical_path":"bootstrap/glyphicons-halflings-regular.svg","mtime":"2019-02-08T20:06:51+00:00","size":108738,"digest":"42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5","integrity":"sha256-QvYGWdJlwaPDD5+kKry7Vr1KU69Ng9MW1t16NpA8Q+U="},"blacklight/logo-e368f4faad4c5310352e175e1fba8220b57aab2e29cbe0f3ca1189a2ef085f9b.png":{"logical_path":"blacklight/logo.png","mtime":"2019-02-08T20:05:20+00:00","size":3861,"digest":"e368f4faad4c5310352e175e1fba8220b57aab2e29cbe0f3ca1189a2ef085f9b","integrity":"sha256-42j0+q1MUxA1LhdeH7qCILV6qy4py+DzyhGJou8IX5s="},"blacklight_alma/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css":{"logical_path":"blacklight_alma/application.css","mtime":"2019-02-08T20:05:21+00:00","size":653,"digest":"e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113","integrity":"sha256-6A6PIxgEPor5Td3Cra1aTwlzmo67Mjs6sxzXHUX9kRM="},"blacklight_solrplugins/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css":{"logical_path":"blacklight_solrplugins/application.css","mtime":"2019-02-08T20:05:21+00:00","size":653,"digest":"e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113","integrity":"sha256-6A6PIxgEPor5Td3Cra1aTwlzmo67Mjs6sxzXHUX9kRM="}},"assets":{"bento_search/large_loader.gif":"bento_search/large_loader-c297929a72964c7cfe17e2dfd5d17c15c2c03243b6cec7f67a3929030fbf8c3d.gif","favicon.ico":"favicon-ebdb250da2d0d48765646df4758c2c10bc6c632ea4e6dc4c83f3d9493161c979.ico","flot/excanvas.min.js":"flot/excanvas.min-39a325f42722afab6a881d53103be4a76f999942a97f97d0fe15478af19519cd.js","footerboxshadow.png":"footerboxshadow-2a8274141d656b5be1ac462efa8b941a8d17ce3538457f75268d97825ef41451.png","holdnumbers.png":"holdnumbers-445d54d25c92e72fe77d7b814aaa4401f1745128136754325134a81958fc056c.png","logo.png":"logo-e6ead9b2545325f212dcb3d51e5a6299fa076a3ebc5183a579f0c57bf64b92bd.png","news.png":"news-6dd00eae1bd5eda58e67678333b4bcd88f0de04fcbae8e2dc78abc0eb819db81.png","orrerybg.jpg":"orrerybg-6f5c9173d09abf557a4c54ddc6a4848cd0dd7fcd83e512a00752ef29db8b2767.jpg","ptswirl-11px.gif":"ptswirl-11px-0c8980731196510695ec56ec3015146cb0c6ced1bade3ce4d9c14202b4702051.gif","application.js":"application-05cecc00158695ab61849e2ed9a5c72b87121d32992a4c60b0b88143bbfec6e4.js","application.css":"application-be5364daf28a0ff91b1bd28a64c70974f114aa095c1922746977cb1629350c59.css","bootstrap/glyphicons-halflings-regular.eot":"bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot","bootstrap/glyphicons-halflings-regular.woff2":"bootstrap/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2","bootstrap/glyphicons-halflings-regular.woff":"bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff","bootstrap/glyphicons-halflings-regular.ttf":"bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf","bootstrap/glyphicons-halflings-regular.svg":"bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg","blacklight/logo.png":"blacklight/logo-e368f4faad4c5310352e175e1fba8220b57aab2e29cbe0f3ca1189a2ef085f9b.png","blacklight_alma/application.css":"blacklight_alma/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css","blacklight_solrplugins/application.css":"blacklight_solrplugins/application-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css"}} \ No newline at end of file diff --git a/spec/features/franklin_spec.rb b/spec/features/franklin_spec.rb new file mode 100644 index 00000000..72aa29fb --- /dev/null +++ b/spec/features/franklin_spec.rb @@ -0,0 +1,30 @@ +describe 'Franklin', type: :feature do + describe 'landing page' do + before do + visit '/' + end + it 'renders' do + expect(page).to have_text 'Franklin' + end + end + describe 'bento', js: true do + before do + visit '/bento' + end + it 'renders the expected bento box divs' do + expect(page).to have_css '#bento-results-catalog' + expect(page).to have_css '#bento-results-summon' + expect(page).to have_css '#bento-results-databases' + expect(page).to have_css '#bento-results-colenda' + expect(page).to have_css '#bento-results-expert' + end + end + describe 'catalog', js: true do + before do + visit '/catalog' + end + it 'renders' do + expect(page).to have_text 'Franklin Catalog' + end + end +end \ No newline at end of file diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 00000000..9adee955 --- /dev/null +++ b/spec/rails_helper.rb @@ -0,0 +1,64 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +require 'spec_helper' +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../config/environment', __dir__) +# Prevent database truncation if the environment is production +abort('The Rails environment is running in production mode!') if Rails.env.production? +require 'rspec/rails' +# Add additional requires below this line. Rails is not loaded until this point! +require 'capybara/rails' +require 'capybara/cuprite' + +# Use cuprite driver to run specs requiring JS in headless chrome +Capybara.javascript_driver = :cuprite +Capybara.register_driver(:cuprite) do |app| + Capybara::Cuprite::Driver.new(app, + window_size: [1200, 800], + inspector: true, + browser_path: ENV['BROWSER_PATH'] + ) +end +Capybara.server = :webrick + +# Requires supporting ruby files with custom matchers and macros, etc, in +# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are +# run as spec files by default. This means that files in spec/support that end +# in _spec.rb will both be required and run as specs, causing the specs to be +# run twice. It is recommended that you do not name files matching this glob to +# end with _spec.rb. You can configure this pattern with the --pattern +# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. +# +# The following line is provided for convenience purposes. It has the downside +# of increasing the boot-up time by auto-requiring all files in the support +# directory. Alternatively, in the individual `*_spec.rb` files, manually +# require only the support files necessary. +# +# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } + +# Checks for pending migrations and applies them before tests are run. +# If you are not using ActiveRecord, you can remove these lines. +begin + ActiveRecord::Migration.maintain_test_schema! +rescue ActiveRecord::PendingMigrationError => e + puts e.to_s.strip + exit 1 +end +RSpec.configure do |config| + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # Uncomment this to disable ActiveRecord support + # config.use_active_record = false + + config.infer_spec_type_from_file_location! + + # Filter lines from Rails gems in backtraces. + config.filter_rails_from_backtrace! + # arbitrary gems may also be filtered via: + # config.filter_gems_from_backtrace("gem name") +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 00000000..3ea64c4b --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,31 @@ +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups +end diff --git a/test/controllers/.keep b/test/controllers/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/test/fixtures/.keep b/test/fixtures/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml deleted file mode 100644 index 937a0c00..00000000 --- a/test/fixtures/users.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -# This model initially had no columns defined. If you add columns to the -# model remove the '{}' from the fixture names and add the columns immediately -# below each fixture, per the syntax in the comments below -# -one: {} -# column: value -# -two: {} -# column: value diff --git a/test/helpers/.keep b/test/helpers/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/test/integration/.keep b/test/integration/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/test/mailers/.keep b/test/mailers/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/test/models/.keep b/test/models/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/test/models/user_test.rb b/test/models/user_test.rb deleted file mode 100644 index 82f61e01..00000000 --- a/test/models/user_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class UserTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/test_helper.rb b/test/test_helper.rb deleted file mode 100644 index 92e39b2d..00000000 --- a/test/test_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../../config/environment', __FILE__) -require 'rails/test_help' - -class ActiveSupport::TestCase - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - fixtures :all - - # Add more helper methods to be used by all tests here... -end