Sha256: b5fa4f0c2186fc116a22af9a514fd530b8755a1187d2412786a351fbbe4d5e60

Contents?: true

Size: 815 Bytes

Versions: 2

Compression:

Stored size: 815 Bytes

Contents

require 'spec_helper'

describe Crono::CronoJob do
  let(:valid_attrs) do
    {
      job_id: 'Perform TestJob every 3 days'
    }
  end

  it 'should validate presence of job_id' do
    @crono_job = Crono::CronoJob.new
    expect(@crono_job).not_to be_valid
    expect(@crono_job.errors.added?(:job_id, :blank)).to be true
  end

  it 'should validate uniqueness of job_id' do
    Crono::CronoJob.create!(job_id: 'TestJob every 2 days')
    @crono_job = Crono::CronoJob.create(job_id: 'TestJob every 2 days')
    expect(@crono_job).not_to be_valid
    expect(@crono_job.errors.added?(:job_id, :taken)).to be true
  end

  it 'should save job_id to DB' do
    Crono::CronoJob.create!(valid_attrs)
    @crono_job = Crono::CronoJob.find_by(job_id: valid_attrs[:job_id])
    expect(@crono_job).to be_present
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crono-0.8.1 spec/orm/active_record/crono_job_spec.rb
crono-0.8.0 spec/orm/active_record/crono_job_spec.rb