jobs_helper_spec.rb 850 B

1234567891011121314151617181920212223242526272829303132
  1. require 'spec_helper'
  2. describe JobsHelper do
  3. let(:job) { Delayed::Job.new }
  4. describe '#status' do
  5. it "works for failed jobs" do
  6. job.failed_at = Time.now
  7. status(job).should == '<span class="label label-danger">failed</span>'
  8. end
  9. it "works for running jobs" do
  10. job.locked_at = Time.now
  11. job.locked_by = 'test'
  12. status(job).should == '<span class="label label-info">running</span>'
  13. end
  14. it "works for queued jobs" do
  15. status(job).should == '<span class="label label-warning">queued</span>'
  16. end
  17. end
  18. describe '#relative_distance_of_time_in_words' do
  19. it "in the past" do
  20. relative_distance_of_time_in_words(Time.now-5.minutes).should == '5m ago'
  21. end
  22. it "in the future" do
  23. relative_distance_of_time_in_words(Time.now+5.minutes).should == 'in 5m'
  24. end
  25. end
  26. end