Skip to content

Commit

Permalink
Merge pull request #280 from ondrejbartas/revert-246-empty-file
Browse files Browse the repository at this point in the history
Revert "Check its an hash on load from hash to avoid errors"
  • Loading branch information
ondrejbartas committed Apr 3, 2020
2 parents 409f11e + 0e2328c commit 7ca90f9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
2 changes: 0 additions & 2 deletions lib/sidekiq/cron/job.rb
Expand Up @@ -150,7 +150,6 @@ def active_job_message
# }
#
def self.load_from_hash hash
return [] unless hash.is_a?(Hash)
array = hash.inject([]) do |out,(key, job)|
job['name'] = key
out << job
Expand All @@ -161,7 +160,6 @@ def self.load_from_hash hash
# like to {#load_from_hash}
# If exists old jobs in redis but removed from args, destroy old jobs
def self.load_from_hash! hash
return [] unless hash.is_a?(Hash)
destroy_removed_jobs(hash.keys)
load_from_hash(hash)
end
Expand Down
14 changes: 0 additions & 14 deletions test/unit/job_test.rb
Expand Up @@ -955,20 +955,6 @@
assert_equal out.size, 0, "should have no errors"
assert_equal Sidekiq::Cron::Job.all.size, 2, "Should have 2 jobs after load"
end

describe 'errors' do
describe 'not a hash' do
before do
@jobs_hash = YAML.load_file('/dev/null') # => false
end

it 'do not create jobs and do not fail' do
assert_equal Sidekiq::Cron::Job.all.size, 0, "Should have 0 jobs before load"
out = Sidekiq::Cron::Job.load_from_hash! @jobs_hash
assert_equal out.size, 0, "should have no errors"
end
end
end
end

describe "from array" do
Expand Down

0 comments on commit 7ca90f9

Please sign in to comment.