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
|
Gemfile.lock
|
||||||
|
.envrc
|
||||||
pkg/
|
pkg/
|
||||||
coverage/
|
coverage/
|
||||||
docs-dev/
|
docs-dev/
|
||||||
|
|||||||
15
Rakefile
15
Rakefile
@ -9,10 +9,13 @@ rescue Bundler::BundlerError => e
|
|||||||
warn 'Run `bundle install` to install missing gems'
|
warn 'Run `bundle install` to install missing gems'
|
||||||
exit e.status_code
|
exit e.status_code
|
||||||
end
|
end
|
||||||
|
require 'algoliasearch'
|
||||||
require 'rake'
|
require 'rake'
|
||||||
|
require 'rspec/core'
|
||||||
|
require 'rspec/core/rake_task'
|
||||||
|
require 'rubocop/rake_task'
|
||||||
|
|
||||||
# LINT
|
# LINT
|
||||||
require 'rubocop/rake_task'
|
|
||||||
desc 'Check files for linting issues'
|
desc 'Check files for linting issues'
|
||||||
RuboCop::RakeTask.new(:lint) do |task|
|
RuboCop::RakeTask.new(:lint) do |task|
|
||||||
task.patterns = [
|
task.patterns = [
|
||||||
@ -26,8 +29,6 @@ RuboCop::RakeTask.new(:lint) do |task|
|
|||||||
end
|
end
|
||||||
|
|
||||||
# TEST
|
# TEST
|
||||||
require 'rspec/core'
|
|
||||||
require 'rspec/core/rake_task'
|
|
||||||
desc 'Run unit tests'
|
desc 'Run unit tests'
|
||||||
RSpec::Core::RakeTask.new(:test) do |task|
|
RSpec::Core::RakeTask.new(:test) do |task|
|
||||||
task.rspec_opts = '--color --format progress'
|
task.rspec_opts = '--color --format progress'
|
||||||
@ -70,6 +71,14 @@ namespace 'test' do
|
|||||||
task :watch do
|
task :watch do
|
||||||
puts 'Please, run ./scripts/test_integration_watch manually'
|
puts 'Please, run ./scripts/test_integration_watch manually'
|
||||||
end
|
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
|
task :_run do
|
||||||
end
|
end
|
||||||
task :_watch_run do
|
task :_watch_run do
|
||||||
|
|||||||
@ -1,7 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
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
|
cd ./spec/site
|
||||||
bundle install --quiet
|
bundle install --quiet
|
||||||
|
|
||||||
bundle exec jekyll build
|
bundle exec jekyll build
|
||||||
|
|
||||||
|
rake test:integration:_delete_index
|
||||||
bundle exec jekyll algolia
|
bundle exec jekyll algolia
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user