Skip to content

Commit

Permalink
Merge pull request #317 from ifad/chore/fix-specs
Browse files Browse the repository at this point in the history
Improve specs
  • Loading branch information
tagliala authored Sep 27, 2024
2 parents f83f89f + 6730232 commit 3e54473
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spec/integration/standard_tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe 'Standard Heathen tasks:' do
before do
setup_storage
allow(Colore::C_.config).to receive(:storage_directory) { tmp_storage_dir }
allow(Colore::C_.config).to receive(:storage_directory).and_return(tmp_storage_dir)
end

after do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def show_backtrace(response)

before do
setup_storage
allow(Colore::C_.config).to receive(:storage_directory) { tmp_storage_dir }
allow(Colore::C_.config).to receive(:storage_directory).and_return(tmp_storage_dir)
allow(Colore::Sidekiq::ConversionWorker).to receive(:perform_async)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/colore/sidekiq/callback_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

before do
setup_storage
allow(Colore::C_.config).to receive(:storage_directory) { tmp_storage_dir }
allow(Colore::C_.config).to receive(:storage_directory).and_return(tmp_storage_dir)
end

after do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/colore/sidekiq/legacy_purge_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe Colore::Sidekiq::LegacyPurgeWorker do
before do
setup_storage
allow(Colore::C_.config).to receive(:storage_directory) { tmp_storage_dir }
allow(Colore::C_.config).to receive(:storage_directory).and_return(tmp_storage_dir)
allow(Colore::C_.config).to receive(:legacy_purge_days).and_return(2)
end

Expand Down
11 changes: 9 additions & 2 deletions spec/lib/converter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
let(:new_filename) { 'arglebargle.txt' }
let(:converter) { described_class.new }
let(:document) { Colore::Document.load storage_dir, doc_key }
let(:stubbed_converter) { instance_double(Heathen::Converter, convert: "The quick brown fox") }

before do
setup_storage
allow(Colore::C_.config).to receive(:storage_directory) { tmp_storage_dir }
stubbed_converter = instance_double(Heathen::Converter, convert: "The quick brown fox")
allow(Colore::C_.config).to receive(:storage_directory).and_return(tmp_storage_dir)
allow(Heathen::Converter).to receive(:new).and_return(stubbed_converter)
end

Expand All @@ -30,5 +30,12 @@
expect(content_type).to eq 'text/plain; charset=us-ascii'
expect(content.to_s).to eq 'The quick brown fox'
end

context 'with Arabic language' do
it 'sets language to Heathen' do
converter.convert(doc_key, version, filename, action, 'ar')
expect(stubbed_converter).to have_received(:convert).with(action, an_instance_of(String), 'ar')
end
end
end
end
2 changes: 1 addition & 1 deletion spec/lib/legacy_converter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

before do
setup_storage
allow(Colore::C_.config).to receive(:storage_directory) { tmp_storage_dir }
allow(Colore::C_.config).to receive(:storage_directory).and_return(tmp_storage_dir)
stubbed_converter = instance_double(Heathen::Converter, convert: "The quick brown fox")
allow(Heathen::Converter).to receive(:new).and_return(stubbed_converter)
end
Expand Down

0 comments on commit 3e54473

Please sign in to comment.