diff --git a/README.md b/README.md index 628ec6f5..c9ef149b 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ bundle install 1. For development: - `bundle exec rails server` - Access bibdata at http://localhost:3000/ + - If you will be working with background jobs in development, include your netid so you are recognized as an admin `BIBDATA_ADMIN_NETIDS=yournetid bundle exec rails server` 1. If you are working with background jobs in development, start sidekiq in a new tab or window - `bundle exec sidekiq` - To access the sidekiq dashboard, first sign into the application, then go to http://localhost:3000/sidekiq diff --git a/spec/jobs/dump_file_index_job_spec.rb b/spec/jobs/dump_file_index_job_spec.rb index 526dcef4..0f9c9b41 100644 --- a/spec/jobs/dump_file_index_job_spec.rb +++ b/spec/jobs/dump_file_index_job_spec.rb @@ -1,11 +1,14 @@ require 'rails_helper' RSpec.describe DumpFileIndexJob do + let(:dump) { FactoryBot.create(:incremental_dump) } + let(:dump_file_id) { dump.dump_files.first.id } describe "#perform" do it "raises an error when traject errors" do - dump = FactoryBot.create(:incremental_dump) - - expect { described_class.new.perform(dump.dump_files.first.id, "http://localhost:8983/solr/badcollection") }.to raise_error + expect { described_class.new.perform(dump_file_id, "http://localhost:8983/solr/badcollection") }.to raise_error end end + it 'enqueues the job once' do + expect { described_class.perform_async(dump_file_id, '') }.to change(described_class.jobs, :size).by(1) + end end