test(integration): Delete the index between each runs
This commit is contained in:
parent
48604389a1
commit
d7e4103ab2
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
Gemfile.lock
|
||||
.envrc
|
||||
pkg/
|
||||
coverage/
|
||||
docs-dev/
|
||||
|
||||
15
Rakefile
15
Rakefile
@ -9,10 +9,13 @@ rescue Bundler::BundlerError => e
|
||||
warn 'Run `bundle install` to install missing gems'
|
||||
exit e.status_code
|
||||
end
|
||||
require 'algoliasearch'
|
||||
require 'rake'
|
||||
require 'rspec/core'
|
||||
require 'rspec/core/rake_task'
|
||||
require 'rubocop/rake_task'
|
||||
|
||||
# LINT
|
||||
require 'rubocop/rake_task'
|
||||
desc 'Check files for linting issues'
|
||||
RuboCop::RakeTask.new(:lint) do |task|
|
||||
task.patterns = [
|
||||
@ -26,8 +29,6 @@ RuboCop::RakeTask.new(:lint) do |task|
|
||||
end
|
||||
|
||||
# TEST
|
||||
require 'rspec/core'
|
||||
require 'rspec/core/rake_task'
|
||||
desc 'Run unit tests'
|
||||
RSpec::Core::RakeTask.new(:test) do |task|
|
||||
task.rspec_opts = '--color --format progress'
|
||||
@ -70,6 +71,14 @@ namespace 'test' do
|
||||
task :watch do
|
||||
puts 'Please, run ./scripts/test_integration_watch manually'
|
||||
end
|
||||
# Delete the test index
|
||||
task :_delete_index do
|
||||
Algolia.init(
|
||||
application_id: ENV['ALGOLIA_APPLICATION_ID'],
|
||||
api_key: ENV['ALGOLIA_API_KEY']
|
||||
)
|
||||
Algolia::Index.new(ENV['ALGOLIA_INDEX_NAME']).delete_index!
|
||||
end
|
||||
task :_run do
|
||||
end
|
||||
task :_watch_run do
|
||||
|
||||
@ -1,7 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [[ -z "$ALGOLIA_APPLICATION_ID" ]]; then
|
||||
echo "You need to set ALGOLIA_APPLICATION_ID"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "$ALGOLIA_API_KEY" ]]; then
|
||||
echo "You need to set ALGOLIA_API_KEY"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "$ALGOLIA_INDEX_NAME" ]]; then
|
||||
echo "You need to set ALGOLIA_INDEX_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
cd ./spec/site
|
||||
bundle install --quiet
|
||||
|
||||
bundle exec jekyll build
|
||||
|
||||
rake test:integration:_delete_index
|
||||
bundle exec jekyll algolia
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user