doodle 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +21 -0
- data/examples/profile-options.rb +2 -1
- data/lib/doodle.rb +251 -200
- data/lib/doodle/version.rb +1 -1
- data/spec/attributes_spec.rb +24 -24
- data/spec/bugs_spec.rb +3 -3
- data/spec/class_spec.rb +4 -4
- data/spec/collector_spec.rb +36 -0
- data/spec/conversion_spec.rb +1 -1
- data/spec/defaults_spec.rb +8 -8
- data/spec/doodle_spec.rb +21 -21
- data/spec/extra_args_spec.rb +3 -3
- data/spec/inheritance_spec.rb +11 -11
- data/spec/init_spec.rb +6 -6
- data/spec/singleton_spec.rb +12 -12
- data/spec/specialized_attribute_class_spec.rb +5 -5
- data/spec/superclass_spec.rb +6 -6
- data/spec/validation_spec.rb +5 -5
- metadata +2 -2
data/spec/init_spec.rb
CHANGED
@@ -17,22 +17,22 @@ describe Doodle, 'init' do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
it 'should have instance attribute init via class' do
|
20
|
-
Foo.
|
20
|
+
Foo.doodle_attributes[:moniker].init.should == 'D1'
|
21
21
|
end
|
22
22
|
it 'should have instance attribute init via instance' do
|
23
|
-
@foo.
|
23
|
+
@foo.doodle_attributes[:moniker].init.should == 'D1'
|
24
24
|
end
|
25
25
|
it 'should have class attribute init via class.singleton_class' do
|
26
|
-
Foo.singleton_class.
|
26
|
+
Foo.singleton_class.doodle_attributes(false)[:metadata].init.should == 'D2'
|
27
27
|
end
|
28
28
|
it 'should have class attribute init via class.singleton_class' do
|
29
|
-
Foo.singleton_class.
|
29
|
+
Foo.singleton_class.doodle_attributes[:metadata].init.should == 'D2'
|
30
30
|
end
|
31
31
|
it 'should have singleton attribute init via instance.singleton_class' do
|
32
|
-
@foo.singleton_class.
|
32
|
+
@foo.singleton_class.doodle_attributes(false)[:special].init.should == 'D3'
|
33
33
|
end
|
34
34
|
it 'should have singleton attribute init via instance.singleton_class' do
|
35
|
-
@foo.singleton_class.
|
35
|
+
@foo.singleton_class.doodle_attributes[:special].init.should == 'D3'
|
36
36
|
end
|
37
37
|
it 'should have an attribute :moniker from init' do
|
38
38
|
@foo.moniker.should == 'D1'
|
data/spec/singleton_spec.rb
CHANGED
@@ -8,9 +8,9 @@ describe Doodle, "singletons" do
|
|
8
8
|
has :c1
|
9
9
|
end
|
10
10
|
end
|
11
|
-
Foo.
|
12
|
-
Foo.singleton_class.
|
13
|
-
Foo.singleton_class.
|
11
|
+
Foo.doodle_attributes.should_be OrderedHash.new
|
12
|
+
Foo.singleton_class.doodle_attributes.should_not_be OrderedHash.new
|
13
|
+
Foo.singleton_class.doodle_attributes.map{ |name, attr| name }.should_be [:c1]
|
14
14
|
Foo.c1 = 1
|
15
15
|
Foo.c1.should_be 1
|
16
16
|
end
|
@@ -22,9 +22,9 @@ describe Doodle, "singletons" do
|
|
22
22
|
has :c2
|
23
23
|
end
|
24
24
|
end
|
25
|
-
Foo.
|
26
|
-
Foo.singleton_class.
|
27
|
-
Foo.singleton_class.
|
25
|
+
Foo.doodle_attributes.should_be OrderedHash.new
|
26
|
+
Foo.singleton_class.doodle_attributes.should_not_be OrderedHash.new
|
27
|
+
Foo.singleton_class.doodle_attributes.map{ |name, attr| name }.should_be [:c2]
|
28
28
|
Foo.c2 = 1
|
29
29
|
Foo.c2.should_be 1
|
30
30
|
end
|
@@ -36,9 +36,9 @@ describe Doodle, "singletons" do
|
|
36
36
|
class << foo
|
37
37
|
has :i1
|
38
38
|
end
|
39
|
-
foo.
|
40
|
-
foo.singleton_class.
|
41
|
-
foo.singleton_class.
|
39
|
+
foo.doodle_attributes.keys.should_be [:i1]
|
40
|
+
foo.singleton_class.doodle_attributes.should_not_be OrderedHash.new
|
41
|
+
foo.singleton_class.doodle_attributes.map{ |name, attr| name }.should_be [:i1]
|
42
42
|
foo.i1 = 1
|
43
43
|
foo.i1.should_be 1
|
44
44
|
end
|
@@ -53,9 +53,9 @@ describe Doodle, "singletons" do
|
|
53
53
|
has :i2
|
54
54
|
end
|
55
55
|
end
|
56
|
-
foo.
|
57
|
-
foo.singleton_class.singleton_class.
|
58
|
-
foo.singleton_class.singleton_class.
|
56
|
+
foo.doodle_attributes.should_be OrderedHash.new
|
57
|
+
foo.singleton_class.singleton_class.doodle_attributes.should_not_be OrderedHash.new
|
58
|
+
foo.singleton_class.singleton_class.doodle_attributes.map{ |name, attr| name }.should_be [:i2]
|
59
59
|
foo.singleton_class.i2 = 1
|
60
60
|
foo.singleton_class.i2.should_be 1
|
61
61
|
end
|
@@ -5,7 +5,7 @@ require 'doodle/datatypes'
|
|
5
5
|
describe 'Doodle', 'specialized attributes' do
|
6
6
|
temporary_constant :Foo, :SpecializedAttribute do
|
7
7
|
before :each do
|
8
|
-
class SpecializedAttribute < Doodle::
|
8
|
+
class SpecializedAttribute < Doodle::DoodleAttribute
|
9
9
|
end
|
10
10
|
|
11
11
|
class Foo < Doodle
|
@@ -55,9 +55,9 @@ describe 'Doodle', 'specialized attributes' do
|
|
55
55
|
rv.class.should_be SpecializedAttribute
|
56
56
|
rv.flag.should_be 'sflag'
|
57
57
|
end
|
58
|
-
Foo.
|
58
|
+
Foo.doodle_attributes[:ivar1].flag.should_be "sflag"
|
59
59
|
foo = Foo.new('hi')
|
60
|
-
foo.
|
60
|
+
foo.doodle_attributes[:ivar1].flag.should_be "sflag"
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should allow using datatypes in additional directives invoking specialized attribute of correct class' do
|
@@ -79,9 +79,9 @@ describe 'Doodle', 'specialized attributes' do
|
|
79
79
|
rv.class.should_be SpecializedAttribute
|
80
80
|
rv.flag.should_be 'x'
|
81
81
|
end
|
82
|
-
Foo.
|
82
|
+
Foo.doodle_attributes[:ivar1].flag.should_be "x"
|
83
83
|
foo = Foo.new('hi')
|
84
|
-
foo.
|
84
|
+
foo.doodle_attributes[:ivar1].flag.should_be "x"
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'should allow using datatypes in additional directives invoking specialized attribute of correct class and raise error if incorrect value supplied' do
|
data/spec/superclass_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
2
|
|
3
|
-
describe 'Doodle', '
|
3
|
+
describe 'Doodle', 'doodle_parents' do
|
4
4
|
temporary_constant :Foo do
|
5
5
|
before :each do
|
6
6
|
class Foo < Doodle
|
@@ -12,13 +12,13 @@ describe 'Doodle', 'parents' do
|
|
12
12
|
@sclass_foo = class << @foo; class << self; self; end; end
|
13
13
|
end
|
14
14
|
|
15
|
-
it 'should have no singleton
|
16
|
-
@sc.
|
15
|
+
it 'should have no singleton doodle_parents ' do
|
16
|
+
@sc.doodle_parents.should == []
|
17
17
|
end
|
18
18
|
|
19
|
-
# it "should have singleton class's singleton class
|
20
|
-
#
|
21
|
-
# @scc.
|
19
|
+
# it "should have singleton class's singleton class doodle_parents == []" do
|
20
|
+
# expected_doodle_parents = RUBY_VERSION <= "1.8.6" ? [] : [Module, Object, BasicObject]
|
21
|
+
# @scc.doodle_parents.should == expected_doodle_parents
|
22
22
|
# end
|
23
23
|
end
|
24
24
|
end
|
data/spec/validation_spec.rb
CHANGED
@@ -58,19 +58,19 @@ describe :DateRange, 'validation & conversions' do
|
|
58
58
|
|
59
59
|
it 'should have start_date kind == Date' do
|
60
60
|
d = DateRange.new
|
61
|
-
d.
|
61
|
+
d.doodle_attributes[:start_date].kind == Date
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'should have two validations' do
|
65
65
|
d = DateRange.new
|
66
|
-
d.
|
67
|
-
d.
|
66
|
+
d.doodle_attributes[:start_date].doodle_validations.size.should_be 2
|
67
|
+
d.doodle_attributes[:start_date].doodle_validations(false).size.should_be 2
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'should have two conversions' do
|
71
71
|
d = DateRange.new
|
72
|
-
d.
|
73
|
-
d.
|
72
|
+
d.doodle_attributes[:start_date].doodle_conversions.size.should_be 3
|
73
|
+
d.doodle_attributes[:start_date].doodle_conversions(false).size.should_be 3
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'should convert from Array' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doodle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean O'Halpin
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-08 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|