Sha256: 0774ba57ca015ecf6cd723a9a40f2b2fed0a235f667679f7eba0bd3cd2a48b4b

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Quebert::Job do
  
  before(:all) do
    Adder.backend = @q = Quebert::Backend::InProcess.new
  end

  it "should raise not implemented on base job" do
    lambda {
      Job.new.perform
    }.should raise_exception(Quebert::Job::NotImplemented)
  end
  
  it "should convert job to and from JSON" do
    args = [1,2,3]
    serialized = Adder.new(args).to_json
    unserialized = Adder.from_json(serialized)
    unserialized.should be_instance_of(Adder)
    unserialized.args.should eql(args)
  end
  
  context "actions" do
    it "should raise release" do
      lambda{
        ReleaseJob.new.perform
      }.should raise_exception(Job::Release)
    end
    
    it "should raise delete" do
      lambda{
        DeleteJob.new.perform
      }.should raise_exception(Job::Delete)
    end
    
    it "should raise bury" do
      lambda{
        BuryJob.new.perform
      }.should raise_exception(Job::Bury)
    end
  end
  
  
  context "job queue" do
    it "should enqueue" do
      lambda{
        Adder.enqueue(1,2,3)
      }.should change(@q, :size).by(1)
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
quebert-0.0.4 spec/job_spec.rb
quebert-0.0.3 spec/job_spec.rb
quebert-0.0.1 spec/job_spec.rb
quebert-0.0.0 spec/job_spec.rb