Skip to content

Commit

Permalink
Merge 890ece5 into a53b1d8
Browse files Browse the repository at this point in the history
  • Loading branch information
ldlsegovia committed Sep 26, 2018
2 parents a53b1d8 + 890ece5 commit 3324954
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

### Unreleased

##### Added

- Allow jobs without owner.

### v1.4.0

##### Changed
Expand Down
2 changes: 1 addition & 1 deletion lib/job_notifier/notifier.rb
Expand Up @@ -27,7 +27,7 @@ def save_success_feedback(data)
raise JobNotifier::Error::InvalidIdentifier.new if identifier.blank?

JobNotifier::Job.create!(
identifier: identifier,
identifier: (identifier.to_sym == :without_owner ? nil : identifier),
job_id: job.job_id,
job_class: self.class.name
)
Expand Down
17 changes: 17 additions & 0 deletions spec/lib/job_notifier/notifier_spec.rb
Expand Up @@ -106,6 +106,23 @@ def perform_with_feedback(_param1, _param2)
expect(job.status).to eq("failed")
end
end

context "with no owner" do
before do
class ImageUploadJob < ActiveJob::Base
def perform_with_feedback
"photo loaded!"
end
end

ImageUploadJob.perform_later("without_owner")
@job = JobNotifier::Job.last
end

it { expect(@job.job_id).not_to be_nil }
it { expect(@job.identifier).to be_nil }
it { expect(@job.job_class).to eq("ImageUploadJob") }
end
end

context "without defining perform_with_feedback" do
Expand Down

0 comments on commit 3324954

Please sign in to comment.