kakurenbo 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,60 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Kakurenbo::SoftDeleteCore::Scopes do
4
- create_temp_table(:paranoid_models){ |t| t.datetime :deleted_at }
5
-
6
- before :each do
7
- class ParanoidModel < ActiveRecord::Base; end
8
- end
9
-
10
- after :each do
11
- Object.class_eval{ remove_const :ParanoidModel }
12
- end
13
-
14
- context 'when call scope of' do
15
- before :each do
16
- @existing_model = ParanoidModel.create!
17
- @deleted_model = ParanoidModel.create!(deleted_at: Time.now)
18
- end
19
-
20
- context 'default_scope' do
21
- it 'show existing model.' do
22
- expect(ParanoidModel.find_by(id: @existing_model.id)).not_to be_nil
23
- end
24
-
25
- it 'hide deleted model.' do
26
- expect(ParanoidModel.find_by(id: @deleted_model.id)).to be_nil
27
- end
28
- end
29
-
30
- context 'only_deleted' do
31
- it 'hide existing model.' do
32
- expect(ParanoidModel.only_deleted.find_by(id: @existing_model.id)).to be_nil
33
- end
34
-
35
- it 'show deleted model.' do
36
- expect(ParanoidModel.only_deleted.find_by(@deleted_model.id)).not_to be_nil
37
- end
38
- end
39
-
40
- context 'with_deleted' do
41
- it 'show existing model.' do
42
- expect(ParanoidModel.with_deleted.find_by(id: @existing_model.id)).not_to be_nil
43
- end
44
-
45
- it 'show deleted model.' do
46
- expect(ParanoidModel.with_deleted.find_by(@deleted_model.id)).not_to be_nil
47
- end
48
- end
49
-
50
- context 'without_deleted' do
51
- it 'show existing model.' do
52
- expect(ParanoidModel.without_deleted.find_by(id: @existing_model.id)).not_to be_nil
53
- end
54
-
55
- it 'hide deleted model.' do
56
- expect(ParanoidModel.without_deleted.find_by(id: @deleted_model.id)).to be_nil
57
- end
58
- end
59
- end
60
- end