persistence 0.0.1.alpha → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/README.md +260 -17
- data/lib/namespaces.rb +55 -0
- data/lib/persistence.rb +38 -3
- data/lib/persistence/adapter/abstract.rb +22 -0
- data/lib/persistence/adapter/abstract/enable_disable.rb +107 -0
- data/lib/persistence/adapter/abstract/primary_key/id_property_string.rb +33 -0
- data/lib/persistence/adapter/abstract/primary_key/simple.rb +29 -0
- data/lib/persistence/adapter/mock.rb +9 -0
- data/lib/persistence/adapter/mock/adapter_interface.rb +102 -0
- data/lib/persistence/adapter/mock/bucket.rb +9 -0
- data/lib/persistence/adapter/mock/bucket/bucket_interface.rb +260 -0
- data/lib/persistence/adapter/mock/bucket/index.rb +9 -0
- data/lib/persistence/adapter/mock/bucket/index/index_interface.rb +155 -0
- data/lib/persistence/adapter/mock/cursor.rb +9 -0
- data/lib/persistence/adapter/mock/cursor/cursor_interface.rb +238 -0
- data/lib/persistence/cursor.rb +11 -0
- data/lib/persistence/cursor/atomic.rb +110 -0
- data/lib/persistence/cursor/cursor_interface.rb +337 -0
- data/lib/persistence/exception/block_required.rb +7 -0
- data/lib/persistence/exception/conflicting_index_already_declared.rb +7 -0
- data/lib/persistence/exception/duplicate_violates_unique_index.rb +7 -0
- data/lib/persistence/exception/explicit_index_required.rb +7 -0
- data/lib/persistence/exception/indexing_block_failed_to_generate_keys.rb +7 -0
- data/lib/persistence/exception/indexing_object_requires_keys.rb +7 -0
- data/lib/persistence/exception/key_value_required.rb +7 -0
- data/lib/persistence/exception/no_port_enabled.rb +7 -0
- data/lib/persistence/object.rb +21 -0
- data/lib/persistence/object/autodetermine.rb +74 -0
- data/lib/persistence/object/class_instance.rb +1884 -0
- data/lib/persistence/object/complex.rb +17 -0
- data/lib/persistence/object/complex/array.rb +14 -0
- data/lib/persistence/object/complex/array/class_instance.rb +37 -0
- data/lib/persistence/object/complex/array/object_instance.rb +54 -0
- data/lib/persistence/object/complex/attributes.rb +1808 -0
- data/lib/persistence/object/complex/attributes/attributes_array.rb +32 -0
- data/lib/persistence/object/complex/attributes/attributes_hash.rb +187 -0
- data/lib/persistence/object/complex/attributes/default_atomic_non_atomic.rb +102 -0
- data/lib/persistence/object/complex/attributes/hash_to_port.rb +40 -0
- data/lib/persistence/object/complex/class_and_object_instance.rb +132 -0
- data/lib/persistence/object/complex/class_instance.rb +267 -0
- data/lib/persistence/object/complex/complex_object.rb +111 -0
- data/lib/persistence/object/complex/hash.rb +14 -0
- data/lib/persistence/object/complex/hash/class_instance.rb +40 -0
- data/lib/persistence/object/complex/hash/object_instance.rb +63 -0
- data/lib/persistence/object/complex/index/attribute_index.rb +10 -0
- data/lib/persistence/object/complex/index/attribute_index/attribute_index_interface.rb +43 -0
- data/lib/persistence/object/complex/object_instance.rb +469 -0
- data/lib/persistence/object/flat.rb +17 -0
- data/lib/persistence/object/flat/class_instance.rb +34 -0
- data/lib/persistence/object/flat/file.rb +14 -0
- data/lib/persistence/object/flat/file/class_instance.rb +122 -0
- data/lib/persistence/object/flat/file/contents.rb +7 -0
- data/lib/persistence/object/flat/file/file_persistence.rb +147 -0
- data/lib/persistence/object/flat/file/object_instance.rb +116 -0
- data/lib/persistence/object/flat/file/path.rb +9 -0
- data/lib/persistence/object/flat/object_instance.rb +24 -0
- data/lib/persistence/object/index.rb +479 -0
- data/lib/persistence/object/index/block_index.rb +10 -0
- data/lib/persistence/object/index/block_index/block_index_interface.rb +110 -0
- data/lib/persistence/object/index/explicit_index.rb +10 -0
- data/lib/persistence/object/index/explicit_index/explicit_index_interface.rb +57 -0
- data/lib/persistence/object/index_hash.rb +40 -0
- data/lib/persistence/object/object_instance.rb +322 -0
- data/lib/persistence/object/parse_persistence_args.rb +145 -0
- data/lib/persistence/port.rb +9 -0
- data/lib/persistence/port/bucket.rb +9 -0
- data/lib/persistence/port/bucket/bucket_index.rb +9 -0
- data/lib/persistence/port/bucket/bucket_interface.rb +685 -0
- data/lib/persistence/port/controller.rb +263 -0
- data/lib/persistence/port/port_interface.rb +417 -0
- data/lib/requires.rb +146 -0
- data/spec/Integration_spec.rb +53 -0
- data/spec/Persistence_spec.rb +175 -0
- data/spec/example_objects.rb +6 -0
- data/spec/example_objects/complex_object.rb +7 -0
- data/spec/example_objects/complex_object/array_object.rb +7 -0
- data/spec/example_objects/complex_object/hash_object.rb +7 -0
- data/spec/example_objects/flat_object.rb +7 -0
- data/spec/example_objects/flat_object/file_object.rb +7 -0
- data/spec/persistence/adapter/enable_disable_spec.rb +29 -0
- data/spec/persistence/adapter/mock/cursor_spec.rb +64 -0
- data/spec/persistence/adapter/mock_helpers.rb +27 -0
- data/spec/persistence/adapter/mock_helpers/bucket.rb +10 -0
- data/spec/persistence/adapter/mock_helpers/integration/dictionary_hash.rb +4 -0
- data/spec/persistence/adapter/mock_helpers/integration/note.rb +18 -0
- data/spec/persistence/adapter/mock_helpers/integration/notes_array.rb +4 -0
- data/spec/persistence/adapter/mock_helpers/integration/user.rb +44 -0
- data/spec/persistence/adapter/mock_helpers/integration/user/address.rb +18 -0
- data/spec/persistence/adapter/mock_helpers/integration/user/dictionary_entry.rb +12 -0
- data/spec/persistence/adapter/mock_helpers/integration/user/sub_account.rb +15 -0
- data/spec/persistence/adapter/mock_helpers/object.rb +87 -0
- data/spec/persistence/adapter/mock_helpers/port.rb +21 -0
- data/spec/persistence/adapter/mock_spec.rb +211 -0
- data/spec/persistence/adapter/primary_key/id_property_string_spec.rb +27 -0
- data/spec/persistence/adapter/primary_key/simple_spec.rb +19 -0
- data/spec/persistence/adapter/spec_abstract/adapter_spec.rb +223 -0
- data/spec/persistence/adapter/spec_abstract/cursor_spec.rb +116 -0
- data/spec/persistence/cursor/atomic_spec.rb +86 -0
- data/spec/persistence/cursor/object_and_class_instance_spec.rb +73 -0
- data/spec/persistence/cursor_spec.rb +128 -0
- data/spec/persistence/object/complex/attributes/persistence_hash/array_instance_spec.rb +51 -0
- data/spec/persistence/object/complex/attributes/persistence_hash/hash_instance_spec.rb +56 -0
- data/spec/persistence/object/complex/attributes_spec.rb +1717 -0
- data/spec/persistence/object/complex/complex_spec.rb +922 -0
- data/spec/persistence/object/complex/index/attribute_index_spec.rb +76 -0
- data/spec/persistence/object/flat/bignum_spec.rb +33 -0
- data/spec/persistence/object/flat/class_instance_spec.rb +30 -0
- data/spec/persistence/object/flat/class_spec.rb +38 -0
- data/spec/persistence/object/flat/complex_spec.rb +36 -0
- data/spec/persistence/object/flat/false_class_spec.rb +34 -0
- data/spec/persistence/object/flat/file/class_instance_spec.rb +54 -0
- data/spec/persistence/object/flat/file/object_instance_spec.rb +143 -0
- data/spec/persistence/object/flat/file_spec.rb +64 -0
- data/spec/persistence/object/flat/fixnum_spec.rb +32 -0
- data/spec/persistence/object/flat/float_spec.rb +32 -0
- data/spec/persistence/object/flat/indexing_spec.rb +38 -0
- data/spec/persistence/object/flat/rational_spec.rb +33 -0
- data/spec/persistence/object/flat/regexp_spec.rb +32 -0
- data/spec/persistence/object/flat/string_spec.rb +34 -0
- data/spec/persistence/object/flat/symbol_spec.rb +32 -0
- data/spec/persistence/object/flat/true_class_spec.rb +32 -0
- data/spec/persistence/object/indexes/block_index_spec.rb +119 -0
- data/spec/persistence/object/indexes/explicit_index_spec.rb +112 -0
- data/spec/persistence/object/parse_persistence_args_spec.rb +65 -0
- data/spec/persistence/object_spec.rb +310 -0
- data/spec/persistence/port/bucket/bucket_interface_spec.rb +146 -0
- data/spec/persistence/port/bucket/index/bucket_index_spec.rb +67 -0
- data/spec/persistence/port/bucket_spec.rb +20 -0
- data/spec/persistence/port/controller_spec.rb +60 -0
- data/spec/persistence/port/port_interface_spec.rb +105 -0
- metadata +178 -21
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/LICENSE +0 -22
- data/Rakefile +0 -2
- data/lib/persistence/version.rb +0 -3
- data/persistence.gemspec +0 -17
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../lib/persistence.rb'
|
3
|
+
|
4
|
+
describe ::Persistence::Cursor do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
|
8
|
+
::Persistence.enable_port( :mock, ::Persistence::Adapter::Mock.new )
|
9
|
+
|
10
|
+
class ::Persistence::Cursor::ClassInstanceMock
|
11
|
+
include ::Persistence
|
12
|
+
attr_non_atomic_accessor :name
|
13
|
+
explicit_index :key
|
14
|
+
end
|
15
|
+
|
16
|
+
@objects = [ ]
|
17
|
+
@index = ::Persistence::Cursor::ClassInstanceMock.index( :key )
|
18
|
+
5.times do |this_number|
|
19
|
+
instance = ::Persistence::Cursor::ClassInstanceMock.new
|
20
|
+
instance.name = 'Number ' << this_number.to_s
|
21
|
+
instance.persist!
|
22
|
+
@index.index_object( instance, instance.name )
|
23
|
+
@index.get_object_id( instance.name ).should == instance.persistence_id
|
24
|
+
@objects.push( instance )
|
25
|
+
end
|
26
|
+
|
27
|
+
@cursor = @index.cursor
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
after :all do
|
32
|
+
::Persistence.disable_port( :mock )
|
33
|
+
end
|
34
|
+
|
35
|
+
###########
|
36
|
+
# count #
|
37
|
+
###########
|
38
|
+
|
39
|
+
it 'can count' do
|
40
|
+
::Persistence::Cursor::ClassInstanceMock.instance_persistence_bucket.count.should == 5
|
41
|
+
::Persistence::Cursor::ClassInstanceMock.instance_persistence_bucket.count do |object|
|
42
|
+
object == @objects[ 2 ]
|
43
|
+
end.should == 1
|
44
|
+
::Persistence::Cursor::ClassInstanceMock.instance_persistence_bucket.count( @objects[ 2 ] ).should == 1
|
45
|
+
|
46
|
+
::Persistence::Cursor::ClassInstanceMock.count.should == 5
|
47
|
+
::Persistence::Cursor::ClassInstanceMock.count do |object|
|
48
|
+
object == @objects[ 2 ]
|
49
|
+
end.should == 1
|
50
|
+
::Persistence::Cursor::ClassInstanceMock.count( nil, @objects[ 2 ] ).should == 1
|
51
|
+
end
|
52
|
+
|
53
|
+
###########
|
54
|
+
# count #
|
55
|
+
###########
|
56
|
+
|
57
|
+
it 'can count' do
|
58
|
+
|
59
|
+
::Persistence::Cursor::ClassInstanceMock.index( :key ).count.should == 5
|
60
|
+
::Persistence::Cursor::ClassInstanceMock.index( :key ).count do |object|
|
61
|
+
object == @objects[ 2 ]
|
62
|
+
end.should == 1
|
63
|
+
::Persistence::Cursor::ClassInstanceMock.index( :key ).count( @objects[ 2 ] ).should == 1
|
64
|
+
|
65
|
+
::Persistence::Cursor::ClassInstanceMock.count( :key ).should == 5
|
66
|
+
::Persistence::Cursor::ClassInstanceMock.count( :key ) do |object|
|
67
|
+
object == @objects[ 2 ]
|
68
|
+
end.should == 1
|
69
|
+
::Persistence::Cursor::ClassInstanceMock.count( :key, @objects[ 2 ] ).should == 1
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
@@ -0,0 +1,128 @@
|
|
1
|
+
|
2
|
+
require_relative '../../lib/persistence.rb'
|
3
|
+
|
4
|
+
describe ::Persistence::Cursor do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
|
8
|
+
::Persistence.enable_port( :mock, ::Persistence::Adapter::Mock.new )
|
9
|
+
|
10
|
+
class ::Persistence::Cursor::Mock
|
11
|
+
include ::Persistence
|
12
|
+
attr_non_atomic_accessor :name
|
13
|
+
explicit_index :key
|
14
|
+
end
|
15
|
+
|
16
|
+
@objects = [ ]
|
17
|
+
@index = ::Persistence::Cursor::Mock.index( :key )
|
18
|
+
5.times do |this_number|
|
19
|
+
instance = ::Persistence::Cursor::Mock.new
|
20
|
+
instance.name = 'Number ' << this_number.to_s
|
21
|
+
instance.persist!
|
22
|
+
@index.index_object( instance, instance.name )
|
23
|
+
@index.get_object_id( instance.name ).should == instance.persistence_id
|
24
|
+
@objects.push( instance )
|
25
|
+
end
|
26
|
+
|
27
|
+
@cursor = ::Persistence::Cursor::Mock.instance_persistence_bucket.cursor
|
28
|
+
@index_cursor = @index.cursor
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
after :all do
|
33
|
+
::Persistence.disable_port( :mock )
|
34
|
+
end
|
35
|
+
|
36
|
+
################
|
37
|
+
# persisted? #
|
38
|
+
################
|
39
|
+
|
40
|
+
it 'can report whether a key exists and set its position to the key if it does' do
|
41
|
+
@cursor.persisted?( @objects[ 0 ].persistence_id ).should == true
|
42
|
+
@index_cursor.persisted?( @objects[ 0 ].name ).should == true
|
43
|
+
end
|
44
|
+
|
45
|
+
###########
|
46
|
+
# first #
|
47
|
+
###########
|
48
|
+
|
49
|
+
it 'can set its position to the first key' do
|
50
|
+
@cursor.first.should == @objects.first
|
51
|
+
@cursor.first( 2 ).should == @objects.first( 2 )
|
52
|
+
@index_cursor.first.should == @objects.first
|
53
|
+
@index_cursor.first( 2 ).should == @objects.first( 2 )
|
54
|
+
end
|
55
|
+
|
56
|
+
##########
|
57
|
+
# last #
|
58
|
+
##########
|
59
|
+
|
60
|
+
it 'can set its position to the last key' do
|
61
|
+
@cursor.last.should == @objects.last
|
62
|
+
@cursor.last( 2 ).should == @objects.last( 2 )
|
63
|
+
@index_cursor.first
|
64
|
+
@index_cursor.current.should == @objects.first
|
65
|
+
end
|
66
|
+
|
67
|
+
#########
|
68
|
+
# any #
|
69
|
+
#########
|
70
|
+
|
71
|
+
it 'can set its position to the last key' do
|
72
|
+
@objects.include?( @cursor.any ).should == true
|
73
|
+
@cursor.any( 2 ).each do |this_object|
|
74
|
+
@objects.include?( this_object ).should == true
|
75
|
+
end
|
76
|
+
@index_cursor.first.should == @objects[ 0 ]
|
77
|
+
@index_cursor.next.should == @objects[ 0 ]
|
78
|
+
@index_cursor.next.should == @objects[ 1 ]
|
79
|
+
@index_cursor.next( 2 ).should == @objects[ 2..3 ]
|
80
|
+
end
|
81
|
+
|
82
|
+
#############
|
83
|
+
# current #
|
84
|
+
#############
|
85
|
+
|
86
|
+
it 'can return the current key' do
|
87
|
+
@cursor.first
|
88
|
+
@cursor.current.should == @objects.first
|
89
|
+
end
|
90
|
+
|
91
|
+
##########
|
92
|
+
# next #
|
93
|
+
##########
|
94
|
+
|
95
|
+
it 'can set its position to the next key' do
|
96
|
+
@cursor.first.should == @objects[ 0 ]
|
97
|
+
@cursor.next.should == @objects[ 0 ]
|
98
|
+
@cursor.next.should == @objects[ 1 ]
|
99
|
+
@cursor.next( 2 ).should == @objects[ 2..3 ]
|
100
|
+
end
|
101
|
+
|
102
|
+
##########
|
103
|
+
# each #
|
104
|
+
##########
|
105
|
+
|
106
|
+
it 'can iterate each record' do
|
107
|
+
@cursor.first
|
108
|
+
@cursor.each_with_index do |this_object, this_index|
|
109
|
+
this_object.should == @objects[ this_index ]
|
110
|
+
end
|
111
|
+
@cursor.first
|
112
|
+
enum = @cursor.each
|
113
|
+
enum.is_a?( Enumerator ).should == true
|
114
|
+
enum.next.should == @objects[ 0 ]
|
115
|
+
enum.next.should == @objects[ 1 ]
|
116
|
+
@index_cursor.first
|
117
|
+
@index_cursor.each_with_index do |this_object, this_index|
|
118
|
+
this_object.should == @objects[ this_index ]
|
119
|
+
end
|
120
|
+
@index_cursor.first
|
121
|
+
enum = @index_cursor.each
|
122
|
+
enum.is_a?( Enumerator ).should == true
|
123
|
+
enum.next.should == @objects[ 0 ]
|
124
|
+
enum.next.should == @objects[ 1 ]
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../../../lib/persistence.rb'
|
3
|
+
|
4
|
+
describe ::Persistence::Object::Complex::Array do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
::Persistence.enable_port( :mock, ::Persistence::Adapter::Mock.new )
|
8
|
+
end
|
9
|
+
|
10
|
+
after :all do
|
11
|
+
::Persistence.disable_port( :mock )
|
12
|
+
end
|
13
|
+
|
14
|
+
##############################
|
15
|
+
# persistence_hash_to_port #
|
16
|
+
##############################
|
17
|
+
|
18
|
+
it "can create a persistence hash to correspond to persistence state" do
|
19
|
+
|
20
|
+
class ::Persistence::Object::Complex::Array::SubArray < Array
|
21
|
+
include ::Persistence::Object::Complex
|
22
|
+
include ::Persistence::Object::Complex::Array::ObjectInstance
|
23
|
+
extend ::Persistence::Object::Complex::Array::ClassInstance
|
24
|
+
end
|
25
|
+
class ::Persistence::Object::Complex::Array::ComplexObject
|
26
|
+
|
27
|
+
include ::Persistence::Object::Complex
|
28
|
+
|
29
|
+
def persist!
|
30
|
+
persistence_port.put_object!( self )
|
31
|
+
return self
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
complex_instance = ::Persistence::Object::Complex::Array::ComplexObject.new
|
37
|
+
instance = ::Persistence::Object::Complex::Array::SubArray.new( [ 1, 2, 3, 4, 5, complex_instance ] )
|
38
|
+
|
39
|
+
instance.persistence_hash_to_port.should == { 0 => 1,
|
40
|
+
1 => 2,
|
41
|
+
2 => 3,
|
42
|
+
3 => 4,
|
43
|
+
4 => 5,
|
44
|
+
5 => complex_instance.persistence_id.to_s }
|
45
|
+
|
46
|
+
instance[ 5 ].should == complex_instance
|
47
|
+
instance.instance_eval { is_complex_object?( self [ 5 ] ) }.should == true
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../../../lib/persistence.rb'
|
3
|
+
|
4
|
+
describe ::Persistence::Object::Complex::Hash do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
::Persistence.enable_port( :mock, ::Persistence::Adapter::Mock.new )
|
8
|
+
end
|
9
|
+
|
10
|
+
after :all do
|
11
|
+
::Persistence.disable_port( :mock )
|
12
|
+
end
|
13
|
+
|
14
|
+
##############################
|
15
|
+
# persistence_hash_to_port #
|
16
|
+
##############################
|
17
|
+
|
18
|
+
it "can create a persistence hash to correspond to persistence state" do
|
19
|
+
module ::Persistence::Object::Complex::Hash::PersistenceHashToPortMock
|
20
|
+
|
21
|
+
class HashMock < Hash
|
22
|
+
include ::Persistence::Object::Complex
|
23
|
+
include ::Persistence::Object::Complex::Hash::ObjectInstance
|
24
|
+
extend ::Persistence::Object::Complex::Hash::ClassInstance
|
25
|
+
end
|
26
|
+
|
27
|
+
class ComplexObject
|
28
|
+
|
29
|
+
include ::Persistence::Object::Complex
|
30
|
+
|
31
|
+
def persist!
|
32
|
+
persistence_port.put_object!( self )
|
33
|
+
return self
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
complex_instance = ComplexObject.new
|
39
|
+
instance = HashMock.new
|
40
|
+
instance[ 1 ] = :some_value
|
41
|
+
instance[ :key ] = :other_value
|
42
|
+
instance[ complex_instance ] = :complex_value
|
43
|
+
instance[ :complex_key ] = complex_instance
|
44
|
+
|
45
|
+
instance.persistence_hash_to_port.should == { 1 => :some_value,
|
46
|
+
:key => :other_value,
|
47
|
+
complex_instance.persistence_id.to_s => :complex_value,
|
48
|
+
:complex_key => complex_instance.persistence_id.to_s }
|
49
|
+
|
50
|
+
instance[ :complex_key ].should == complex_instance
|
51
|
+
instance[ complex_instance ].should == :complex_value
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,1717 @@
|
|
1
|
+
|
2
|
+
require_relative '../../../../lib/persistence.rb'
|
3
|
+
|
4
|
+
describe ::Persistence::Object::Complex::Attributes do
|
5
|
+
|
6
|
+
#######################
|
7
|
+
# atomic_attributes #
|
8
|
+
#######################
|
9
|
+
|
10
|
+
it 'can declare atomic attribute readers, writers, accessors, and automatically update corresponding declarations' do
|
11
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributesMock
|
12
|
+
|
13
|
+
include ::Persistence::Object::Complex
|
14
|
+
|
15
|
+
atomic_attributes.empty?.should == true
|
16
|
+
|
17
|
+
# reader
|
18
|
+
atomic_attributes.add( :some_reader, :reader )
|
19
|
+
atomic_attributes[ :some_reader ].should == :reader
|
20
|
+
persistent_attributes[ :some_reader ].should == :reader
|
21
|
+
atomic_attribute_readers.include?( :some_reader ).should == true
|
22
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
23
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
24
|
+
non_atomic_attributes.empty?.should == true
|
25
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == false
|
26
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
27
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
28
|
+
|
29
|
+
atomic_attributes[ :some_other_reader ] = :reader
|
30
|
+
atomic_attributes[ :some_other_reader ].should == :reader
|
31
|
+
persistent_attributes[ :some_other_reader ].should == :reader
|
32
|
+
atomic_attribute_readers.include?( :some_other_reader ).should == true
|
33
|
+
atomic_attribute_writers.include?( :some_other_reader ).should == false
|
34
|
+
atomic_attribute_accessors.include?( :some_other_reader ).should == false
|
35
|
+
non_atomic_attributes.empty?.should == true
|
36
|
+
non_atomic_attribute_readers.include?( :some_other_reader ).should == false
|
37
|
+
non_atomic_attribute_writers.include?( :some_other_reader ).should == false
|
38
|
+
non_atomic_attribute_accessors.include?( :some_other_reader ).should == false
|
39
|
+
|
40
|
+
atomic_attributes.add( :some_reader, :writer )
|
41
|
+
atomic_attributes[ :some_reader ].should == :accessor
|
42
|
+
persistent_attributes[ :some_reader ].should == :accessor
|
43
|
+
atomic_attribute_readers.include?( :some_reader ).should == true
|
44
|
+
atomic_attribute_writers.include?( :some_reader ).should == true
|
45
|
+
atomic_attribute_accessors.include?( :some_reader ).should == true
|
46
|
+
non_atomic_attributes.empty?.should == true
|
47
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == false
|
48
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
49
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
50
|
+
|
51
|
+
atomic_attributes.subtract( :some_reader, :writer )
|
52
|
+
atomic_attributes[ :some_reader ].should == :reader
|
53
|
+
persistent_attributes[ :some_reader ].should == :reader
|
54
|
+
atomic_attribute_readers.include?( :some_reader ).should == true
|
55
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
56
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
57
|
+
non_atomic_attributes.empty?.should == true
|
58
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == false
|
59
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
60
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
61
|
+
|
62
|
+
# writer
|
63
|
+
atomic_attributes.add( :some_writer, :writer )
|
64
|
+
atomic_attributes[ :some_writer ].should == :writer
|
65
|
+
persistent_attributes[ :some_writer ].should == :writer
|
66
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
67
|
+
atomic_attribute_writers.include?( :some_writer ).should == true
|
68
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
69
|
+
non_atomic_attributes.empty?.should == true
|
70
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
71
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == false
|
72
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
73
|
+
|
74
|
+
atomic_attributes[ :some_other_writer ] = :writer
|
75
|
+
atomic_attributes[ :some_other_writer ].should == :writer
|
76
|
+
persistent_attributes[ :some_other_writer ].should == :writer
|
77
|
+
atomic_attribute_readers.include?( :some_other_writer ).should == false
|
78
|
+
atomic_attribute_writers.include?( :some_other_writer ).should == true
|
79
|
+
atomic_attribute_accessors.include?( :some_other_writer ).should == false
|
80
|
+
non_atomic_attributes.empty?.should == true
|
81
|
+
non_atomic_attribute_readers.include?( :some_other_writer ).should == false
|
82
|
+
non_atomic_attribute_writers.include?( :some_other_writer ).should == false
|
83
|
+
non_atomic_attribute_accessors.include?( :some_other_writer ).should == false
|
84
|
+
|
85
|
+
atomic_attributes.add( :some_writer, :reader )
|
86
|
+
atomic_attributes[ :some_writer ].should == :accessor
|
87
|
+
persistent_attributes[ :some_writer ].should == :accessor
|
88
|
+
atomic_attribute_readers.include?( :some_writer ).should == true
|
89
|
+
atomic_attribute_writers.include?( :some_writer ).should == true
|
90
|
+
atomic_attribute_accessors.include?( :some_writer ).should == true
|
91
|
+
non_atomic_attributes.empty?.should == true
|
92
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
93
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == false
|
94
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
95
|
+
|
96
|
+
atomic_attributes.subtract( :some_writer, :reader )
|
97
|
+
atomic_attributes[ :some_writer ].should == :writer
|
98
|
+
persistent_attributes[ :some_writer ].should == :writer
|
99
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
100
|
+
atomic_attribute_writers.include?( :some_writer ).should == true
|
101
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
102
|
+
non_atomic_attributes.empty?.should == true
|
103
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
104
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == false
|
105
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
106
|
+
|
107
|
+
# accessor
|
108
|
+
atomic_attributes.add( :some_accessor, :accessor )
|
109
|
+
atomic_attributes[ :some_accessor ].should == :accessor
|
110
|
+
persistent_attributes[ :some_accessor ].should == :accessor
|
111
|
+
atomic_attribute_readers.include?( :some_accessor ).should == true
|
112
|
+
atomic_attribute_writers.include?( :some_accessor ).should == true
|
113
|
+
atomic_attribute_accessors.include?( :some_accessor ).should == true
|
114
|
+
non_atomic_attributes.empty?.should == true
|
115
|
+
non_atomic_attribute_readers.include?( :some_accessor ).should == false
|
116
|
+
non_atomic_attribute_writers.include?( :some_accessor ).should == false
|
117
|
+
non_atomic_attribute_accessors.include?( :some_accessor ).should == false
|
118
|
+
|
119
|
+
atomic_attributes[ :some_other_accessor ] = :accessor
|
120
|
+
atomic_attributes[ :some_other_accessor ].should == :accessor
|
121
|
+
persistent_attributes[ :some_other_accessor ].should == :accessor
|
122
|
+
atomic_attribute_readers.include?( :some_other_accessor ).should == true
|
123
|
+
atomic_attribute_writers.include?( :some_other_accessor ).should == true
|
124
|
+
atomic_attribute_accessors.include?( :some_other_accessor ).should == true
|
125
|
+
non_atomic_attributes.empty?.should == true
|
126
|
+
non_atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
127
|
+
non_atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
128
|
+
non_atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
129
|
+
|
130
|
+
atomic_attributes.subtract( :some_other_accessor, :accessor )
|
131
|
+
atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
132
|
+
atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
133
|
+
atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
134
|
+
non_atomic_attributes.empty?.should == true
|
135
|
+
non_atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
136
|
+
non_atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
137
|
+
non_atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
138
|
+
|
139
|
+
# nil
|
140
|
+
atomic_attributes[ :some_accessor ] = nil
|
141
|
+
atomic_attribute_readers.include?( :some_accessor ).should == false
|
142
|
+
atomic_attribute_writers.include?( :some_accessor ).should == false
|
143
|
+
atomic_attribute_accessors.include?( :some_accessor ).should == false
|
144
|
+
non_atomic_attributes.empty?.should == true
|
145
|
+
non_atomic_attribute_readers.include?( :some_accessor ).should == false
|
146
|
+
non_atomic_attribute_writers.include?( :some_accessor ).should == false
|
147
|
+
non_atomic_attribute_accessors.include?( :some_accessor ).should == false
|
148
|
+
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
###########################
|
153
|
+
# non_atomic_attributes #
|
154
|
+
###########################
|
155
|
+
|
156
|
+
it 'can declare non-atomic attribute readers, writers, accessors, and automatically update corresponding declarations' do
|
157
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributesMock
|
158
|
+
|
159
|
+
include ::Persistence::Object::Complex
|
160
|
+
|
161
|
+
non_atomic_attributes.empty?.should == true
|
162
|
+
|
163
|
+
# reader
|
164
|
+
non_atomic_attributes.add( :some_reader, :reader )
|
165
|
+
non_atomic_attributes[ :some_reader ].should == :reader
|
166
|
+
persistent_attributes[ :some_reader ].should == :reader
|
167
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == true
|
168
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
169
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
170
|
+
atomic_attributes.empty?.should == true
|
171
|
+
atomic_attribute_readers.include?( :some_reader ).should == false
|
172
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
173
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
174
|
+
|
175
|
+
non_atomic_attributes[ :some_other_reader ] = :reader
|
176
|
+
non_atomic_attributes[ :some_other_reader ].should == :reader
|
177
|
+
persistent_attributes[ :some_other_reader ].should == :reader
|
178
|
+
non_atomic_attribute_readers.include?( :some_other_reader ).should == true
|
179
|
+
non_atomic_attribute_writers.include?( :some_other_reader ).should == false
|
180
|
+
non_atomic_attribute_accessors.include?( :some_other_reader ).should == false
|
181
|
+
atomic_attributes.empty?.should == true
|
182
|
+
atomic_attribute_readers.include?( :some_other_reader ).should == false
|
183
|
+
atomic_attribute_writers.include?( :some_other_reader ).should == false
|
184
|
+
atomic_attribute_accessors.include?( :some_other_reader ).should == false
|
185
|
+
|
186
|
+
non_atomic_attributes.add( :some_reader, :writer )
|
187
|
+
non_atomic_attributes[ :some_reader ].should == :accessor
|
188
|
+
persistent_attributes[ :some_reader ].should == :accessor
|
189
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == true
|
190
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == true
|
191
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == true
|
192
|
+
atomic_attributes.empty?.should == true
|
193
|
+
atomic_attribute_readers.include?( :some_reader ).should == false
|
194
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
195
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
196
|
+
|
197
|
+
non_atomic_attributes.subtract( :some_reader, :writer )
|
198
|
+
non_atomic_attributes[ :some_reader ].should == :reader
|
199
|
+
persistent_attributes[ :some_reader ].should == :reader
|
200
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == true
|
201
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
202
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
203
|
+
atomic_attributes.empty?.should == true
|
204
|
+
atomic_attribute_readers.include?( :some_reader ).should == false
|
205
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
206
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
207
|
+
|
208
|
+
# writer
|
209
|
+
non_atomic_attributes.add( :some_writer, :writer )
|
210
|
+
non_atomic_attributes[ :some_writer ].should == :writer
|
211
|
+
persistent_attributes[ :some_writer ].should == :writer
|
212
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
213
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == true
|
214
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
215
|
+
atomic_attributes.empty?.should == true
|
216
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
217
|
+
atomic_attribute_writers.include?( :some_writer ).should == false
|
218
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
219
|
+
|
220
|
+
non_atomic_attributes[ :some_other_writer ] = :writer
|
221
|
+
non_atomic_attributes[ :some_other_writer ].should == :writer
|
222
|
+
persistent_attributes[ :some_other_writer ].should == :writer
|
223
|
+
non_atomic_attribute_readers.include?( :some_other_writer ).should == false
|
224
|
+
non_atomic_attribute_writers.include?( :some_other_writer ).should == true
|
225
|
+
non_atomic_attribute_accessors.include?( :some_other_writer ).should == false
|
226
|
+
atomic_attributes.empty?.should == true
|
227
|
+
atomic_attribute_readers.include?( :some_other_writer ).should == false
|
228
|
+
atomic_attribute_writers.include?( :some_other_writer ).should == false
|
229
|
+
atomic_attribute_accessors.include?( :some_other_writer ).should == false
|
230
|
+
|
231
|
+
non_atomic_attributes.add( :some_writer, :reader )
|
232
|
+
non_atomic_attributes[ :some_writer ].should == :accessor
|
233
|
+
persistent_attributes[ :some_writer ].should == :accessor
|
234
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == true
|
235
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == true
|
236
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == true
|
237
|
+
atomic_attributes.empty?.should == true
|
238
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
239
|
+
atomic_attribute_writers.include?( :some_writer ).should == false
|
240
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
241
|
+
|
242
|
+
non_atomic_attributes.subtract( :some_writer, :reader )
|
243
|
+
non_atomic_attributes[ :some_writer ].should == :writer
|
244
|
+
persistent_attributes[ :some_writer ].should == :writer
|
245
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
246
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == true
|
247
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
248
|
+
atomic_attributes.empty?.should == true
|
249
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
250
|
+
atomic_attribute_writers.include?( :some_writer ).should == false
|
251
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
252
|
+
|
253
|
+
# accessor
|
254
|
+
non_atomic_attributes.add( :some_accessor, :accessor )
|
255
|
+
non_atomic_attributes[ :some_accessor ].should == :accessor
|
256
|
+
persistent_attributes[ :some_accessor ].should == :accessor
|
257
|
+
non_atomic_attribute_readers.include?( :some_accessor ).should == true
|
258
|
+
non_atomic_attribute_writers.include?( :some_accessor ).should == true
|
259
|
+
non_atomic_attribute_accessors.include?( :some_accessor ).should == true
|
260
|
+
atomic_attributes.empty?.should == true
|
261
|
+
atomic_attribute_readers.include?( :some_accessor ).should == false
|
262
|
+
atomic_attribute_writers.include?( :some_accessor ).should == false
|
263
|
+
atomic_attribute_accessors.include?( :some_accessor ).should == false
|
264
|
+
|
265
|
+
non_atomic_attributes[ :some_other_accessor ] = :accessor
|
266
|
+
non_atomic_attributes[ :some_other_accessor ].should == :accessor
|
267
|
+
persistent_attributes[ :some_other_accessor ].should == :accessor
|
268
|
+
non_atomic_attribute_readers.include?( :some_other_accessor ).should == true
|
269
|
+
non_atomic_attribute_writers.include?( :some_other_accessor ).should == true
|
270
|
+
non_atomic_attribute_accessors.include?( :some_other_accessor ).should == true
|
271
|
+
atomic_attributes.empty?.should == true
|
272
|
+
atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
273
|
+
atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
274
|
+
atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
275
|
+
|
276
|
+
non_atomic_attributes.subtract( :some_other_accessor, :accessor )
|
277
|
+
non_atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
278
|
+
non_atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
279
|
+
non_atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
280
|
+
atomic_attributes.empty?.should == true
|
281
|
+
atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
282
|
+
atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
283
|
+
atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
284
|
+
|
285
|
+
# nil
|
286
|
+
non_atomic_attributes[ :some_accessor ] = nil
|
287
|
+
non_atomic_attribute_readers.include?( :some_accessor ).should == false
|
288
|
+
non_atomic_attribute_writers.include?( :some_accessor ).should == false
|
289
|
+
non_atomic_attribute_accessors.include?( :some_accessor ).should == false
|
290
|
+
atomic_attributes.empty?.should == true
|
291
|
+
atomic_attribute_readers.include?( :some_accessor ).should == false
|
292
|
+
atomic_attribute_writers.include?( :some_accessor ).should == false
|
293
|
+
atomic_attribute_accessors.include?( :some_accessor ).should == false
|
294
|
+
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
###########################
|
299
|
+
# persistent_attributes #
|
300
|
+
###########################
|
301
|
+
|
302
|
+
it 'can declare persistent attribute readers, writers, accessors (which default to non-atomic or atomic), and automatically update corresponding declarations' do
|
303
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributesMock
|
304
|
+
|
305
|
+
include ::Persistence::Object::Complex
|
306
|
+
|
307
|
+
# Atomic
|
308
|
+
|
309
|
+
atomic_attributes.empty?.should == true
|
310
|
+
non_atomic_attributes.empty?.should == true
|
311
|
+
persistent_attributes.empty?.should == true
|
312
|
+
|
313
|
+
persistent_attributes.default_atomic!
|
314
|
+
|
315
|
+
# reader
|
316
|
+
persistent_attributes.add( :some_reader, :reader )
|
317
|
+
atomic_attributes[ :some_reader ].should == :reader
|
318
|
+
persistent_attributes[ :some_reader ].should == :reader
|
319
|
+
atomic_attribute_readers.include?( :some_reader ).should == true
|
320
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
321
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
322
|
+
non_atomic_attributes.empty?.should == true
|
323
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == false
|
324
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
325
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
326
|
+
|
327
|
+
persistent_attributes[ :some_other_reader ] = :reader
|
328
|
+
atomic_attributes[ :some_other_reader ].should == :reader
|
329
|
+
persistent_attributes[ :some_other_reader ].should == :reader
|
330
|
+
atomic_attribute_readers.include?( :some_other_reader ).should == true
|
331
|
+
atomic_attribute_writers.include?( :some_other_reader ).should == false
|
332
|
+
atomic_attribute_accessors.include?( :some_other_reader ).should == false
|
333
|
+
non_atomic_attributes.empty?.should == true
|
334
|
+
non_atomic_attribute_readers.include?( :some_other_reader ).should == false
|
335
|
+
non_atomic_attribute_writers.include?( :some_other_reader ).should == false
|
336
|
+
non_atomic_attribute_accessors.include?( :some_other_reader ).should == false
|
337
|
+
|
338
|
+
persistent_attributes.add( :some_reader, :writer )
|
339
|
+
atomic_attributes[ :some_reader ].should == :accessor
|
340
|
+
persistent_attributes[ :some_reader ].should == :accessor
|
341
|
+
atomic_attribute_readers.include?( :some_reader ).should == true
|
342
|
+
atomic_attribute_writers.include?( :some_reader ).should == true
|
343
|
+
atomic_attribute_accessors.include?( :some_reader ).should == true
|
344
|
+
non_atomic_attributes.empty?.should == true
|
345
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == false
|
346
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
347
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
348
|
+
|
349
|
+
persistent_attributes.subtract( :some_reader, :writer )
|
350
|
+
atomic_attributes[ :some_reader ].should == :reader
|
351
|
+
persistent_attributes[ :some_reader ].should == :reader
|
352
|
+
atomic_attribute_readers.include?( :some_reader ).should == true
|
353
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
354
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
355
|
+
non_atomic_attributes.empty?.should == true
|
356
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == false
|
357
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
358
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
359
|
+
|
360
|
+
# writer
|
361
|
+
persistent_attributes.add( :some_writer, :writer )
|
362
|
+
atomic_attributes[ :some_writer ].should == :writer
|
363
|
+
persistent_attributes[ :some_writer ].should == :writer
|
364
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
365
|
+
atomic_attribute_writers.include?( :some_writer ).should == true
|
366
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
367
|
+
non_atomic_attributes.empty?.should == true
|
368
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
369
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == false
|
370
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
371
|
+
|
372
|
+
persistent_attributes[ :some_other_writer ] = :writer
|
373
|
+
atomic_attributes[ :some_other_writer ].should == :writer
|
374
|
+
persistent_attributes[ :some_other_writer ].should == :writer
|
375
|
+
atomic_attribute_readers.include?( :some_other_writer ).should == false
|
376
|
+
atomic_attribute_writers.include?( :some_other_writer ).should == true
|
377
|
+
atomic_attribute_accessors.include?( :some_other_writer ).should == false
|
378
|
+
non_atomic_attributes.empty?.should == true
|
379
|
+
non_atomic_attribute_readers.include?( :some_other_writer ).should == false
|
380
|
+
non_atomic_attribute_writers.include?( :some_other_writer ).should == false
|
381
|
+
non_atomic_attribute_accessors.include?( :some_other_writer ).should == false
|
382
|
+
|
383
|
+
persistent_attributes.add( :some_writer, :reader )
|
384
|
+
atomic_attributes[ :some_writer ].should == :accessor
|
385
|
+
persistent_attributes[ :some_writer ].should == :accessor
|
386
|
+
atomic_attribute_readers.include?( :some_writer ).should == true
|
387
|
+
atomic_attribute_writers.include?( :some_writer ).should == true
|
388
|
+
atomic_attribute_accessors.include?( :some_writer ).should == true
|
389
|
+
non_atomic_attributes.empty?.should == true
|
390
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
391
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == false
|
392
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
393
|
+
|
394
|
+
persistent_attributes.subtract( :some_writer, :reader )
|
395
|
+
atomic_attributes[ :some_writer ].should == :writer
|
396
|
+
persistent_attributes[ :some_writer ].should == :writer
|
397
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
398
|
+
atomic_attribute_writers.include?( :some_writer ).should == true
|
399
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
400
|
+
non_atomic_attributes.empty?.should == true
|
401
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
402
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == false
|
403
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
404
|
+
|
405
|
+
# accessor
|
406
|
+
persistent_attributes.add( :some_accessor, :accessor )
|
407
|
+
atomic_attributes[ :some_accessor ].should == :accessor
|
408
|
+
persistent_attributes[ :some_accessor ].should == :accessor
|
409
|
+
atomic_attribute_readers.include?( :some_accessor ).should == true
|
410
|
+
atomic_attribute_writers.include?( :some_accessor ).should == true
|
411
|
+
atomic_attribute_accessors.include?( :some_accessor ).should == true
|
412
|
+
non_atomic_attributes.empty?.should == true
|
413
|
+
non_atomic_attribute_readers.include?( :some_accessor ).should == false
|
414
|
+
non_atomic_attribute_writers.include?( :some_accessor ).should == false
|
415
|
+
non_atomic_attribute_accessors.include?( :some_accessor ).should == false
|
416
|
+
|
417
|
+
persistent_attributes[ :some_other_accessor ] = :accessor
|
418
|
+
atomic_attributes[ :some_other_accessor ].should == :accessor
|
419
|
+
persistent_attributes[ :some_other_accessor ].should == :accessor
|
420
|
+
atomic_attribute_readers.include?( :some_other_accessor ).should == true
|
421
|
+
atomic_attribute_writers.include?( :some_other_accessor ).should == true
|
422
|
+
atomic_attribute_accessors.include?( :some_other_accessor ).should == true
|
423
|
+
non_atomic_attributes.empty?.should == true
|
424
|
+
non_atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
425
|
+
non_atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
426
|
+
non_atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
427
|
+
|
428
|
+
persistent_attributes.subtract( :some_other_accessor, :accessor )
|
429
|
+
atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
430
|
+
atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
431
|
+
atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
432
|
+
non_atomic_attributes.empty?.should == true
|
433
|
+
non_atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
434
|
+
non_atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
435
|
+
non_atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
436
|
+
|
437
|
+
# nil
|
438
|
+
persistent_attributes[ :some_accessor ] = nil
|
439
|
+
atomic_attribute_readers.include?( :some_accessor ).should == false
|
440
|
+
atomic_attribute_writers.include?( :some_accessor ).should == false
|
441
|
+
atomic_attribute_accessors.include?( :some_accessor ).should == false
|
442
|
+
non_atomic_attributes.empty?.should == true
|
443
|
+
non_atomic_attribute_readers.include?( :some_accessor ).should == false
|
444
|
+
non_atomic_attribute_writers.include?( :some_accessor ).should == false
|
445
|
+
non_atomic_attribute_accessors.include?( :some_accessor ).should == false
|
446
|
+
|
447
|
+
atomic_attributes.clear
|
448
|
+
non_atomic_attributes.clear
|
449
|
+
persistent_attributes.clear
|
450
|
+
|
451
|
+
#################################################
|
452
|
+
|
453
|
+
# Non-Atomic
|
454
|
+
|
455
|
+
atomic_attributes.empty?.should == true
|
456
|
+
non_atomic_attributes.empty?.should == true
|
457
|
+
persistent_attributes.empty?.should == true
|
458
|
+
|
459
|
+
persistent_attributes.default_non_atomic!
|
460
|
+
|
461
|
+
# reader
|
462
|
+
persistent_attributes.add( :some_reader, :reader )
|
463
|
+
non_atomic_attributes[ :some_reader ].should == :reader
|
464
|
+
persistent_attributes[ :some_reader ].should == :reader
|
465
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == true
|
466
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
467
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
468
|
+
atomic_attributes.empty?.should == true
|
469
|
+
atomic_attribute_readers.include?( :some_reader ).should == false
|
470
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
471
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
472
|
+
|
473
|
+
persistent_attributes[ :some_other_reader ] = :reader
|
474
|
+
non_atomic_attributes[ :some_other_reader ].should == :reader
|
475
|
+
persistent_attributes[ :some_other_reader ].should == :reader
|
476
|
+
non_atomic_attribute_readers.include?( :some_other_reader ).should == true
|
477
|
+
non_atomic_attribute_writers.include?( :some_other_reader ).should == false
|
478
|
+
non_atomic_attribute_accessors.include?( :some_other_reader ).should == false
|
479
|
+
atomic_attributes.empty?.should == true
|
480
|
+
atomic_attribute_readers.include?( :some_other_reader ).should == false
|
481
|
+
atomic_attribute_writers.include?( :some_other_reader ).should == false
|
482
|
+
atomic_attribute_accessors.include?( :some_other_reader ).should == false
|
483
|
+
|
484
|
+
persistent_attributes.add( :some_reader, :writer )
|
485
|
+
non_atomic_attributes[ :some_reader ].should == :accessor
|
486
|
+
persistent_attributes[ :some_reader ].should == :accessor
|
487
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == true
|
488
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == true
|
489
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == true
|
490
|
+
atomic_attributes.empty?.should == true
|
491
|
+
atomic_attribute_readers.include?( :some_reader ).should == false
|
492
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
493
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
494
|
+
|
495
|
+
persistent_attributes.subtract( :some_reader, :writer )
|
496
|
+
non_atomic_attributes[ :some_reader ].should == :reader
|
497
|
+
persistent_attributes[ :some_reader ].should == :reader
|
498
|
+
non_atomic_attribute_readers.include?( :some_reader ).should == true
|
499
|
+
non_atomic_attribute_writers.include?( :some_reader ).should == false
|
500
|
+
non_atomic_attribute_accessors.include?( :some_reader ).should == false
|
501
|
+
atomic_attributes.empty?.should == true
|
502
|
+
atomic_attribute_readers.include?( :some_reader ).should == false
|
503
|
+
atomic_attribute_writers.include?( :some_reader ).should == false
|
504
|
+
atomic_attribute_accessors.include?( :some_reader ).should == false
|
505
|
+
|
506
|
+
# writer
|
507
|
+
persistent_attributes.add( :some_writer, :writer )
|
508
|
+
non_atomic_attributes[ :some_writer ].should == :writer
|
509
|
+
persistent_attributes[ :some_writer ].should == :writer
|
510
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
511
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == true
|
512
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
513
|
+
atomic_attributes.empty?.should == true
|
514
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
515
|
+
atomic_attribute_writers.include?( :some_writer ).should == false
|
516
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
517
|
+
|
518
|
+
persistent_attributes[ :some_other_writer ] = :writer
|
519
|
+
non_atomic_attributes[ :some_other_writer ].should == :writer
|
520
|
+
persistent_attributes[ :some_other_writer ].should == :writer
|
521
|
+
non_atomic_attribute_readers.include?( :some_other_writer ).should == false
|
522
|
+
non_atomic_attribute_writers.include?( :some_other_writer ).should == true
|
523
|
+
non_atomic_attribute_accessors.include?( :some_other_writer ).should == false
|
524
|
+
atomic_attributes.empty?.should == true
|
525
|
+
atomic_attribute_readers.include?( :some_other_writer ).should == false
|
526
|
+
atomic_attribute_writers.include?( :some_other_writer ).should == false
|
527
|
+
atomic_attribute_accessors.include?( :some_other_writer ).should == false
|
528
|
+
|
529
|
+
persistent_attributes.add( :some_writer, :reader )
|
530
|
+
non_atomic_attributes[ :some_writer ].should == :accessor
|
531
|
+
persistent_attributes[ :some_writer ].should == :accessor
|
532
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == true
|
533
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == true
|
534
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == true
|
535
|
+
atomic_attributes.empty?.should == true
|
536
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
537
|
+
atomic_attribute_writers.include?( :some_writer ).should == false
|
538
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
539
|
+
|
540
|
+
persistent_attributes.subtract( :some_writer, :reader )
|
541
|
+
non_atomic_attributes[ :some_writer ].should == :writer
|
542
|
+
persistent_attributes[ :some_writer ].should == :writer
|
543
|
+
non_atomic_attribute_readers.include?( :some_writer ).should == false
|
544
|
+
non_atomic_attribute_writers.include?( :some_writer ).should == true
|
545
|
+
non_atomic_attribute_accessors.include?( :some_writer ).should == false
|
546
|
+
atomic_attributes.empty?.should == true
|
547
|
+
atomic_attribute_readers.include?( :some_writer ).should == false
|
548
|
+
atomic_attribute_writers.include?( :some_writer ).should == false
|
549
|
+
atomic_attribute_accessors.include?( :some_writer ).should == false
|
550
|
+
|
551
|
+
# accessor
|
552
|
+
persistent_attributes.add( :some_accessor, :accessor )
|
553
|
+
non_atomic_attributes[ :some_accessor ].should == :accessor
|
554
|
+
persistent_attributes[ :some_accessor ].should == :accessor
|
555
|
+
non_atomic_attribute_readers.include?( :some_accessor ).should == true
|
556
|
+
non_atomic_attribute_writers.include?( :some_accessor ).should == true
|
557
|
+
non_atomic_attribute_accessors.include?( :some_accessor ).should == true
|
558
|
+
atomic_attributes.empty?.should == true
|
559
|
+
atomic_attribute_readers.include?( :some_accessor ).should == false
|
560
|
+
atomic_attribute_writers.include?( :some_accessor ).should == false
|
561
|
+
atomic_attribute_accessors.include?( :some_accessor ).should == false
|
562
|
+
|
563
|
+
persistent_attributes[ :some_other_accessor ] = :accessor
|
564
|
+
non_atomic_attributes[ :some_other_accessor ].should == :accessor
|
565
|
+
persistent_attributes[ :some_other_accessor ].should == :accessor
|
566
|
+
non_atomic_attribute_readers.include?( :some_other_accessor ).should == true
|
567
|
+
non_atomic_attribute_writers.include?( :some_other_accessor ).should == true
|
568
|
+
non_atomic_attribute_accessors.include?( :some_other_accessor ).should == true
|
569
|
+
atomic_attributes.empty?.should == true
|
570
|
+
atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
571
|
+
atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
572
|
+
atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
573
|
+
|
574
|
+
persistent_attributes.subtract( :some_other_accessor, :accessor )
|
575
|
+
non_atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
576
|
+
non_atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
577
|
+
non_atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
578
|
+
atomic_attributes.empty?.should == true
|
579
|
+
atomic_attribute_readers.include?( :some_other_accessor ).should == false
|
580
|
+
atomic_attribute_writers.include?( :some_other_accessor ).should == false
|
581
|
+
atomic_attribute_accessors.include?( :some_other_accessor ).should == false
|
582
|
+
|
583
|
+
# nil
|
584
|
+
persistent_attributes[ :some_accessor ] = nil
|
585
|
+
non_atomic_attribute_readers.include?( :some_accessor ).should == false
|
586
|
+
non_atomic_attribute_writers.include?( :some_accessor ).should == false
|
587
|
+
non_atomic_attribute_accessors.include?( :some_accessor ).should == false
|
588
|
+
atomic_attributes.empty?.should == true
|
589
|
+
atomic_attribute_readers.include?( :some_accessor ).should == false
|
590
|
+
atomic_attribute_writers.include?( :some_accessor ).should == false
|
591
|
+
atomic_attribute_accessors.include?( :some_accessor ).should == false
|
592
|
+
|
593
|
+
end
|
594
|
+
end
|
595
|
+
|
596
|
+
##############################
|
597
|
+
# atomic_attribute_readers #
|
598
|
+
##############################
|
599
|
+
|
600
|
+
it 'can declare atomic attribute accessors' do
|
601
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributeReaders
|
602
|
+
|
603
|
+
include ::Persistence::Object::Complex
|
604
|
+
|
605
|
+
atomic_attribute_writers.empty?.should == true
|
606
|
+
atomic_attribute_readers.empty?.should == true
|
607
|
+
atomic_attribute_accessors.empty?.should == true
|
608
|
+
atomic_attributes.empty?.should == true
|
609
|
+
non_atomic_attributes.empty?.should == true
|
610
|
+
non_atomic_attribute_writers.empty?.should == true
|
611
|
+
non_atomic_attribute_readers.empty?.should == true
|
612
|
+
non_atomic_attribute_accessors.empty?.should == true
|
613
|
+
|
614
|
+
atomic_attribute_readers.push( :some_reader )
|
615
|
+
atomic_attributes[ :some_reader ].should == :reader
|
616
|
+
persistent_attributes[ :some_reader ].should == :reader
|
617
|
+
atomic_attribute_readers.should == [ :some_reader ]
|
618
|
+
atomic_attribute_writers.empty?.should == true
|
619
|
+
atomic_attribute_accessors.empty?.should == true
|
620
|
+
non_atomic_attributes.empty?.should == true
|
621
|
+
non_atomic_attribute_writers.empty?.should == true
|
622
|
+
non_atomic_attribute_readers.empty?.should == true
|
623
|
+
non_atomic_attribute_accessors.empty?.should == true
|
624
|
+
|
625
|
+
atomic_attributes[ :some_reader ] = :accessor
|
626
|
+
atomic_attribute_writers.delete( :some_reader )
|
627
|
+
atomic_attribute_readers.should == [ :some_reader ]
|
628
|
+
atomic_attribute_writers.empty?.should == true
|
629
|
+
atomic_attribute_accessors.empty?.should == true
|
630
|
+
non_atomic_attributes.empty?.should == true
|
631
|
+
non_atomic_attribute_writers.empty?.should == true
|
632
|
+
non_atomic_attribute_readers.empty?.should == true
|
633
|
+
non_atomic_attribute_accessors.empty?.should == true
|
634
|
+
|
635
|
+
atomic_attribute_readers.delete( :some_reader )
|
636
|
+
atomic_attributes[ :some_reader ].should == nil
|
637
|
+
persistent_attributes[ :some_reader ].should == nil
|
638
|
+
atomic_attribute_readers.empty?.should == true
|
639
|
+
atomic_attribute_writers.empty?.should == true
|
640
|
+
atomic_attribute_accessors.empty?.should == true
|
641
|
+
non_atomic_attributes.empty?.should == true
|
642
|
+
non_atomic_attribute_writers.empty?.should == true
|
643
|
+
non_atomic_attribute_readers.empty?.should == true
|
644
|
+
non_atomic_attribute_accessors.empty?.should == true
|
645
|
+
|
646
|
+
end
|
647
|
+
end
|
648
|
+
|
649
|
+
|
650
|
+
##############################
|
651
|
+
# atomic_attribute_writers #
|
652
|
+
##############################
|
653
|
+
|
654
|
+
it 'can declare atomic attribute accessors' do
|
655
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributeWriters
|
656
|
+
|
657
|
+
include ::Persistence::Object::Complex
|
658
|
+
|
659
|
+
atomic_attribute_writers.empty?.should == true
|
660
|
+
atomic_attribute_readers.empty?.should == true
|
661
|
+
atomic_attribute_accessors.empty?.should == true
|
662
|
+
atomic_attributes.empty?.should == true
|
663
|
+
non_atomic_attributes.empty?.should == true
|
664
|
+
non_atomic_attribute_writers.empty?.should == true
|
665
|
+
non_atomic_attribute_readers.empty?.should == true
|
666
|
+
non_atomic_attribute_accessors.empty?.should == true
|
667
|
+
|
668
|
+
atomic_attribute_writers.push( :some_writer )
|
669
|
+
atomic_attributes[ :some_writer ].should == :writer
|
670
|
+
persistent_attributes[ :some_writer ].should == :writer
|
671
|
+
atomic_attribute_writers.should == [ :some_writer ]
|
672
|
+
atomic_attribute_readers.empty?.should == true
|
673
|
+
atomic_attribute_accessors.empty?.should == true
|
674
|
+
non_atomic_attributes.empty?.should == true
|
675
|
+
non_atomic_attribute_writers.empty?.should == true
|
676
|
+
non_atomic_attribute_readers.empty?.should == true
|
677
|
+
non_atomic_attribute_accessors.empty?.should == true
|
678
|
+
|
679
|
+
atomic_attributes[ :some_writer ] = :accessor
|
680
|
+
atomic_attribute_readers.delete( :some_writer )
|
681
|
+
atomic_attribute_writers.should == [ :some_writer ]
|
682
|
+
atomic_attribute_readers.empty?.should == true
|
683
|
+
atomic_attribute_accessors.empty?.should == true
|
684
|
+
non_atomic_attributes.empty?.should == true
|
685
|
+
non_atomic_attribute_writers.empty?.should == true
|
686
|
+
non_atomic_attribute_readers.empty?.should == true
|
687
|
+
non_atomic_attribute_accessors.empty?.should == true
|
688
|
+
|
689
|
+
atomic_attribute_writers.delete( :some_writer )
|
690
|
+
atomic_attributes[ :some_writer ].should == nil
|
691
|
+
persistent_attributes[ :some_writer ].should == nil
|
692
|
+
atomic_attribute_readers.empty?.should == true
|
693
|
+
atomic_attribute_writers.empty?.should == true
|
694
|
+
atomic_attribute_accessors.empty?.should == true
|
695
|
+
non_atomic_attributes.empty?.should == true
|
696
|
+
non_atomic_attribute_writers.empty?.should == true
|
697
|
+
non_atomic_attribute_readers.empty?.should == true
|
698
|
+
non_atomic_attribute_accessors.empty?.should == true
|
699
|
+
|
700
|
+
end
|
701
|
+
end
|
702
|
+
|
703
|
+
################################
|
704
|
+
# atomic_attribute_accessors #
|
705
|
+
################################
|
706
|
+
|
707
|
+
it 'can declare atomic attribute accessors' do
|
708
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributeAccessors
|
709
|
+
|
710
|
+
include ::Persistence::Object::Complex
|
711
|
+
|
712
|
+
atomic_attribute_writers.empty?.should == true
|
713
|
+
atomic_attribute_readers.empty?.should == true
|
714
|
+
atomic_attribute_accessors.empty?.should == true
|
715
|
+
atomic_attributes.empty?.should == true
|
716
|
+
non_atomic_attributes.empty?.should == true
|
717
|
+
non_atomic_attribute_writers.empty?.should == true
|
718
|
+
non_atomic_attribute_readers.empty?.should == true
|
719
|
+
non_atomic_attribute_accessors.empty?.should == true
|
720
|
+
|
721
|
+
atomic_attribute_accessors.push( :some_accessor )
|
722
|
+
atomic_attributes[ :some_accessor ].should == :accessor
|
723
|
+
persistent_attributes[ :some_accessor ].should == :accessor
|
724
|
+
atomic_attribute_writers.should == [ :some_accessor ]
|
725
|
+
atomic_attribute_readers.should == [ :some_accessor ]
|
726
|
+
atomic_attribute_accessors.should == [ :some_accessor ]
|
727
|
+
non_atomic_attributes.empty?.should == true
|
728
|
+
non_atomic_attribute_writers.empty?.should == true
|
729
|
+
non_atomic_attribute_readers.empty?.should == true
|
730
|
+
non_atomic_attribute_accessors.empty?.should == true
|
731
|
+
|
732
|
+
atomic_attribute_accessors.delete( :some_accessor )
|
733
|
+
atomic_attributes[ :some_accessor ].should == nil
|
734
|
+
persistent_attributes[ :some_accessor ].should == nil
|
735
|
+
atomic_attribute_readers.empty?.should == true
|
736
|
+
atomic_attribute_writers.empty?.should == true
|
737
|
+
atomic_attribute_accessors.empty?.should == true
|
738
|
+
non_atomic_attributes.empty?.should == true
|
739
|
+
non_atomic_attribute_writers.empty?.should == true
|
740
|
+
non_atomic_attribute_readers.empty?.should == true
|
741
|
+
non_atomic_attribute_accessors.empty?.should == true
|
742
|
+
|
743
|
+
end
|
744
|
+
end
|
745
|
+
|
746
|
+
##################################
|
747
|
+
# non_atomic_attribute_readers #
|
748
|
+
##################################
|
749
|
+
|
750
|
+
it 'can declare non-atomic attribute accessors' do
|
751
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributeReaders
|
752
|
+
|
753
|
+
include ::Persistence::Object::Complex
|
754
|
+
|
755
|
+
non_atomic_attribute_writers.empty?.should == true
|
756
|
+
non_atomic_attribute_readers.empty?.should == true
|
757
|
+
non_atomic_attribute_accessors.empty?.should == true
|
758
|
+
non_atomic_attributes.empty?.should == true
|
759
|
+
atomic_attributes.empty?.should == true
|
760
|
+
atomic_attribute_writers.empty?.should == true
|
761
|
+
atomic_attribute_readers.empty?.should == true
|
762
|
+
atomic_attribute_accessors.empty?.should == true
|
763
|
+
|
764
|
+
non_atomic_attribute_readers.push( :some_reader )
|
765
|
+
non_atomic_attributes[ :some_reader ].should == :reader
|
766
|
+
persistent_attributes[ :some_reader ].should == :reader
|
767
|
+
non_atomic_attribute_readers.should == [ :some_reader ]
|
768
|
+
non_atomic_attribute_writers.empty?.should == true
|
769
|
+
non_atomic_attribute_accessors.empty?.should == true
|
770
|
+
atomic_attributes.empty?.should == true
|
771
|
+
atomic_attribute_writers.empty?.should == true
|
772
|
+
atomic_attribute_readers.empty?.should == true
|
773
|
+
atomic_attribute_accessors.empty?.should == true
|
774
|
+
|
775
|
+
non_atomic_attributes[ :some_reader ] = :accessor
|
776
|
+
non_atomic_attribute_writers.delete( :some_reader )
|
777
|
+
non_atomic_attribute_readers.should == [ :some_reader ]
|
778
|
+
non_atomic_attribute_writers.empty?.should == true
|
779
|
+
non_atomic_attribute_accessors.empty?.should == true
|
780
|
+
atomic_attributes.empty?.should == true
|
781
|
+
atomic_attribute_writers.empty?.should == true
|
782
|
+
atomic_attribute_readers.empty?.should == true
|
783
|
+
atomic_attribute_accessors.empty?.should == true
|
784
|
+
|
785
|
+
non_atomic_attribute_readers.delete( :some_reader )
|
786
|
+
non_atomic_attributes[ :some_reader ].should == nil
|
787
|
+
persistent_attributes[ :some_reader ].should == nil
|
788
|
+
non_atomic_attribute_readers.empty?.should == true
|
789
|
+
non_atomic_attribute_writers.empty?.should == true
|
790
|
+
non_atomic_attribute_accessors.empty?.should == true
|
791
|
+
atomic_attributes.empty?.should == true
|
792
|
+
atomic_attribute_writers.empty?.should == true
|
793
|
+
atomic_attribute_readers.empty?.should == true
|
794
|
+
atomic_attribute_accessors.empty?.should == true
|
795
|
+
|
796
|
+
end
|
797
|
+
end
|
798
|
+
|
799
|
+
##################################
|
800
|
+
# non_atomic_attribute_writers #
|
801
|
+
##################################
|
802
|
+
|
803
|
+
it 'can declare non-atomic attribute accessors' do
|
804
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributeWriters
|
805
|
+
|
806
|
+
include ::Persistence::Object::Complex
|
807
|
+
|
808
|
+
non_atomic_attribute_writers.empty?.should == true
|
809
|
+
non_atomic_attribute_readers.empty?.should == true
|
810
|
+
non_atomic_attribute_accessors.empty?.should == true
|
811
|
+
non_atomic_attributes.empty?.should == true
|
812
|
+
atomic_attributes.empty?.should == true
|
813
|
+
atomic_attribute_writers.empty?.should == true
|
814
|
+
atomic_attribute_readers.empty?.should == true
|
815
|
+
atomic_attribute_accessors.empty?.should == true
|
816
|
+
|
817
|
+
non_atomic_attribute_writers.push( :some_writer )
|
818
|
+
non_atomic_attributes[ :some_writer ].should == :writer
|
819
|
+
persistent_attributes[ :some_writer ].should == :writer
|
820
|
+
non_atomic_attribute_writers.should == [ :some_writer ]
|
821
|
+
non_atomic_attribute_readers.empty?.should == true
|
822
|
+
non_atomic_attribute_accessors.empty?.should == true
|
823
|
+
atomic_attributes.empty?.should == true
|
824
|
+
atomic_attribute_writers.empty?.should == true
|
825
|
+
atomic_attribute_readers.empty?.should == true
|
826
|
+
atomic_attribute_accessors.empty?.should == true
|
827
|
+
|
828
|
+
non_atomic_attributes[ :some_writer ] = :accessor
|
829
|
+
non_atomic_attribute_readers.delete( :some_writer )
|
830
|
+
non_atomic_attribute_writers.should == [ :some_writer ]
|
831
|
+
non_atomic_attribute_readers.empty?.should == true
|
832
|
+
non_atomic_attribute_accessors.empty?.should == true
|
833
|
+
atomic_attributes.empty?.should == true
|
834
|
+
atomic_attribute_writers.empty?.should == true
|
835
|
+
atomic_attribute_readers.empty?.should == true
|
836
|
+
atomic_attribute_accessors.empty?.should == true
|
837
|
+
|
838
|
+
non_atomic_attribute_writers.delete( :some_writer )
|
839
|
+
non_atomic_attributes[ :some_writer ].should == nil
|
840
|
+
persistent_attributes[ :some_writer ].should == nil
|
841
|
+
non_atomic_attribute_readers.empty?.should == true
|
842
|
+
non_atomic_attribute_writers.empty?.should == true
|
843
|
+
non_atomic_attribute_accessors.empty?.should == true
|
844
|
+
atomic_attributes.empty?.should == true
|
845
|
+
atomic_attribute_writers.empty?.should == true
|
846
|
+
atomic_attribute_readers.empty?.should == true
|
847
|
+
atomic_attribute_accessors.empty?.should == true
|
848
|
+
|
849
|
+
end
|
850
|
+
end
|
851
|
+
|
852
|
+
####################################
|
853
|
+
# non_atomic_attribute_accessors #
|
854
|
+
####################################
|
855
|
+
|
856
|
+
it 'can declare non-atomic attribute accessors' do
|
857
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributeAccessors
|
858
|
+
|
859
|
+
include ::Persistence::Object::Complex
|
860
|
+
|
861
|
+
non_atomic_attribute_writers.empty?.should == true
|
862
|
+
non_atomic_attribute_readers.empty?.should == true
|
863
|
+
non_atomic_attribute_accessors.empty?.should == true
|
864
|
+
non_atomic_attributes.empty?.should == true
|
865
|
+
atomic_attributes.empty?.should == true
|
866
|
+
atomic_attribute_writers.empty?.should == true
|
867
|
+
atomic_attribute_readers.empty?.should == true
|
868
|
+
atomic_attribute_accessors.empty?.should == true
|
869
|
+
|
870
|
+
non_atomic_attribute_accessors.push( :some_accessor )
|
871
|
+
non_atomic_attributes[ :some_accessor ].should == :accessor
|
872
|
+
persistent_attributes[ :some_accessor ].should == :accessor
|
873
|
+
non_atomic_attribute_writers.should == [ :some_accessor ]
|
874
|
+
non_atomic_attribute_readers.should == [ :some_accessor ]
|
875
|
+
non_atomic_attribute_accessors.should == [ :some_accessor ]
|
876
|
+
atomic_attributes.empty?.should == true
|
877
|
+
atomic_attribute_writers.empty?.should == true
|
878
|
+
atomic_attribute_readers.empty?.should == true
|
879
|
+
atomic_attribute_accessors.empty?.should == true
|
880
|
+
|
881
|
+
non_atomic_attribute_accessors.delete( :some_accessor )
|
882
|
+
non_atomic_attributes[ :some_accessor ].should == nil
|
883
|
+
persistent_attributes[ :some_accessor ].should == nil
|
884
|
+
non_atomic_attribute_readers.empty?.should == true
|
885
|
+
non_atomic_attribute_writers.empty?.should == true
|
886
|
+
non_atomic_attribute_accessors.empty?.should == true
|
887
|
+
atomic_attributes.empty?.should == true
|
888
|
+
atomic_attribute_writers.empty?.should == true
|
889
|
+
atomic_attribute_readers.empty?.should == true
|
890
|
+
atomic_attribute_accessors.empty?.should == true
|
891
|
+
|
892
|
+
end
|
893
|
+
end
|
894
|
+
|
895
|
+
##################################
|
896
|
+
# persistent_attribute_readers #
|
897
|
+
##################################
|
898
|
+
|
899
|
+
it 'can declare persistent attribute readers' do
|
900
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributeReaders
|
901
|
+
|
902
|
+
include ::Persistence::Object::Complex
|
903
|
+
|
904
|
+
# Atomic
|
905
|
+
|
906
|
+
persistent_attribute_readers.default_atomic!
|
907
|
+
|
908
|
+
atomic_attribute_writers.empty?.should == true
|
909
|
+
atomic_attribute_readers.empty?.should == true
|
910
|
+
atomic_attribute_accessors.empty?.should == true
|
911
|
+
atomic_attributes.empty?.should == true
|
912
|
+
non_atomic_attributes.empty?.should == true
|
913
|
+
non_atomic_attribute_writers.empty?.should == true
|
914
|
+
non_atomic_attribute_readers.empty?.should == true
|
915
|
+
non_atomic_attribute_accessors.empty?.should == true
|
916
|
+
|
917
|
+
atomic_attribute_readers.push( :some_reader )
|
918
|
+
atomic_attributes[ :some_reader ].should == :reader
|
919
|
+
persistent_attributes[ :some_reader ].should == :reader
|
920
|
+
atomic_attribute_readers.should == [ :some_reader ]
|
921
|
+
atomic_attribute_writers.empty?.should == true
|
922
|
+
atomic_attribute_accessors.empty?.should == true
|
923
|
+
non_atomic_attributes.empty?.should == true
|
924
|
+
non_atomic_attribute_writers.empty?.should == true
|
925
|
+
non_atomic_attribute_readers.empty?.should == true
|
926
|
+
non_atomic_attribute_accessors.empty?.should == true
|
927
|
+
|
928
|
+
atomic_attributes[ :some_reader ] = :accessor
|
929
|
+
atomic_attribute_writers.delete( :some_reader )
|
930
|
+
atomic_attribute_readers.should == [ :some_reader ]
|
931
|
+
atomic_attribute_writers.empty?.should == true
|
932
|
+
atomic_attribute_accessors.empty?.should == true
|
933
|
+
non_atomic_attributes.empty?.should == true
|
934
|
+
non_atomic_attribute_writers.empty?.should == true
|
935
|
+
non_atomic_attribute_readers.empty?.should == true
|
936
|
+
non_atomic_attribute_accessors.empty?.should == true
|
937
|
+
|
938
|
+
atomic_attribute_readers.delete( :some_reader )
|
939
|
+
atomic_attributes[ :some_reader ].should == nil
|
940
|
+
persistent_attributes[ :some_reader ].should == nil
|
941
|
+
atomic_attribute_readers.empty?.should == true
|
942
|
+
atomic_attribute_writers.empty?.should == true
|
943
|
+
atomic_attribute_accessors.empty?.should == true
|
944
|
+
non_atomic_attributes.empty?.should == true
|
945
|
+
non_atomic_attribute_writers.empty?.should == true
|
946
|
+
non_atomic_attribute_readers.empty?.should == true
|
947
|
+
non_atomic_attribute_accessors.empty?.should == true
|
948
|
+
|
949
|
+
# Non-Atomic
|
950
|
+
|
951
|
+
persistent_attribute_readers.default_non_atomic!
|
952
|
+
|
953
|
+
non_atomic_attribute_writers.empty?.should == true
|
954
|
+
non_atomic_attribute_readers.empty?.should == true
|
955
|
+
non_atomic_attribute_accessors.empty?.should == true
|
956
|
+
non_atomic_attributes.empty?.should == true
|
957
|
+
atomic_attributes.empty?.should == true
|
958
|
+
atomic_attribute_writers.empty?.should == true
|
959
|
+
atomic_attribute_readers.empty?.should == true
|
960
|
+
atomic_attribute_accessors.empty?.should == true
|
961
|
+
|
962
|
+
non_atomic_attribute_readers.push( :some_reader )
|
963
|
+
non_atomic_attributes[ :some_reader ].should == :reader
|
964
|
+
persistent_attributes[ :some_reader ].should == :reader
|
965
|
+
non_atomic_attribute_readers.should == [ :some_reader ]
|
966
|
+
non_atomic_attribute_writers.empty?.should == true
|
967
|
+
non_atomic_attribute_accessors.empty?.should == true
|
968
|
+
atomic_attributes.empty?.should == true
|
969
|
+
atomic_attribute_writers.empty?.should == true
|
970
|
+
atomic_attribute_readers.empty?.should == true
|
971
|
+
atomic_attribute_accessors.empty?.should == true
|
972
|
+
|
973
|
+
non_atomic_attributes[ :some_reader ] = :accessor
|
974
|
+
non_atomic_attribute_writers.delete( :some_reader )
|
975
|
+
non_atomic_attribute_readers.should == [ :some_reader ]
|
976
|
+
non_atomic_attribute_writers.empty?.should == true
|
977
|
+
non_atomic_attribute_accessors.empty?.should == true
|
978
|
+
atomic_attributes.empty?.should == true
|
979
|
+
atomic_attribute_writers.empty?.should == true
|
980
|
+
atomic_attribute_readers.empty?.should == true
|
981
|
+
atomic_attribute_accessors.empty?.should == true
|
982
|
+
|
983
|
+
non_atomic_attribute_readers.delete( :some_reader )
|
984
|
+
non_atomic_attributes[ :some_reader ].should == nil
|
985
|
+
persistent_attributes[ :some_reader ].should == nil
|
986
|
+
non_atomic_attribute_readers.empty?.should == true
|
987
|
+
non_atomic_attribute_writers.empty?.should == true
|
988
|
+
non_atomic_attribute_accessors.empty?.should == true
|
989
|
+
atomic_attributes.empty?.should == true
|
990
|
+
atomic_attribute_writers.empty?.should == true
|
991
|
+
atomic_attribute_readers.empty?.should == true
|
992
|
+
atomic_attribute_accessors.empty?.should == true
|
993
|
+
|
994
|
+
end
|
995
|
+
end
|
996
|
+
|
997
|
+
##################################
|
998
|
+
# persistent_attribute_writers #
|
999
|
+
##################################
|
1000
|
+
|
1001
|
+
it 'can declare persistent attribute writers' do
|
1002
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributeWriters
|
1003
|
+
|
1004
|
+
include ::Persistence::Object::Complex
|
1005
|
+
|
1006
|
+
# Atomic
|
1007
|
+
|
1008
|
+
persistent_attribute_writers.default_atomic!
|
1009
|
+
|
1010
|
+
atomic_attribute_writers.empty?.should == true
|
1011
|
+
atomic_attribute_readers.empty?.should == true
|
1012
|
+
atomic_attribute_accessors.empty?.should == true
|
1013
|
+
atomic_attributes.empty?.should == true
|
1014
|
+
non_atomic_attributes.empty?.should == true
|
1015
|
+
non_atomic_attribute_writers.empty?.should == true
|
1016
|
+
non_atomic_attribute_readers.empty?.should == true
|
1017
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1018
|
+
|
1019
|
+
atomic_attribute_writers.push( :some_writer )
|
1020
|
+
atomic_attributes[ :some_writer ].should == :writer
|
1021
|
+
persistent_attributes[ :some_writer ].should == :writer
|
1022
|
+
atomic_attribute_writers.should == [ :some_writer ]
|
1023
|
+
atomic_attribute_readers.empty?.should == true
|
1024
|
+
atomic_attribute_accessors.empty?.should == true
|
1025
|
+
non_atomic_attributes.empty?.should == true
|
1026
|
+
non_atomic_attribute_writers.empty?.should == true
|
1027
|
+
non_atomic_attribute_readers.empty?.should == true
|
1028
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1029
|
+
|
1030
|
+
atomic_attributes[ :some_writer ] = :accessor
|
1031
|
+
atomic_attribute_readers.delete( :some_writer )
|
1032
|
+
atomic_attribute_writers.should == [ :some_writer ]
|
1033
|
+
atomic_attribute_readers.empty?.should == true
|
1034
|
+
atomic_attribute_accessors.empty?.should == true
|
1035
|
+
non_atomic_attributes.empty?.should == true
|
1036
|
+
non_atomic_attribute_writers.empty?.should == true
|
1037
|
+
non_atomic_attribute_readers.empty?.should == true
|
1038
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1039
|
+
|
1040
|
+
atomic_attribute_writers.delete( :some_writer )
|
1041
|
+
atomic_attributes[ :some_writer ].should == nil
|
1042
|
+
persistent_attributes[ :some_writer ].should == nil
|
1043
|
+
atomic_attribute_readers.empty?.should == true
|
1044
|
+
atomic_attribute_writers.empty?.should == true
|
1045
|
+
atomic_attribute_accessors.empty?.should == true
|
1046
|
+
non_atomic_attributes.empty?.should == true
|
1047
|
+
non_atomic_attribute_writers.empty?.should == true
|
1048
|
+
non_atomic_attribute_readers.empty?.should == true
|
1049
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1050
|
+
|
1051
|
+
# Non-Atomic
|
1052
|
+
|
1053
|
+
persistent_attribute_writers.default_non_atomic!
|
1054
|
+
|
1055
|
+
non_atomic_attribute_writers.empty?.should == true
|
1056
|
+
non_atomic_attribute_readers.empty?.should == true
|
1057
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1058
|
+
non_atomic_attributes.empty?.should == true
|
1059
|
+
atomic_attributes.empty?.should == true
|
1060
|
+
atomic_attribute_writers.empty?.should == true
|
1061
|
+
atomic_attribute_readers.empty?.should == true
|
1062
|
+
atomic_attribute_accessors.empty?.should == true
|
1063
|
+
|
1064
|
+
non_atomic_attribute_writers.push( :some_writer )
|
1065
|
+
non_atomic_attributes[ :some_writer ].should == :writer
|
1066
|
+
persistent_attributes[ :some_writer ].should == :writer
|
1067
|
+
non_atomic_attribute_writers.should == [ :some_writer ]
|
1068
|
+
non_atomic_attribute_readers.empty?.should == true
|
1069
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1070
|
+
atomic_attributes.empty?.should == true
|
1071
|
+
atomic_attribute_writers.empty?.should == true
|
1072
|
+
atomic_attribute_readers.empty?.should == true
|
1073
|
+
atomic_attribute_accessors.empty?.should == true
|
1074
|
+
|
1075
|
+
non_atomic_attributes[ :some_writer ] = :accessor
|
1076
|
+
non_atomic_attribute_readers.delete( :some_writer )
|
1077
|
+
non_atomic_attribute_writers.should == [ :some_writer ]
|
1078
|
+
non_atomic_attribute_readers.empty?.should == true
|
1079
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1080
|
+
atomic_attributes.empty?.should == true
|
1081
|
+
atomic_attribute_writers.empty?.should == true
|
1082
|
+
atomic_attribute_readers.empty?.should == true
|
1083
|
+
atomic_attribute_accessors.empty?.should == true
|
1084
|
+
|
1085
|
+
non_atomic_attribute_writers.delete( :some_writer )
|
1086
|
+
non_atomic_attributes[ :some_writer ].should == nil
|
1087
|
+
persistent_attributes[ :some_writer ].should == nil
|
1088
|
+
non_atomic_attribute_readers.empty?.should == true
|
1089
|
+
non_atomic_attribute_writers.empty?.should == true
|
1090
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1091
|
+
atomic_attributes.empty?.should == true
|
1092
|
+
atomic_attribute_writers.empty?.should == true
|
1093
|
+
atomic_attribute_readers.empty?.should == true
|
1094
|
+
atomic_attribute_accessors.empty?.should == true
|
1095
|
+
|
1096
|
+
end
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
####################################
|
1100
|
+
# persistent_attribute_accessors #
|
1101
|
+
####################################
|
1102
|
+
|
1103
|
+
it 'can declare persistent attribute accessors' do
|
1104
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributeAccessors
|
1105
|
+
|
1106
|
+
include ::Persistence::Object::Complex
|
1107
|
+
|
1108
|
+
# Atomic
|
1109
|
+
|
1110
|
+
persistent_attribute_accessors.default_atomic!
|
1111
|
+
|
1112
|
+
atomic_attribute_writers.empty?.should == true
|
1113
|
+
atomic_attribute_readers.empty?.should == true
|
1114
|
+
atomic_attribute_accessors.empty?.should == true
|
1115
|
+
atomic_attributes.empty?.should == true
|
1116
|
+
non_atomic_attributes.empty?.should == true
|
1117
|
+
non_atomic_attribute_writers.empty?.should == true
|
1118
|
+
non_atomic_attribute_readers.empty?.should == true
|
1119
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1120
|
+
|
1121
|
+
atomic_attribute_accessors.push( :some_accessor )
|
1122
|
+
atomic_attributes[ :some_accessor ].should == :accessor
|
1123
|
+
persistent_attributes[ :some_accessor ].should == :accessor
|
1124
|
+
atomic_attribute_writers.should == [ :some_accessor ]
|
1125
|
+
atomic_attribute_readers.should == [ :some_accessor ]
|
1126
|
+
atomic_attribute_accessors.should == [ :some_accessor ]
|
1127
|
+
non_atomic_attributes.empty?.should == true
|
1128
|
+
non_atomic_attribute_writers.empty?.should == true
|
1129
|
+
non_atomic_attribute_readers.empty?.should == true
|
1130
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1131
|
+
|
1132
|
+
atomic_attribute_accessors.delete( :some_accessor )
|
1133
|
+
atomic_attributes[ :some_accessor ].should == nil
|
1134
|
+
persistent_attributes[ :some_accessor ].should == nil
|
1135
|
+
atomic_attribute_readers.empty?.should == true
|
1136
|
+
atomic_attribute_writers.empty?.should == true
|
1137
|
+
atomic_attribute_accessors.empty?.should == true
|
1138
|
+
non_atomic_attributes.empty?.should == true
|
1139
|
+
non_atomic_attribute_writers.empty?.should == true
|
1140
|
+
non_atomic_attribute_readers.empty?.should == true
|
1141
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1142
|
+
|
1143
|
+
|
1144
|
+
# Non-Atomic
|
1145
|
+
|
1146
|
+
persistent_attribute_accessors.default_non_atomic!
|
1147
|
+
|
1148
|
+
non_atomic_attribute_writers.empty?.should == true
|
1149
|
+
non_atomic_attribute_readers.empty?.should == true
|
1150
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1151
|
+
non_atomic_attributes.empty?.should == true
|
1152
|
+
atomic_attributes.empty?.should == true
|
1153
|
+
atomic_attribute_writers.empty?.should == true
|
1154
|
+
atomic_attribute_readers.empty?.should == true
|
1155
|
+
atomic_attribute_accessors.empty?.should == true
|
1156
|
+
|
1157
|
+
non_atomic_attribute_accessors.push( :some_accessor )
|
1158
|
+
non_atomic_attributes[ :some_accessor ].should == :accessor
|
1159
|
+
persistent_attributes[ :some_accessor ].should == :accessor
|
1160
|
+
non_atomic_attribute_writers.should == [ :some_accessor ]
|
1161
|
+
non_atomic_attribute_readers.should == [ :some_accessor ]
|
1162
|
+
non_atomic_attribute_accessors.should == [ :some_accessor ]
|
1163
|
+
atomic_attributes.empty?.should == true
|
1164
|
+
atomic_attribute_writers.empty?.should == true
|
1165
|
+
atomic_attribute_readers.empty?.should == true
|
1166
|
+
atomic_attribute_accessors.empty?.should == true
|
1167
|
+
|
1168
|
+
non_atomic_attribute_accessors.delete( :some_accessor )
|
1169
|
+
non_atomic_attributes[ :some_accessor ].should == nil
|
1170
|
+
persistent_attributes[ :some_accessor ].should == nil
|
1171
|
+
non_atomic_attribute_readers.empty?.should == true
|
1172
|
+
non_atomic_attribute_writers.empty?.should == true
|
1173
|
+
non_atomic_attribute_accessors.empty?.should == true
|
1174
|
+
atomic_attributes.empty?.should == true
|
1175
|
+
atomic_attribute_writers.empty?.should == true
|
1176
|
+
atomic_attribute_readers.empty?.should == true
|
1177
|
+
atomic_attribute_accessors.empty?.should == true
|
1178
|
+
|
1179
|
+
end
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
#######################
|
1183
|
+
# atomic_attribute? #
|
1184
|
+
#######################
|
1185
|
+
|
1186
|
+
it 'can report whether an attribute is atomic (:accessor, :reader, :writer).' do
|
1187
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributeQ
|
1188
|
+
include ::Persistence::Object::Complex
|
1189
|
+
atomic_attributes[ :some_accessor ] = :accessor
|
1190
|
+
atomic_attributes[ :some_reader ] = :reader
|
1191
|
+
atomic_attributes[ :some_writer ] = :writer
|
1192
|
+
end
|
1193
|
+
::Persistence::Object::Complex::Attributes::AtomicAttributeQ.new.instance_eval do
|
1194
|
+
|
1195
|
+
atomic_attribute?( :some_accessor ).should == true
|
1196
|
+
atomic_attribute?( :some_reader ).should == true
|
1197
|
+
atomic_attribute?( :some_writer ).should == true
|
1198
|
+
atomic_attribute?( :some_other_accessor ).should == false
|
1199
|
+
atomic_attribute?( :some_other_reader ).should == false
|
1200
|
+
atomic_attribute?( :some_other_writer ).should == false
|
1201
|
+
|
1202
|
+
atomic_attribute?( :some_accessor ).should == true
|
1203
|
+
atomic_attribute?( :some_reader ).should == true
|
1204
|
+
atomic_attribute?( :some_writer ).should == true
|
1205
|
+
atomic_attribute?( :some_other_accessor ).should == false
|
1206
|
+
atomic_attribute?( :some_other_reader ).should == false
|
1207
|
+
atomic_attribute?( :some_other_writer ).should == false
|
1208
|
+
|
1209
|
+
end
|
1210
|
+
end
|
1211
|
+
|
1212
|
+
################################
|
1213
|
+
# atomic_attribute_accessor? #
|
1214
|
+
################################
|
1215
|
+
|
1216
|
+
it 'can report whether an attribute is a atomic :accessor' do
|
1217
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributeAccessorQ
|
1218
|
+
include ::Persistence::Object::Complex
|
1219
|
+
atomic_attributes[ :some_accessor ] = :accessor
|
1220
|
+
atomic_attributes[ :some_reader ] = :reader
|
1221
|
+
atomic_attributes[ :some_writer ] = :writer
|
1222
|
+
end
|
1223
|
+
::Persistence::Object::Complex::Attributes::AtomicAttributeAccessorQ.new.instance_eval do
|
1224
|
+
|
1225
|
+
atomic_attribute_accessor?( :some_accessor ).should == true
|
1226
|
+
atomic_attribute_accessor?( :some_reader ).should == false
|
1227
|
+
atomic_attribute_accessor?( :some_writer ).should == false
|
1228
|
+
atomic_attribute_accessor?( :some_other_accessor ).should == false
|
1229
|
+
atomic_attribute_accessor?( :some_other_reader ).should == false
|
1230
|
+
atomic_attribute_accessor?( :some_other_writer ).should == false
|
1231
|
+
|
1232
|
+
atomic_attribute_accessor?( :some_accessor ).should == true
|
1233
|
+
atomic_attribute_accessor?( :some_reader ).should == false
|
1234
|
+
atomic_attribute_accessor?( :some_writer ).should == false
|
1235
|
+
atomic_attribute_accessor?( :some_other_accessor ).should == false
|
1236
|
+
atomic_attribute_accessor?( :some_other_reader ).should == false
|
1237
|
+
atomic_attribute_accessor?( :some_other_writer ).should == false
|
1238
|
+
|
1239
|
+
end
|
1240
|
+
end
|
1241
|
+
|
1242
|
+
##############################
|
1243
|
+
# atomic_attribute_reader? #
|
1244
|
+
##############################
|
1245
|
+
|
1246
|
+
it 'can report whether an attribute is a atomic :reader' do
|
1247
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributeReaderQ
|
1248
|
+
include ::Persistence::Object::Complex
|
1249
|
+
atomic_attributes[ :some_accessor ] = :accessor
|
1250
|
+
atomic_attributes[ :some_reader ] = :reader
|
1251
|
+
atomic_attributes[ :some_writer ] = :writer
|
1252
|
+
end
|
1253
|
+
::Persistence::Object::Complex::Attributes::AtomicAttributeReaderQ.new.instance_eval do
|
1254
|
+
|
1255
|
+
atomic_attribute_reader?( :some_accessor ).should == true
|
1256
|
+
atomic_attribute_reader?( :some_reader ).should == true
|
1257
|
+
atomic_attribute_reader?( :some_writer ).should == false
|
1258
|
+
atomic_attribute_reader?( :some_other_accessor ).should == false
|
1259
|
+
atomic_attribute_reader?( :some_other_reader ).should == false
|
1260
|
+
atomic_attribute_reader?( :some_other_writer ).should == false
|
1261
|
+
|
1262
|
+
atomic_attribute_reader?( :some_accessor ).should == true
|
1263
|
+
atomic_attribute_reader?( :some_reader ).should == true
|
1264
|
+
atomic_attribute_reader?( :some_writer ).should == false
|
1265
|
+
atomic_attribute_reader?( :some_other_accessor ).should == false
|
1266
|
+
atomic_attribute_reader?( :some_other_reader ).should == false
|
1267
|
+
atomic_attribute_reader?( :some_other_writer ).should == false
|
1268
|
+
|
1269
|
+
end
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
##############################
|
1273
|
+
# atomic_attribute_writer? #
|
1274
|
+
##############################
|
1275
|
+
|
1276
|
+
it 'can report whether an attribute is a atomic :writer' do
|
1277
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributeWriterQ
|
1278
|
+
include ::Persistence::Object::Complex
|
1279
|
+
atomic_attributes[ :some_accessor ] = :accessor
|
1280
|
+
atomic_attributes[ :some_reader ] = :reader
|
1281
|
+
atomic_attributes[ :some_writer ] = :writer
|
1282
|
+
end
|
1283
|
+
::Persistence::Object::Complex::Attributes::AtomicAttributeWriterQ.new.instance_eval do
|
1284
|
+
|
1285
|
+
atomic_attribute_writer?( :some_accessor ).should == true
|
1286
|
+
atomic_attribute_writer?( :some_reader ).should == false
|
1287
|
+
atomic_attribute_writer?( :some_writer ).should == true
|
1288
|
+
atomic_attribute_writer?( :some_other_accessor ).should == false
|
1289
|
+
atomic_attribute_writer?( :some_other_reader ).should == false
|
1290
|
+
atomic_attribute_writer?( :some_other_writer ).should == false
|
1291
|
+
|
1292
|
+
atomic_attribute_writer?( :some_accessor ).should == true
|
1293
|
+
atomic_attribute_writer?( :some_reader ).should == false
|
1294
|
+
atomic_attribute_writer?( :some_writer ).should == true
|
1295
|
+
atomic_attribute_writer?( :some_other_accessor ).should == false
|
1296
|
+
atomic_attribute_writer?( :some_other_reader ).should == false
|
1297
|
+
atomic_attribute_writer?( :some_other_writer ).should == false
|
1298
|
+
|
1299
|
+
end
|
1300
|
+
end
|
1301
|
+
|
1302
|
+
#############################
|
1303
|
+
# atomic_attribute_status #
|
1304
|
+
#############################
|
1305
|
+
|
1306
|
+
it 'can report the current atomic status (:accessor, :reader, :writer) of an attribute' do
|
1307
|
+
class ::Persistence::Object::Complex::Attributes::AtomicAttributeStatus
|
1308
|
+
include ::Persistence::Object::Complex
|
1309
|
+
atomic_attributes[ :some_accessor ] = :accessor
|
1310
|
+
atomic_attributes[ :some_reader ] = :reader
|
1311
|
+
atomic_attributes[ :some_writer ] = :writer
|
1312
|
+
end
|
1313
|
+
::Persistence::Object::Complex::Attributes::AtomicAttributeStatus.new.instance_eval do
|
1314
|
+
|
1315
|
+
atomic_attribute_status( :some_accessor ).should == :accessor
|
1316
|
+
atomic_attribute_status( :some_reader ).should == :reader
|
1317
|
+
atomic_attribute_status( :some_writer ).should == :writer
|
1318
|
+
atomic_attribute_status( :some_other_accessor ).should == nil
|
1319
|
+
atomic_attribute_status( :some_other_reader ).should == nil
|
1320
|
+
atomic_attribute_status( :some_other_writer ).should == nil
|
1321
|
+
|
1322
|
+
atomic_attribute_status( :some_accessor ).should == :accessor
|
1323
|
+
atomic_attribute_status( :some_reader ).should == :reader
|
1324
|
+
atomic_attribute_status( :some_writer ).should == :writer
|
1325
|
+
atomic_attribute_status( :some_other_accessor ).should == nil
|
1326
|
+
atomic_attribute_status( :some_other_reader ).should == nil
|
1327
|
+
atomic_attribute_status( :some_other_writer ).should == nil
|
1328
|
+
|
1329
|
+
end
|
1330
|
+
end
|
1331
|
+
|
1332
|
+
###########################
|
1333
|
+
# non_atomic_attribute? #
|
1334
|
+
###########################
|
1335
|
+
|
1336
|
+
it 'can report whether an attribute is non_atomic (:accessor, :reader, :writer).' do
|
1337
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributeQ
|
1338
|
+
include ::Persistence::Object::Complex
|
1339
|
+
non_atomic_attributes[ :some_accessor ] = :accessor
|
1340
|
+
non_atomic_attributes[ :some_reader ] = :reader
|
1341
|
+
non_atomic_attributes[ :some_writer ] = :writer
|
1342
|
+
end
|
1343
|
+
::Persistence::Object::Complex::Attributes::NonAtomicAttributeQ.new.instance_eval do
|
1344
|
+
|
1345
|
+
non_atomic_attribute?( :some_accessor ).should == true
|
1346
|
+
non_atomic_attribute?( :some_reader ).should == true
|
1347
|
+
non_atomic_attribute?( :some_writer ).should == true
|
1348
|
+
non_atomic_attribute?( :some_other_accessor ).should == false
|
1349
|
+
non_atomic_attribute?( :some_other_reader ).should == false
|
1350
|
+
non_atomic_attribute?( :some_other_writer ).should == false
|
1351
|
+
|
1352
|
+
non_atomic_attribute?( :some_accessor ).should == true
|
1353
|
+
non_atomic_attribute?( :some_reader ).should == true
|
1354
|
+
non_atomic_attribute?( :some_writer ).should == true
|
1355
|
+
non_atomic_attribute?( :some_other_accessor ).should == false
|
1356
|
+
non_atomic_attribute?( :some_other_reader ).should == false
|
1357
|
+
non_atomic_attribute?( :some_other_writer ).should == false
|
1358
|
+
|
1359
|
+
end
|
1360
|
+
end
|
1361
|
+
|
1362
|
+
####################################
|
1363
|
+
# non_atomic_attribute_accessor? #
|
1364
|
+
####################################
|
1365
|
+
|
1366
|
+
it 'can report whether an attribute is a non_atomic :accessor' do
|
1367
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributeAccessorQ
|
1368
|
+
include ::Persistence::Object::Complex
|
1369
|
+
non_atomic_attributes[ :some_accessor ] = :accessor
|
1370
|
+
non_atomic_attributes[ :some_reader ] = :reader
|
1371
|
+
non_atomic_attributes[ :some_writer ] = :writer
|
1372
|
+
end
|
1373
|
+
::Persistence::Object::Complex::Attributes::NonAtomicAttributeAccessorQ.new.instance_eval do
|
1374
|
+
|
1375
|
+
non_atomic_attribute_accessor?( :some_accessor ).should == true
|
1376
|
+
non_atomic_attribute_accessor?( :some_reader ).should == false
|
1377
|
+
non_atomic_attribute_accessor?( :some_writer ).should == false
|
1378
|
+
non_atomic_attribute_accessor?( :some_other_accessor ).should == false
|
1379
|
+
non_atomic_attribute_accessor?( :some_other_reader ).should == false
|
1380
|
+
non_atomic_attribute_accessor?( :some_other_writer ).should == false
|
1381
|
+
|
1382
|
+
non_atomic_attribute_accessor?( :some_accessor ).should == true
|
1383
|
+
non_atomic_attribute_accessor?( :some_reader ).should == false
|
1384
|
+
non_atomic_attribute_accessor?( :some_writer ).should == false
|
1385
|
+
non_atomic_attribute_accessor?( :some_other_accessor ).should == false
|
1386
|
+
non_atomic_attribute_accessor?( :some_other_reader ).should == false
|
1387
|
+
non_atomic_attribute_accessor?( :some_other_writer ).should == false
|
1388
|
+
|
1389
|
+
end
|
1390
|
+
end
|
1391
|
+
|
1392
|
+
##################################
|
1393
|
+
# non_atomic_attribute_reader? #
|
1394
|
+
##################################
|
1395
|
+
|
1396
|
+
it 'can report whether an attribute is a non_atomic :reader' do
|
1397
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributeReaderQ
|
1398
|
+
include ::Persistence::Object::Complex
|
1399
|
+
non_atomic_attributes[ :some_accessor ] = :accessor
|
1400
|
+
non_atomic_attributes[ :some_reader ] = :reader
|
1401
|
+
non_atomic_attributes[ :some_writer ] = :writer
|
1402
|
+
end
|
1403
|
+
::Persistence::Object::Complex::Attributes::NonAtomicAttributeReaderQ.new.instance_eval do
|
1404
|
+
|
1405
|
+
non_atomic_attribute_reader?( :some_accessor ).should == true
|
1406
|
+
non_atomic_attribute_reader?( :some_reader ).should == true
|
1407
|
+
non_atomic_attribute_reader?( :some_writer ).should == false
|
1408
|
+
non_atomic_attribute_reader?( :some_other_accessor ).should == false
|
1409
|
+
non_atomic_attribute_reader?( :some_other_reader ).should == false
|
1410
|
+
non_atomic_attribute_reader?( :some_other_writer ).should == false
|
1411
|
+
|
1412
|
+
non_atomic_attribute_reader?( :some_accessor ).should == true
|
1413
|
+
non_atomic_attribute_reader?( :some_reader ).should == true
|
1414
|
+
non_atomic_attribute_reader?( :some_writer ).should == false
|
1415
|
+
non_atomic_attribute_reader?( :some_other_accessor ).should == false
|
1416
|
+
non_atomic_attribute_reader?( :some_other_reader ).should == false
|
1417
|
+
non_atomic_attribute_reader?( :some_other_writer ).should == false
|
1418
|
+
|
1419
|
+
end
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
##################################
|
1423
|
+
# non_atomic_attribute_writer? #
|
1424
|
+
##################################
|
1425
|
+
|
1426
|
+
it 'can report whether an attribute is a non_atomic :writer' do
|
1427
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributeWriterQ
|
1428
|
+
include ::Persistence::Object::Complex
|
1429
|
+
non_atomic_attributes[ :some_accessor ] = :accessor
|
1430
|
+
non_atomic_attributes[ :some_reader ] = :reader
|
1431
|
+
non_atomic_attributes[ :some_writer ] = :writer
|
1432
|
+
end
|
1433
|
+
::Persistence::Object::Complex::Attributes::NonAtomicAttributeWriterQ.new.instance_eval do
|
1434
|
+
|
1435
|
+
non_atomic_attribute_writer?( :some_accessor ).should == true
|
1436
|
+
non_atomic_attribute_writer?( :some_reader ).should == false
|
1437
|
+
non_atomic_attribute_writer?( :some_writer ).should == true
|
1438
|
+
non_atomic_attribute_writer?( :some_other_accessor ).should == false
|
1439
|
+
non_atomic_attribute_writer?( :some_other_reader ).should == false
|
1440
|
+
non_atomic_attribute_writer?( :some_other_writer ).should == false
|
1441
|
+
|
1442
|
+
non_atomic_attribute_writer?( :some_accessor ).should == true
|
1443
|
+
non_atomic_attribute_writer?( :some_reader ).should == false
|
1444
|
+
non_atomic_attribute_writer?( :some_writer ).should == true
|
1445
|
+
non_atomic_attribute_writer?( :some_other_accessor ).should == false
|
1446
|
+
non_atomic_attribute_writer?( :some_other_reader ).should == false
|
1447
|
+
non_atomic_attribute_writer?( :some_other_writer ).should == false
|
1448
|
+
|
1449
|
+
end
|
1450
|
+
end
|
1451
|
+
|
1452
|
+
#################################
|
1453
|
+
# non_atomic_attribute_status #
|
1454
|
+
#################################
|
1455
|
+
|
1456
|
+
it 'can report the current non_atomic status (:accessor, :reader, :writer) of an attribute' do
|
1457
|
+
class ::Persistence::Object::Complex::Attributes::NonAtomicAttributeStatus
|
1458
|
+
include ::Persistence::Object::Complex
|
1459
|
+
non_atomic_attributes[ :some_accessor ] = :accessor
|
1460
|
+
non_atomic_attributes[ :some_reader ] = :reader
|
1461
|
+
non_atomic_attributes[ :some_writer ] = :writer
|
1462
|
+
end
|
1463
|
+
::Persistence::Object::Complex::Attributes::NonAtomicAttributeStatus.new.instance_eval do
|
1464
|
+
|
1465
|
+
non_atomic_attribute_status( :some_accessor ).should == :accessor
|
1466
|
+
non_atomic_attribute_status( :some_reader ).should == :reader
|
1467
|
+
non_atomic_attribute_status( :some_writer ).should == :writer
|
1468
|
+
non_atomic_attribute_status( :some_other_accessor ).should == nil
|
1469
|
+
non_atomic_attribute_status( :some_other_reader ).should == nil
|
1470
|
+
non_atomic_attribute_status( :some_other_writer ).should == nil
|
1471
|
+
|
1472
|
+
non_atomic_attribute_status( :some_accessor ).should == :accessor
|
1473
|
+
non_atomic_attribute_status( :some_reader ).should == :reader
|
1474
|
+
non_atomic_attribute_status( :some_writer ).should == :writer
|
1475
|
+
non_atomic_attribute_status( :some_other_accessor ).should == nil
|
1476
|
+
non_atomic_attribute_status( :some_other_reader ).should == nil
|
1477
|
+
non_atomic_attribute_status( :some_other_writer ).should == nil
|
1478
|
+
|
1479
|
+
end
|
1480
|
+
end
|
1481
|
+
|
1482
|
+
###########################
|
1483
|
+
# persistent_attribute? #
|
1484
|
+
###########################
|
1485
|
+
|
1486
|
+
it 'can report whether an attribute is persistent (:accessor, :reader, :writer).' do
|
1487
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributeQ
|
1488
|
+
include ::Persistence::Object::Complex
|
1489
|
+
non_atomic_attributes[ :some_non_atomic_accessor ] = :accessor
|
1490
|
+
non_atomic_attributes[ :some_non_atomic_reader ] = :reader
|
1491
|
+
non_atomic_attributes[ :some_non_atomic_writer ] = :writer
|
1492
|
+
atomic_attributes[ :some_atomic_accessor ] = :accessor
|
1493
|
+
atomic_attributes[ :some_atomic_reader ] = :reader
|
1494
|
+
atomic_attributes[ :some_atomic_writer ] = :writer
|
1495
|
+
end
|
1496
|
+
::Persistence::Object::Complex::Attributes::PersistentAttributeQ.new.instance_eval do
|
1497
|
+
|
1498
|
+
persistent_attribute?( :some_non_atomic_accessor ).should == true
|
1499
|
+
persistent_attribute?( :some_non_atomic_reader ).should == true
|
1500
|
+
persistent_attribute?( :some_non_atomic_writer ).should == true
|
1501
|
+
persistent_attribute?( :some_non_atomic_other_accessor ).should == false
|
1502
|
+
persistent_attribute?( :some_non_atomic_other_reader ).should == false
|
1503
|
+
persistent_attribute?( :some_non_atomic_other_writer ).should == false
|
1504
|
+
|
1505
|
+
persistent_attribute?( :some_non_atomic_accessor ).should == true
|
1506
|
+
persistent_attribute?( :some_non_atomic_reader ).should == true
|
1507
|
+
persistent_attribute?( :some_non_atomic_writer ).should == true
|
1508
|
+
persistent_attribute?( :some_non_atomic_other_accessor ).should == false
|
1509
|
+
persistent_attribute?( :some_non_atomic_other_reader ).should == false
|
1510
|
+
persistent_attribute?( :some_non_atomic_other_writer ).should == false
|
1511
|
+
|
1512
|
+
persistent_attribute?( :some_atomic_accessor ).should == true
|
1513
|
+
persistent_attribute?( :some_atomic_reader ).should == true
|
1514
|
+
persistent_attribute?( :some_atomic_writer ).should == true
|
1515
|
+
persistent_attribute?( :some_atomic_other_accessor ).should == false
|
1516
|
+
persistent_attribute?( :some_atomic_other_reader ).should == false
|
1517
|
+
persistent_attribute?( :some_atomic_other_writer ).should == false
|
1518
|
+
|
1519
|
+
persistent_attribute?( :some_atomic_accessor ).should == true
|
1520
|
+
persistent_attribute?( :some_atomic_reader ).should == true
|
1521
|
+
persistent_attribute?( :some_atomic_writer ).should == true
|
1522
|
+
persistent_attribute?( :some_atomic_other_accessor ).should == false
|
1523
|
+
persistent_attribute?( :some_atomic_other_reader ).should == false
|
1524
|
+
persistent_attribute?( :some_atomic_other_writer ).should == false
|
1525
|
+
|
1526
|
+
end
|
1527
|
+
end
|
1528
|
+
|
1529
|
+
####################################
|
1530
|
+
# persistent_attribute_accessor? #
|
1531
|
+
####################################
|
1532
|
+
|
1533
|
+
it 'can report whether an attribute is a persistent :accessor' do
|
1534
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributeAccessorQ
|
1535
|
+
include ::Persistence::Object::Complex
|
1536
|
+
non_atomic_attributes[ :some_non_atomic_accessor ] = :accessor
|
1537
|
+
non_atomic_attributes[ :some_non_atomic_reader ] = :reader
|
1538
|
+
non_atomic_attributes[ :some_non_atomic_writer ] = :writer
|
1539
|
+
atomic_attributes[ :some_atomic_accessor ] = :accessor
|
1540
|
+
atomic_attributes[ :some_atomic_reader ] = :reader
|
1541
|
+
atomic_attributes[ :some_atomic_writer ] = :writer
|
1542
|
+
end
|
1543
|
+
::Persistence::Object::Complex::Attributes::PersistentAttributeAccessorQ.new.instance_eval do
|
1544
|
+
|
1545
|
+
persistent_attribute_accessor?( :some_non_atomic_accessor ).should == true
|
1546
|
+
persistent_attribute_accessor?( :some_non_atomic_reader ).should == false
|
1547
|
+
persistent_attribute_accessor?( :some_non_atomic_writer ).should == false
|
1548
|
+
persistent_attribute_accessor?( :some_non_atomic_other_accessor ).should == false
|
1549
|
+
persistent_attribute_accessor?( :some_non_atomic_other_reader ).should == false
|
1550
|
+
persistent_attribute_accessor?( :some_non_atomic_other_writer ).should == false
|
1551
|
+
|
1552
|
+
persistent_attribute_accessor?( :some_non_atomic_accessor ).should == true
|
1553
|
+
persistent_attribute_accessor?( :some_non_atomic_reader ).should == false
|
1554
|
+
persistent_attribute_accessor?( :some_non_atomic_writer ).should == false
|
1555
|
+
persistent_attribute_accessor?( :some_non_atomic_other_accessor ).should == false
|
1556
|
+
persistent_attribute_accessor?( :some_non_atomic_other_reader ).should == false
|
1557
|
+
persistent_attribute_accessor?( :some_non_atomic_other_writer ).should == false
|
1558
|
+
|
1559
|
+
persistent_attribute_accessor?( :some_atomic_accessor ).should == true
|
1560
|
+
persistent_attribute_accessor?( :some_atomic_reader ).should == false
|
1561
|
+
persistent_attribute_accessor?( :some_atomic_writer ).should == false
|
1562
|
+
persistent_attribute_accessor?( :some_atomic_other_accessor ).should == false
|
1563
|
+
persistent_attribute_accessor?( :some_atomic_other_reader ).should == false
|
1564
|
+
persistent_attribute_accessor?( :some_atomic_other_writer ).should == false
|
1565
|
+
|
1566
|
+
persistent_attribute_accessor?( :some_atomic_accessor ).should == true
|
1567
|
+
persistent_attribute_accessor?( :some_atomic_reader ).should == false
|
1568
|
+
persistent_attribute_accessor?( :some_atomic_writer ).should == false
|
1569
|
+
persistent_attribute_accessor?( :some_atomic_other_accessor ).should == false
|
1570
|
+
persistent_attribute_accessor?( :some_atomic_other_reader ).should == false
|
1571
|
+
persistent_attribute_accessor?( :some_atomic_other_writer ).should == false
|
1572
|
+
|
1573
|
+
end
|
1574
|
+
end
|
1575
|
+
|
1576
|
+
##################################
|
1577
|
+
# persistent_attribute_reader? #
|
1578
|
+
##################################
|
1579
|
+
|
1580
|
+
it 'can report whether an attribute is a persistent :reader' do
|
1581
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributeReaderQ
|
1582
|
+
include ::Persistence::Object::Complex
|
1583
|
+
non_atomic_attributes[ :some_non_atomic_accessor ] = :accessor
|
1584
|
+
non_atomic_attributes[ :some_non_atomic_reader ] = :reader
|
1585
|
+
non_atomic_attributes[ :some_non_atomic_writer ] = :writer
|
1586
|
+
atomic_attributes[ :some_atomic_accessor ] = :accessor
|
1587
|
+
atomic_attributes[ :some_atomic_reader ] = :reader
|
1588
|
+
atomic_attributes[ :some_atomic_writer ] = :writer
|
1589
|
+
end
|
1590
|
+
::Persistence::Object::Complex::Attributes::PersistentAttributeReaderQ.new.instance_eval do
|
1591
|
+
|
1592
|
+
persistent_attribute_reader?( :some_non_atomic_accessor ).should == true
|
1593
|
+
persistent_attribute_reader?( :some_non_atomic_reader ).should == true
|
1594
|
+
persistent_attribute_reader?( :some_non_atomic_writer ).should == false
|
1595
|
+
persistent_attribute_reader?( :some_non_atomic_other_accessor ).should == false
|
1596
|
+
persistent_attribute_reader?( :some_non_atomic_other_reader ).should == false
|
1597
|
+
persistent_attribute_reader?( :some_non_atomic_other_writer ).should == false
|
1598
|
+
|
1599
|
+
persistent_attribute_reader?( :some_non_atomic_accessor ).should == true
|
1600
|
+
persistent_attribute_reader?( :some_non_atomic_reader ).should == true
|
1601
|
+
persistent_attribute_reader?( :some_non_atomic_writer ).should == false
|
1602
|
+
persistent_attribute_reader?( :some_non_atomic_other_accessor ).should == false
|
1603
|
+
persistent_attribute_reader?( :some_non_atomic_other_reader ).should == false
|
1604
|
+
persistent_attribute_reader?( :some_non_atomic_other_writer ).should == false
|
1605
|
+
|
1606
|
+
persistent_attribute_reader?( :some_atomic_accessor ).should == true
|
1607
|
+
persistent_attribute_reader?( :some_atomic_reader ).should == true
|
1608
|
+
persistent_attribute_reader?( :some_atomic_writer ).should == false
|
1609
|
+
persistent_attribute_reader?( :some_atomic_other_accessor ).should == false
|
1610
|
+
persistent_attribute_reader?( :some_atomic_other_reader ).should == false
|
1611
|
+
persistent_attribute_reader?( :some_atomic_other_writer ).should == false
|
1612
|
+
|
1613
|
+
persistent_attribute_reader?( :some_atomic_accessor ).should == true
|
1614
|
+
persistent_attribute_reader?( :some_atomic_reader ).should == true
|
1615
|
+
persistent_attribute_reader?( :some_atomic_writer ).should == false
|
1616
|
+
persistent_attribute_reader?( :some_atomic_other_accessor ).should == false
|
1617
|
+
persistent_attribute_reader?( :some_atomic_other_reader ).should == false
|
1618
|
+
persistent_attribute_reader?( :some_atomic_other_writer ).should == false
|
1619
|
+
|
1620
|
+
end
|
1621
|
+
end
|
1622
|
+
|
1623
|
+
##################################
|
1624
|
+
# persistent_attribute_writer? #
|
1625
|
+
##################################
|
1626
|
+
|
1627
|
+
it 'can report whether an attribute is a persistent :writer' do
|
1628
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributeWriterQ
|
1629
|
+
include ::Persistence::Object::Complex
|
1630
|
+
non_atomic_attributes[ :some_non_atomic_accessor ] = :accessor
|
1631
|
+
non_atomic_attributes[ :some_non_atomic_reader ] = :reader
|
1632
|
+
non_atomic_attributes[ :some_non_atomic_writer ] = :writer
|
1633
|
+
atomic_attributes[ :some_atomic_accessor ] = :accessor
|
1634
|
+
atomic_attributes[ :some_atomic_reader ] = :reader
|
1635
|
+
atomic_attributes[ :some_atomic_writer ] = :writer
|
1636
|
+
end
|
1637
|
+
::Persistence::Object::Complex::Attributes::PersistentAttributeWriterQ.new.instance_eval do
|
1638
|
+
|
1639
|
+
persistent_attribute_writer?( :some_non_atomic_accessor ).should == true
|
1640
|
+
persistent_attribute_writer?( :some_non_atomic_reader ).should == false
|
1641
|
+
persistent_attribute_writer?( :some_non_atomic_writer ).should == true
|
1642
|
+
persistent_attribute_writer?( :some_non_atomic_other_accessor ).should == false
|
1643
|
+
persistent_attribute_writer?( :some_non_atomic_other_reader ).should == false
|
1644
|
+
persistent_attribute_writer?( :some_non_atomic_other_writer ).should == false
|
1645
|
+
|
1646
|
+
persistent_attribute_writer?( :some_non_atomic_accessor ).should == true
|
1647
|
+
persistent_attribute_writer?( :some_non_atomic_reader ).should == false
|
1648
|
+
persistent_attribute_writer?( :some_non_atomic_writer ).should == true
|
1649
|
+
persistent_attribute_writer?( :some_non_atomic_other_accessor ).should == false
|
1650
|
+
persistent_attribute_writer?( :some_non_atomic_other_reader ).should == false
|
1651
|
+
persistent_attribute_writer?( :some_non_atomic_other_writer ).should == false
|
1652
|
+
|
1653
|
+
persistent_attribute_writer?( :some_atomic_accessor ).should == true
|
1654
|
+
persistent_attribute_writer?( :some_atomic_reader ).should == false
|
1655
|
+
persistent_attribute_writer?( :some_atomic_writer ).should == true
|
1656
|
+
persistent_attribute_writer?( :some_atomic_other_accessor ).should == false
|
1657
|
+
persistent_attribute_writer?( :some_atomic_other_reader ).should == false
|
1658
|
+
persistent_attribute_writer?( :some_atomic_other_writer ).should == false
|
1659
|
+
|
1660
|
+
persistent_attribute_writer?( :some_atomic_accessor ).should == true
|
1661
|
+
persistent_attribute_writer?( :some_atomic_reader ).should == false
|
1662
|
+
persistent_attribute_writer?( :some_atomic_writer ).should == true
|
1663
|
+
persistent_attribute_writer?( :some_atomic_other_accessor ).should == false
|
1664
|
+
persistent_attribute_writer?( :some_atomic_other_reader ).should == false
|
1665
|
+
persistent_attribute_writer?( :some_atomic_other_writer ).should == false
|
1666
|
+
|
1667
|
+
end
|
1668
|
+
end
|
1669
|
+
|
1670
|
+
#################################
|
1671
|
+
# persistent_attribute_status #
|
1672
|
+
#################################
|
1673
|
+
|
1674
|
+
it 'can report the current persistent status (:accessor, :reader, :writer) of an attribute' do
|
1675
|
+
class ::Persistence::Object::Complex::Attributes::PersistentAttributeStatus
|
1676
|
+
include ::Persistence::Object::Complex
|
1677
|
+
non_atomic_attributes[ :some_non_atomic_accessor ] = :accessor
|
1678
|
+
non_atomic_attributes[ :some_non_atomic_reader ] = :reader
|
1679
|
+
non_atomic_attributes[ :some_non_atomic_writer ] = :writer
|
1680
|
+
atomic_attributes[ :some_atomic_accessor ] = :accessor
|
1681
|
+
atomic_attributes[ :some_atomic_reader ] = :reader
|
1682
|
+
atomic_attributes[ :some_atomic_writer ] = :writer
|
1683
|
+
end
|
1684
|
+
::Persistence::Object::Complex::Attributes::PersistentAttributeStatus.new.instance_eval do
|
1685
|
+
|
1686
|
+
persistent_attribute_status( :some_non_atomic_accessor ).should == :accessor
|
1687
|
+
persistent_attribute_status( :some_non_atomic_reader ).should == :reader
|
1688
|
+
persistent_attribute_status( :some_non_atomic_writer ).should == :writer
|
1689
|
+
persistent_attribute_status( :some_non_atomic_other_accessor ).should == nil
|
1690
|
+
persistent_attribute_status( :some_non_atomic_other_reader ).should == nil
|
1691
|
+
persistent_attribute_status( :some_non_atomic_other_writer ).should == nil
|
1692
|
+
|
1693
|
+
persistent_attribute_status( :some_non_atomic_accessor ).should == :accessor
|
1694
|
+
persistent_attribute_status( :some_non_atomic_reader ).should == :reader
|
1695
|
+
persistent_attribute_status( :some_non_atomic_writer ).should == :writer
|
1696
|
+
persistent_attribute_status( :some_non_atomic_other_accessor ).should == nil
|
1697
|
+
persistent_attribute_status( :some_non_atomic_other_reader ).should == nil
|
1698
|
+
persistent_attribute_status( :some_non_atomic_other_writer ).should == nil
|
1699
|
+
|
1700
|
+
persistent_attribute_status( :some_atomic_accessor ).should == :accessor
|
1701
|
+
persistent_attribute_status( :some_atomic_reader ).should == :reader
|
1702
|
+
persistent_attribute_status( :some_atomic_writer ).should == :writer
|
1703
|
+
persistent_attribute_status( :some_atomic_other_accessor ).should == nil
|
1704
|
+
persistent_attribute_status( :some_atomic_other_reader ).should == nil
|
1705
|
+
persistent_attribute_status( :some_atomic_other_writer ).should == nil
|
1706
|
+
|
1707
|
+
persistent_attribute_status( :some_atomic_accessor ).should == :accessor
|
1708
|
+
persistent_attribute_status( :some_atomic_reader ).should == :reader
|
1709
|
+
persistent_attribute_status( :some_atomic_writer ).should == :writer
|
1710
|
+
persistent_attribute_status( :some_atomic_other_accessor ).should == nil
|
1711
|
+
persistent_attribute_status( :some_atomic_other_reader ).should == nil
|
1712
|
+
persistent_attribute_status( :some_atomic_other_writer ).should == nil
|
1713
|
+
|
1714
|
+
end
|
1715
|
+
end
|
1716
|
+
|
1717
|
+
end
|