Merge pull request #2306 from betagouv/improve-tests
Améliorations sur les tests
This commit is contained in:
commit
5cc59bc5e7
2 changed files with 11 additions and 4 deletions
|
@ -1,12 +1,16 @@
|
|||
require 'rails_helper'
|
||||
include ActiveJob::TestHelper
|
||||
|
||||
RSpec.describe ApplicationJob, type: :job, skip: true do
|
||||
RSpec.describe ApplicationJob, type: :job do
|
||||
describe 'perform' do
|
||||
it do
|
||||
expect(Rails.logger).to receive(:info).with(/.+started at.+/)
|
||||
expect(Rails.logger).to receive(:info).with(/.+ended at.+/)
|
||||
before do
|
||||
allow(Rails.logger).to receive(:info)
|
||||
end
|
||||
|
||||
it 'logs start time and end time' do
|
||||
perform_enqueued_jobs { ChildJob.perform_later }
|
||||
expect(Rails.logger).to have_received(:info).with(/started at/).once
|
||||
expect(Rails.logger).to have_received(:info).with(/ended at/).once
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -118,6 +118,9 @@ RSpec.configure do |config|
|
|||
config.filter_run :focus => true
|
||||
|
||||
config.order = 'random'
|
||||
# Fix the seed not changing between runs when using Spring
|
||||
# See https://github.com/rails/spring/issues/113
|
||||
config.seed = srand % 0xFFFF unless ARGV.any? { |arg| arg =~ /seed/ || arg =~ /rand:/ }
|
||||
|
||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
config.include Devise::Test::ControllerHelpers, type: :view
|
||||
|
|
Loading…
Reference in a new issue