Skip to content

Commit

Permalink
Add tests for a job that does not raise
Browse files Browse the repository at this point in the history
  • Loading branch information
imjoehaines committed Aug 19, 2021
1 parent 444c8d6 commit a1daac7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 4 deletions.
23 changes: 23 additions & 0 deletions features/fixtures/rails_integrations/app/app/jobs/working_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class WorkingJob < ApplicationJob
self.queue_adapter = ENV['ACTIVE_JOB_QUEUE_ADAPTER'].to_sym

def perform
do_stuff

more_stuff

success!
end

def do_stuff
'beep boop'
end

def more_stuff
'boop beep'
end

def success!
'yay'
end
end
40 changes: 36 additions & 4 deletions features/rails_features/integrations.feature
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Scenario: Sidekiq
And the event "metaData.sidekiq.queue" equals "default"

@rails_integrations
Scenario: Using Sidekiq as the Active Job queue adapter
Scenario: Using Sidekiq as the Active Job queue adapter for a job that raises
When I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "sidekiq"
And I run "bundle exec sidekiq" in the rails app
And I run "UnhandledJob.perform_later(1, yes: true)" with the rails runner
Expand All @@ -150,7 +150,7 @@ Scenario: Using Sidekiq as the Active Job queue adapter
And the event "metaData.sidekiq.queue" equals "default"

@rails_integrations
Scenario: Using Rescue as the Active Job queue adapter
Scenario: Using Rescue as the Active Job queue adapter for a job that raises
When I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "resque"
And I run "bundle exec rake resque:work" in the rails app
And I run "UnhandledJob.perform_later(1, yes: true)" with the rails runner
Expand All @@ -171,7 +171,7 @@ Scenario: Using Rescue as the Active Job queue adapter
And the event "metaData.payload.args.0.queue_name" equals "default"

@rails_integrations
Scenario: Using Que as the Active Job queue adapter
Scenario: Using Que as the Active Job queue adapter for a job that raises
When I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "que"
And I run "bundle exec que -q default ./config/environment.rb" in the rails app
And I run "UnhandledJob.perform_later(1, yes: true)" with the rails runner
Expand All @@ -192,7 +192,7 @@ Scenario: Using Que as the Active Job queue adapter
And the event "metaData.job.queue" equals "default"

@rails_integrations
Scenario: Using Delayed Job as the Active Job queue adapter
Scenario: Using Delayed Job as the Active Job queue adapter for a job that raises
When I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "delayed_job"
And I run the "jobs:work" rake task in the rails app
And I run "UnhandledJob.perform_later(1, yes: true)" with the rails runner
Expand All @@ -211,3 +211,35 @@ Scenario: Using Delayed Job as the Active Job queue adapter
And the event "metaData.job.payload.arguments.0" equals 1
And the event "metaData.job.payload.arguments.1.yes" is true
And the event "metaData.job.queue" equals "default"

@rails_integrations
Scenario: Using Sidekiq as the Active Job queue adapter for a job that works
When I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "sidekiq"
And I run "bundle exec sidekiq" in the rails app
And I run "WorkingJob.perform_later" with the rails runner
And I wait for 10 seconds
Then I should receive no requests

@rails_integrations
Scenario: Using Rescue as the Active Job queue adapter for a job that works
When I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "resque"
And I run "bundle exec rake resque:work" in the rails app
And I run "WorkingJob.perform_later" with the rails runner
And I wait for 10 seconds
Then I should receive no requests

@rails_integrations
Scenario: Using Que as the Active Job queue adapter for a job that works
When I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "que"
And I run "bundle exec que -q default ./config/environment.rb" in the rails app
And I run "WorkingJob.perform_later" with the rails runner
And I wait for 10 seconds
Then I should receive no requests

@rails_integrations
Scenario: Using Delayed Job as the Active Job queue adapter for a job that works
When I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "delayed_job"
And I run the "jobs:work" rake task in the rails app
And I run "WorkingJob.perform_later" with the rails runner
And I wait for 10 seconds
Then I should receive no requests

0 comments on commit a1daac7

Please sign in to comment.