ardm 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/Gemfile +1 -2
- data/LICENSE +2 -2
- data/README.md +72 -16
- data/ardm.gemspec +1 -0
- data/lib/ardm.rb +2 -1
- data/lib/ardm/active_record.rb +8 -1
- data/lib/ardm/active_record/associations.rb +33 -4
- data/lib/ardm/active_record/base.rb +2 -0
- data/lib/ardm/active_record/collection.rb +5 -0
- data/lib/ardm/active_record/data_mapper_constant.rb +1 -0
- data/lib/ardm/active_record/data_mapper_constant_proxy.rb +24 -0
- data/lib/ardm/active_record/finalize.rb +18 -0
- data/lib/ardm/active_record/predicate_builder/array_handler.rb +10 -16
- data/lib/ardm/active_record/predicate_builder/rails3.rb +42 -15
- data/lib/ardm/active_record/predicate_builder/rails4.rb +39 -13
- data/lib/ardm/active_record/property.rb +24 -12
- data/lib/ardm/active_record/query.rb +9 -18
- data/lib/ardm/active_record/record.rb +54 -11
- data/lib/ardm/active_record/relation.rb +36 -6
- data/lib/ardm/active_record/repository.rb +6 -2
- data/lib/ardm/data_mapper.rb +2 -0
- data/lib/ardm/data_mapper/record.rb +3 -9
- data/lib/ardm/version.rb +1 -1
- data/spec/ardm/datamapper_constants_spec.rb +31 -0
- data/spec/fixtures/article.rb +2 -0
- data/spec/integration/api_key_spec.rb +3 -3
- data/spec/integration/bcrypt_hash_spec.rb +7 -7
- data/spec/integration/comma_separated_list_spec.rb +11 -11
- data/spec/integration/dirty_minder_spec.rb +23 -39
- data/spec/integration/enum_spec.rb +11 -11
- data/spec/integration/epoch_time_spec.rb +6 -6
- data/spec/integration/file_path_spec.rb +23 -23
- data/spec/integration/flag_spec.rb +11 -13
- data/spec/integration/ip_address_spec.rb +15 -15
- data/spec/integration/json_spec.rb +7 -7
- data/spec/integration/slug_spec.rb +6 -6
- data/spec/integration/uri_spec.rb +11 -11
- data/spec/integration/uuid_spec.rb +16 -16
- data/spec/integration/yaml_spec.rb +8 -8
- data/spec/public/model_spec.rb +193 -0
- data/spec/public/property/binary_spec.rb +4 -4
- data/spec/public/property/boolean_spec.rb +3 -3
- data/spec/public/property/class_spec.rb +2 -2
- data/spec/public/property/date_spec.rb +2 -2
- data/spec/public/property/date_time_spec.rb +2 -2
- data/spec/public/property/decimal_spec.rb +2 -2
- data/spec/public/property/discriminator_spec.rb +21 -20
- data/spec/public/property/float_spec.rb +2 -2
- data/spec/public/property/integer_spec.rb +2 -2
- data/spec/public/property/object_spec.rb +14 -13
- data/spec/public/property/serial_spec.rb +2 -2
- data/spec/public/property/string_spec.rb +2 -2
- data/spec/public/property/text_spec.rb +2 -2
- data/spec/public/property/time_spec.rb +2 -2
- data/spec/public/property_spec.rb +44 -48
- data/spec/public/resource_spec.rb +278 -0
- data/spec/schema.rb +33 -4
- data/spec/semipublic/property/boolean_spec.rb +5 -5
- data/spec/semipublic/property/class_spec.rb +3 -3
- data/spec/semipublic/property/date_spec.rb +8 -8
- data/spec/semipublic/property/date_time_spec.rb +9 -9
- data/spec/semipublic/property/decimal_spec.rb +16 -16
- data/spec/semipublic/property/float_spec.rb +16 -16
- data/spec/semipublic/property/integer_spec.rb +16 -16
- data/spec/semipublic/property/lookup_spec.rb +4 -4
- data/spec/semipublic/property/text_spec.rb +2 -2
- data/spec/semipublic/property/time_spec.rb +10 -10
- data/spec/semipublic/property_spec.rb +4 -4
- data/spec/shared/finder_shared_spec.rb +1151 -0
- data/spec/shared/flags_shared_spec.rb +6 -6
- data/spec/shared/identity_function_group.rb +1 -1
- data/spec/shared/public_property_spec.rb +26 -25
- data/spec/shared/resource_spec.rb +1218 -0
- data/spec/shared/semipublic_property_spec.rb +23 -22
- data/spec/spec_helper.rb +17 -0
- data/spec/unit/bcrypt_hash_spec.rb +15 -15
- data/spec/unit/csv_spec.rb +11 -11
- data/spec/unit/dirty_minder_spec.rb +3 -5
- data/spec/unit/enum_spec.rb +17 -17
- data/spec/unit/epoch_time_spec.rb +8 -8
- data/spec/unit/file_path_spec.rb +9 -9
- data/spec/unit/flag_spec.rb +9 -9
- data/spec/unit/ip_address_spec.rb +9 -9
- data/spec/unit/json_spec.rb +11 -11
- data/spec/unit/paranoid_boolean_spec.rb +19 -17
- data/spec/unit/paranoid_datetime_spec.rb +21 -19
- data/spec/unit/regexp_spec.rb +4 -4
- data/spec/unit/uri_spec.rb +8 -8
- data/spec/unit/yaml_spec.rb +9 -9
- metadata +35 -27
- data/lib/ardm/active_record/not_found.rb +0 -7
- data/lib/ardm/data_mapper/not_found.rb +0 -5
@@ -16,13 +16,13 @@ describe Ardm::Property::EpochTime do
|
|
16
16
|
describe 'with a Time instance' do
|
17
17
|
let(:value) { Time.now }
|
18
18
|
|
19
|
-
it {
|
19
|
+
it { is_expected.to eq(value.to_i) }
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'with nil' do
|
23
23
|
let(:value) { nil }
|
24
24
|
|
25
|
-
it {
|
25
|
+
it { is_expected.to eq(value) }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -32,25 +32,25 @@ describe Ardm::Property::EpochTime do
|
|
32
32
|
describe 'with a DateTime instance' do
|
33
33
|
let(:value) { DateTime.now }
|
34
34
|
|
35
|
-
it {
|
35
|
+
it { is_expected.to eq(Time.parse(value.to_s)) }
|
36
36
|
end
|
37
37
|
|
38
38
|
describe 'with a number' do
|
39
39
|
let(:value) { Time.now.to_i }
|
40
40
|
|
41
|
-
it {
|
41
|
+
it { is_expected.to eq(::Time.at(value)) }
|
42
42
|
end
|
43
43
|
|
44
44
|
describe 'with a numeric string' do
|
45
45
|
let(:value) { Time.now.to_i.to_s }
|
46
46
|
|
47
|
-
it {
|
47
|
+
it { is_expected.to eq(::Time.at(value.to_i)) }
|
48
48
|
end
|
49
49
|
|
50
50
|
describe 'with a DateTime string' do
|
51
51
|
let(:value) { '2011-07-11 15:00:04 UTC' }
|
52
52
|
|
53
|
-
it {
|
53
|
+
it { is_expected.to eq(::Time.parse(value)) }
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -60,13 +60,13 @@ describe Ardm::Property::EpochTime do
|
|
60
60
|
describe 'with a number' do
|
61
61
|
let(:value) { Time.now.to_i }
|
62
62
|
|
63
|
-
it {
|
63
|
+
it { is_expected.to eq(Time.at(value)) }
|
64
64
|
end
|
65
65
|
|
66
66
|
describe 'with nil' do
|
67
67
|
let(:value) { nil }
|
68
68
|
|
69
|
-
it {
|
69
|
+
it { is_expected.to eq(value) }
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
data/spec/unit/file_path_spec.rb
CHANGED
@@ -15,19 +15,19 @@ try_spec do
|
|
15
15
|
describe '.dump' do
|
16
16
|
describe 'when input is a string' do
|
17
17
|
it 'does not modify input' do
|
18
|
-
@property.dump(@input).
|
18
|
+
expect(@property.dump(@input)).to eq(@input)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'when input is nil' do
|
23
23
|
it 'returns nil' do
|
24
|
-
@property.dump(nil).
|
24
|
+
expect(@property.dump(nil)).to be_nil
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe 'when input is a blank string' do
|
29
29
|
it 'returns nil' do
|
30
|
-
@property.dump('').
|
30
|
+
expect(@property.dump('')).to be_nil
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -35,19 +35,19 @@ try_spec do
|
|
35
35
|
describe '.load' do
|
36
36
|
describe 'when value is a non-blank file path' do
|
37
37
|
it 'returns Pathname for a path' do
|
38
|
-
@property.load(@input).
|
38
|
+
expect(@property.load(@input)).to eq(@path)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe 'when value is nil' do
|
43
43
|
it 'return nil' do
|
44
|
-
@property.load(nil).
|
44
|
+
expect(@property.load(nil)).to be_nil
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe 'when value is a blank string' do
|
49
49
|
it 'returns nil' do
|
50
|
-
@property.load('').
|
50
|
+
expect(@property.load('')).to be_nil
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -55,19 +55,19 @@ try_spec do
|
|
55
55
|
describe '.typecast' do
|
56
56
|
describe 'when a Pathname is given' do
|
57
57
|
it 'does not modify input' do
|
58
|
-
@property.typecast(@path).
|
58
|
+
expect(@property.typecast(@path)).to eq(@path)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe 'when a nil is given' do
|
63
63
|
it 'does not modify input' do
|
64
|
-
@property.typecast(nil).
|
64
|
+
expect(@property.typecast(nil)).to eq(nil)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
describe 'when a string is given' do
|
69
69
|
it 'returns Pathname for given path' do
|
70
|
-
@property.typecast(@input).
|
70
|
+
expect(@property.typecast(@input)).to eq(@path)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
data/spec/unit/flag_spec.rb
CHANGED
@@ -20,7 +20,7 @@ try_spec do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns flag bit of value' do
|
23
|
-
@result.
|
23
|
+
expect(@result).to eq(1)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -30,7 +30,7 @@ try_spec do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'returns flag bit of value' do
|
33
|
-
@result.
|
33
|
+
expect(@result).to eq(2)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -40,7 +40,7 @@ try_spec do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'builds binary flag from key values of all matches' do
|
43
|
-
@result.
|
43
|
+
expect(@result).to eq(10)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -50,7 +50,7 @@ try_spec do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'builds binary flag from key values of all matches' do
|
53
|
-
@result.
|
53
|
+
expect(@result).to eq(31)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -60,7 +60,7 @@ try_spec do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'returns zero' do
|
63
|
-
@result.
|
63
|
+
expect(@result).to eq(0)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -70,7 +70,7 @@ try_spec do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'behaves the same as if there were no duplicates' do
|
73
|
-
@result.
|
73
|
+
expect(@result).to eq(@flag.dump([ :second, :fourth ]))
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -86,7 +86,7 @@ try_spec do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'returns array with a single matching element' do
|
89
|
-
@result.
|
89
|
+
expect(@result).to eq([ :tres ])
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -96,7 +96,7 @@ try_spec do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'returns array of matching values' do
|
99
|
-
@result.
|
99
|
+
expect(@result).to eq([ :dos, :cuatro ])
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -106,7 +106,7 @@ try_spec do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'returns an empty array' do
|
109
|
-
@result.
|
109
|
+
expect(@result).to eq([])
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
@@ -17,7 +17,7 @@ try_spec do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'dumps input into a string' do
|
20
|
-
@result.
|
20
|
+
expect(@result).to eq(@stored)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -27,7 +27,7 @@ try_spec do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'returns nil' do
|
30
|
-
@result.
|
30
|
+
expect(@result).to be_nil
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -37,7 +37,7 @@ try_spec do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'retuns a blank string' do
|
40
|
-
@result.
|
40
|
+
expect(@result).to eq('')
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -49,7 +49,7 @@ try_spec do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'returns IPAddr instance from stored value' do
|
52
|
-
@result.
|
52
|
+
expect(@result).to eq(@input)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -59,7 +59,7 @@ try_spec do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'returns nil' do
|
62
|
-
@result.
|
62
|
+
expect(@result).to be_nil
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -69,7 +69,7 @@ try_spec do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'returns IPAddr instance from stored value' do
|
72
|
-
@result.
|
72
|
+
expect(@result).to eq(IPAddr.new('0.0.0.0'))
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -79,7 +79,7 @@ try_spec do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'raises ArgumentError with a meaningful message' do
|
82
|
-
@operation.
|
82
|
+
expect(@operation).to raise_error(ArgumentError, '+value+ must be nil or a String')
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -91,7 +91,7 @@ try_spec do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'does not change the value' do
|
94
|
-
@result.
|
94
|
+
expect(@result).to eq(@input)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -101,7 +101,7 @@ try_spec do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'instantiates IPAddr instance' do
|
104
|
-
@result.
|
104
|
+
expect(@result).to eq(@input)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
data/spec/unit/json_spec.rb
CHANGED
@@ -13,21 +13,21 @@ try_spec do
|
|
13
13
|
describe '.load' do
|
14
14
|
describe 'when nil is provided' do
|
15
15
|
it 'returns nil' do
|
16
|
-
@property.load(nil).
|
16
|
+
expect(@property.load(nil)).to be_nil
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
describe 'when Json encoded primitive string is provided' do
|
21
21
|
it 'returns decoded value as Ruby string' do
|
22
|
-
@property.load(MultiJson.dump(:value => 'JSON encoded string')).
|
22
|
+
expect(@property.load(MultiJson.dump(:value => 'JSON encoded string'))).to eq({ 'value' => 'JSON encoded string' })
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe 'when something else is provided' do
|
27
27
|
it 'raises ArgumentError with a meaningful message' do
|
28
|
-
|
28
|
+
expect {
|
29
29
|
@property.load(:sym)
|
30
|
-
}.
|
30
|
+
}.to raise_error(ArgumentError, '+value+ of a property of JSON type must be nil or a String')
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -35,32 +35,32 @@ try_spec do
|
|
35
35
|
describe '.dump' do
|
36
36
|
describe 'when nil is provided' do
|
37
37
|
it 'returns nil' do
|
38
|
-
@property.dump(nil).
|
38
|
+
expect(@property.dump(nil)).to be_nil
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe 'when Json encoded primitive string is provided' do
|
43
43
|
it 'does not do double encoding' do
|
44
|
-
@property.dump('Json encoded string').
|
44
|
+
expect(@property.dump('Json encoded string')).to eq('Json encoded string')
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe 'when regular Ruby string is provided' do
|
49
49
|
it 'dumps argument to Json' do
|
50
|
-
@property.dump('dump me (to JSON)').
|
50
|
+
expect(@property.dump('dump me (to JSON)')).to eq('dump me (to JSON)')
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
describe 'when Ruby array is provided' do
|
55
55
|
it 'dumps argument to Json' do
|
56
|
-
@property.dump([1, 2, 3]).
|
56
|
+
expect(@property.dump([1, 2, 3])).to eq('[1,2,3]')
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
describe 'when Ruby hash is provided' do
|
61
61
|
it 'dumps argument to Json' do
|
62
|
-
@property.dump({ :datamapper => 'Data access layer in Ruby' }).
|
63
|
-
|
62
|
+
expect(@property.dump({ :datamapper => 'Data access layer in Ruby' })).
|
63
|
+
to eq('{"datamapper":"Data access layer in Ruby"}')
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -108,7 +108,7 @@ try_spec do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
it 'decodes value from JSON' do
|
111
|
-
@result.
|
111
|
+
expect(@result).to eq({ 'value' => 11 })
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -5,6 +5,7 @@ module ::ParanoidBooleanBlog
|
|
5
5
|
self.table_name = "articles"
|
6
6
|
property :id, Serial
|
7
7
|
property :deleted, ParanoidBoolean
|
8
|
+
timestamps :at
|
8
9
|
|
9
10
|
before_destroy :before_destroy
|
10
11
|
|
@@ -30,16 +31,16 @@ describe Ardm::Property::ParanoidBoolean do
|
|
30
31
|
end
|
31
32
|
|
32
33
|
it 'should not delete the resource from the datastore' do
|
33
|
-
method(:subject).
|
34
|
+
expect(method(:subject)).not_to change { @model.with_deleted.size }.from(0)
|
34
35
|
end
|
35
36
|
|
36
37
|
it 'should not set the paranoid column' do
|
37
|
-
method(:subject).
|
38
|
+
expect(method(:subject)).not_to change { @resource.deleted }.from(false)
|
38
39
|
end
|
39
40
|
|
40
41
|
it 'should run the destroy hook' do
|
41
42
|
# NOTE: changed behavior because AR doesn't call hooks on destroying new objects
|
42
|
-
@resource.
|
43
|
+
expect(@resource).not_to receive(:before_destroy).with(no_args)
|
43
44
|
subject
|
44
45
|
end
|
45
46
|
end
|
@@ -49,18 +50,18 @@ describe Ardm::Property::ParanoidBoolean do
|
|
49
50
|
@resource = @model.create
|
50
51
|
end
|
51
52
|
|
52
|
-
it { (!!subject).
|
53
|
+
it { expect(!!subject).to be true }
|
53
54
|
|
54
55
|
it 'should not delete the resource from the datastore' do
|
55
|
-
method(:subject).
|
56
|
+
expect(method(:subject)).not_to change { @model.with_deleted.size }.from(1)
|
56
57
|
end
|
57
58
|
|
58
59
|
it 'should set the paranoid column' do
|
59
|
-
method(:subject).
|
60
|
+
expect(method(:subject)).to change { @resource.deleted }.from(false).to(true)
|
60
61
|
end
|
61
62
|
|
62
63
|
it 'should run the destroy hook' do
|
63
|
-
@resource.
|
64
|
+
expect(@resource).to receive(:before_destroy).with(no_args)
|
64
65
|
subject
|
65
66
|
end
|
66
67
|
end
|
@@ -75,15 +76,15 @@ describe Ardm::Property::ParanoidBoolean do
|
|
75
76
|
end
|
76
77
|
|
77
78
|
it 'should not delete the resource from the datastore' do
|
78
|
-
method(:subject).
|
79
|
+
expect(method(:subject)).not_to change { @model.with_deleted.size }.from(0)
|
79
80
|
end
|
80
81
|
|
81
82
|
it 'should not set the paranoid column' do
|
82
|
-
method(:subject).
|
83
|
+
expect(method(:subject)).not_to change { @resource.deleted }.from(false)
|
83
84
|
end
|
84
85
|
|
85
86
|
it 'should not run the destroy hook' do
|
86
|
-
@resource.
|
87
|
+
expect(@resource).not_to receive(:before_destroy).with(no_args)
|
87
88
|
subject
|
88
89
|
end
|
89
90
|
end
|
@@ -93,18 +94,18 @@ describe Ardm::Property::ParanoidBoolean do
|
|
93
94
|
@resource = @model.create
|
94
95
|
end
|
95
96
|
|
96
|
-
it { (!!subject).
|
97
|
+
it { expect(!!subject).to be true }
|
97
98
|
|
98
99
|
it 'should delete the resource from the datastore' do
|
99
|
-
method(:subject).
|
100
|
+
expect(method(:subject)).to change { @model.with_deleted.size }.from(1).to(0)
|
100
101
|
end
|
101
102
|
|
102
103
|
it 'should not set the paranoid column' do
|
103
|
-
method(:subject).
|
104
|
+
expect(method(:subject)).not_to change { @resource.deleted }.from(false)
|
104
105
|
end
|
105
106
|
|
106
107
|
it 'should not run the destroy hook' do
|
107
|
-
@resource.
|
108
|
+
expect(@resource).not_to receive(:before_destroy).with(no_args)
|
108
109
|
subject
|
109
110
|
end
|
110
111
|
end
|
@@ -120,7 +121,7 @@ describe Ardm::Property::ParanoidBoolean do
|
|
120
121
|
subject { @model.with_deleted { @model.all } }
|
121
122
|
|
122
123
|
it 'should scope the block to return all resources' do
|
123
|
-
subject.map { |resource| resource.key }.
|
124
|
+
expect(subject.map { |resource| resource.key }).to eq([ @resource.key ])
|
124
125
|
end
|
125
126
|
end
|
126
127
|
|
@@ -128,15 +129,16 @@ describe Ardm::Property::ParanoidBoolean do
|
|
128
129
|
subject { @model.with_deleted }
|
129
130
|
|
130
131
|
it 'should return a collection scoped to return all resources' do
|
131
|
-
subject.map { |resource| resource.key }.
|
132
|
+
expect(subject.map { |resource| resource.key }).to eq([ @resource.key ])
|
132
133
|
end
|
133
134
|
end
|
134
135
|
end
|
135
136
|
|
136
137
|
describe 'Model.inherited' do
|
137
138
|
it 'sets @paranoid_properties' do
|
138
|
-
::ParanoidBooleanBlog::Review.instance_variable_get(:@paranoid_properties).
|
139
|
+
expect(::ParanoidBooleanBlog::Review.instance_variable_get(:@paranoid_properties)).to eq(
|
139
140
|
::ParanoidBooleanBlog::Article.instance_variable_get(:@paranoid_properties)
|
141
|
+
)
|
140
142
|
end
|
141
143
|
end
|
142
144
|
end
|