leonardo-bridge 0.4.3 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RedisModel do
4
- subject { RedisModel.new }
5
-
6
- describe '#persist!' do
7
- before { subject.persist! }
8
- it { subject.id.should eq(1) }
9
- it "should not alter existing id" do
10
- subject.persist!
11
- subject.id.should eq(1)
12
- end
13
- it { $redis.hgetall(subject.id).should be_a(Hash) }
14
- end
15
-
16
- describe '#load' do
17
- before { subject.persist! }
18
-
19
- it { RedisModel.load(subject.id).should be_a(RedisModel) }
20
- it { RedisModel.load(subject.id).should eq(subject) }
21
-
22
- it 'should have_timestamps disabled by default' do
23
- expect { subject.created_at }.to raise_error
24
- expect { subject.updated_at }.to raise_error
25
- end
26
- end
27
-
28
- describe '#all' do
29
- before { 5.times { RedisModel.new.persist! } }
30
- subject { RedisModel }
31
-
32
- it { subject.all.should be_a(Array) }
33
- it { subject.all.size.should eq(5) }
34
- end
35
-
36
- describe 'descendant classes' do
37
- subject { TestModel.new }
38
-
39
- before { subject.persist! }
40
-
41
- it 'should have_timestamps' do
42
- expect { subject.created_at }.to_not raise_error
43
- expect { subject.updated_at }.to_not raise_error
44
- end
45
- it { subject.created_at.should_not eq(nil) }
46
- it { subject.updated_at.should_not eq(nil) }
47
-
48
- it { TestModel.load(subject.id).id.should eq(subject.id) }
49
- end
50
- end
@@ -1,3 +0,0 @@
1
- class TestModel < RedisModel
2
- use_timestamps
3
- end