forked from tobi/delayed_job
/
datamapper_job_spec.rb
54 lines (44 loc) · 996 Bytes
/
datamapper_job_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'spec_helper'
require 'delayed/backend/datamapper'
DataMapper.logger = ActiveRecord::Base.logger
DataMapper.setup(:default, "sqlite3::memory:")
module Delayed
module Backend
module DataMapper
class Job
def self.find id
get id
end
def update_attributes(attributes)
self.update attributes
self.save
end
end
end
end
end
describe Delayed::Backend::DataMapper::Job do
before(:all) do
@backend = Delayed::Backend::DataMapper::Job
end
before(:each) do
# reset database before each example is run
DataMapper.auto_migrate!
end
it_should_behave_like 'a backend'
describe "delayed method" do
class DMStoryReader
def read(story)
"Epilog: #{story.tell}"
end
end
class DMStory
include DataMapper::Resource
property :id, Serial
property :text, String
def tell
text
end
end
end
end