Sha256: 88540a2246bd42efd646c86bc843774244f7341a7ba499d2679ab47214374e35

Contents?: true

Size: 774 Bytes

Versions: 9

Compression:

Stored size: 774 Bytes

Contents

require "spec_helper"

describe Que::Web::Viewmodels::Job do
  let(:source_job) {
    {"priority"=>100, "run_at"=> Time.now - 3600,
     "job_id"=>555, "job_class"=>"SuccessJob",
     "args"=>["arg1", {"name"=>"foo", "age"=>10}],
     "error_count"=>0,
     "last_error"=>nil,
     "queue"=>"foo"
    }
  }
  let(:subject) { Que::Web::Viewmodels::Job.new(source_job) }

  it 'maps fields from source' do
    subject.priority.must_equal source_job["priority"]
    subject.queue.must_equal source_job["queue"]
  end

  describe 'schedule' do
    it 'is past due when run_at is behind' do
      subject.must_be :past_due?
    end

    it 'is not past due when run_at is ahead of now' do
      subject.run_at = Time.now + 3600
      subject.wont_be :past_due?
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
que-web-0.7.2 spec/viewmodels/job_spec.rb
que-web-0.7.1 spec/viewmodels/job_spec.rb
que-web-0.7.0 spec/viewmodels/job_spec.rb
que-web-0.6.3 spec/viewmodels/job_spec.rb
que-web-0.6.2 spec/viewmodels/job_spec.rb
que-web-0.6.1 spec/viewmodels/job_spec.rb
que-web-0.6.0 spec/viewmodels/job_spec.rb
que-web-0.5.0 spec/viewmodels/job_spec.rb
que-web-0.4.0 spec/viewmodels/job_spec.rb