Permalink
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (33 sloc) 1.53 KB

RSPEC

Description

This software has a suite of spec tests in the 'spec' folder.

Requirements

Update the schema with:

rake db:migrate RAILS_ENV=test

Please prepare the correct folder structure for the test environment:

|--muscat /
|--|-solr /
|--|-|-test /
|--|-|-|-data /
|--|-|-|-core.properties

The schema will be loaded into a mysql database; all objects are created by FactoryBot during the suite.

Requirements

For headless chrome: Chrome 59+ and ChromeDriver installed.

CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/
apt install gconf-service libgconf-2-4 libnspr4 libnss3 libpango1.0-0 libappindicator1 libcurl3
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

This connects to the following sunspot-solr instance (see config/solr.yml):

test: &test
  url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8981/solr/test" %>

Workflow

Before starting the suite solr server should be initialized in the test environment:

RAILS_ENV=test rake sunspot:solr:start

To execute the full suite call:

bundle exec rspec -fd

After finishing the sunspot session could be stopped with:

RAILS_ENV=test rake sunspot:solr:stop

Sunspot

Some examples are relying on a clean Sunspot:Solr index. It should be switched on by setting “solr: true” as an argument, eg:

RSpec.describe Admin::SourcesController, :type => :controller, solr: true do 
end