dm-types 0.10.2 → 1.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +36 -0
- data/Gemfile +147 -0
- data/Rakefile +7 -8
- data/VERSION +1 -1
- data/dm-types.gemspec +61 -20
- data/lib/dm-types.rb +24 -19
- data/lib/dm-types/bcrypt_hash.rb +17 -13
- data/lib/dm-types/comma_separated_list.rb +11 -16
- data/lib/dm-types/csv.rb +11 -11
- data/lib/dm-types/enum.rb +33 -50
- data/lib/dm-types/epoch_time.rb +11 -11
- data/lib/dm-types/file_path.rb +13 -10
- data/lib/dm-types/flag.rb +17 -25
- data/lib/dm-types/ip_address.rb +15 -11
- data/lib/dm-types/json.rb +17 -14
- data/lib/dm-types/paranoid/base.rb +38 -0
- data/lib/dm-types/paranoid_boolean.rb +23 -0
- data/lib/dm-types/paranoid_datetime.rb +22 -0
- data/lib/dm-types/regexp.rb +8 -8
- data/lib/dm-types/slug.rb +7 -12
- data/lib/dm-types/uri.rb +21 -9
- data/lib/dm-types/uuid.rb +18 -11
- data/lib/dm-types/yaml.rb +12 -10
- data/spec/fixtures/article.rb +0 -2
- data/spec/fixtures/bookmark.rb +0 -2
- data/spec/fixtures/network_node.rb +0 -2
- data/spec/fixtures/person.rb +0 -2
- data/spec/fixtures/software_package.rb +0 -2
- data/spec/fixtures/ticket.rb +2 -4
- data/spec/fixtures/tshirt.rb +3 -5
- data/spec/integration/bcrypt_hash_spec.rb +33 -31
- data/spec/integration/comma_separated_list_spec.rb +55 -53
- data/spec/integration/enum_spec.rb +55 -53
- data/spec/integration/file_path_spec.rb +105 -103
- data/spec/integration/flag_spec.rb +42 -40
- data/spec/integration/ip_address_spec.rb +91 -89
- data/spec/integration/json_spec.rb +41 -39
- data/spec/integration/slug_spec.rb +36 -34
- data/spec/integration/uri_spec.rb +82 -79
- data/spec/integration/uuid_spec.rb +63 -61
- data/spec/integration/yaml_spec.rb +37 -35
- data/spec/spec_helper.rb +7 -36
- data/spec/unit/bcrypt_hash_spec.rb +18 -10
- data/spec/unit/csv_spec.rb +92 -80
- data/spec/unit/enum_spec.rb +27 -42
- data/spec/unit/epoch_time_spec.rb +18 -7
- data/spec/unit/file_path_spec.rb +15 -10
- data/spec/unit/flag_spec.rb +13 -36
- data/spec/unit/ip_address_spec.rb +13 -10
- data/spec/unit/json_spec.rb +21 -14
- data/spec/unit/paranoid_boolean_spec.rb +138 -0
- data/spec/unit/paranoid_datetime_spec.rb +143 -0
- data/spec/unit/regexp_spec.rb +15 -5
- data/spec/unit/uri_spec.rb +13 -9
- data/spec/unit/yaml_spec.rb +16 -9
- data/tasks/local_gemfile.rake +18 -0
- data/tasks/spec.rake +0 -3
- metadata +122 -52
data/spec/unit/enum_spec.rb
CHANGED
@@ -1,61 +1,46 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
try_spec do
|
4
|
-
describe DataMapper::
|
5
|
-
|
6
|
-
|
7
|
-
DataMapper::
|
8
|
-
|
9
|
-
|
10
|
-
it 'returns an unique Class each time' do
|
11
|
-
DataMapper::Types::Enum.new.should_not == DataMapper::Types::Enum.new
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'stores enumeration items' do
|
15
|
-
DataMapper::Types::Enum.new(:first, :second, :third).flag_map.values.should == [:first, :second, :third]
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'assigns incremental numeric keys to enumeration items' do
|
19
|
-
DataMapper::Types::Enum.new(:one, :two, :three, :four).flag_map.keys.should == (1..4).to_a
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'uses Integer as a primitive' do
|
23
|
-
DataMapper::Types::Enum.new.primitive.should == Integer
|
4
|
+
describe DataMapper::Property::Enum do
|
5
|
+
before :all do
|
6
|
+
class ::User
|
7
|
+
include DataMapper::Resource
|
8
|
+
property :id, Serial
|
24
9
|
end
|
25
10
|
end
|
26
11
|
|
27
12
|
describe '.dump' do
|
28
13
|
before do
|
29
|
-
@enum = DataMapper::
|
14
|
+
@enum = User.property(:enum, DataMapper::Property::Enum, :flags => [:first, :second, :third])
|
30
15
|
end
|
31
16
|
|
32
17
|
it 'should return the key of the value match from the flag map' do
|
33
|
-
@enum.dump(:first
|
34
|
-
@enum.dump(:second
|
35
|
-
@enum.dump(:third
|
18
|
+
@enum.dump(:first).should == 1
|
19
|
+
@enum.dump(:second).should == 2
|
20
|
+
@enum.dump(:third).should == 3
|
36
21
|
end
|
37
22
|
|
38
23
|
describe 'when there is no match' do
|
39
24
|
it 'should return nil' do
|
40
|
-
@enum.dump(:zero
|
25
|
+
@enum.dump(:zero).should be_nil
|
41
26
|
end
|
42
27
|
end
|
43
28
|
end
|
44
29
|
|
45
30
|
describe '.load' do
|
46
31
|
before do
|
47
|
-
@enum = DataMapper::
|
32
|
+
@enum = User.property(:enum, DataMapper::Property::Enum, :flags => [:uno, :dos, :tres])
|
48
33
|
end
|
49
34
|
|
50
35
|
it 'returns the value of the key match from the flag map' do
|
51
|
-
@enum.load(1
|
52
|
-
@enum.load(2
|
53
|
-
@enum.load(3
|
36
|
+
@enum.load(1).should == :uno
|
37
|
+
@enum.load(2).should == :dos
|
38
|
+
@enum.load(3).should == :tres
|
54
39
|
end
|
55
40
|
|
56
41
|
describe 'when there is no key' do
|
57
42
|
it 'returns nil' do
|
58
|
-
@enum.load(-1
|
43
|
+
@enum.load(-1).should be_nil
|
59
44
|
end
|
60
45
|
end
|
61
46
|
end
|
@@ -63,72 +48,72 @@ try_spec do
|
|
63
48
|
describe '.typecast' do
|
64
49
|
describe 'of Enum created from a symbol' do
|
65
50
|
before :all do
|
66
|
-
@enum = DataMapper::
|
51
|
+
@enum = User.property(:enum, DataMapper::Property::Enum, :flags => [:uno])
|
67
52
|
end
|
68
53
|
|
69
54
|
describe 'when given a symbol' do
|
70
55
|
it 'uses Enum type' do
|
71
|
-
@enum.typecast(:uno
|
56
|
+
@enum.typecast(:uno).should == :uno
|
72
57
|
end
|
73
58
|
end
|
74
59
|
|
75
60
|
describe 'when given a string' do
|
76
61
|
it 'uses Enum type' do
|
77
|
-
@enum.typecast('uno'
|
62
|
+
@enum.typecast('uno').should == :uno
|
78
63
|
end
|
79
64
|
end
|
80
65
|
|
81
66
|
describe 'when given nil' do
|
82
67
|
it 'returns nil' do
|
83
|
-
@enum.typecast( nil
|
68
|
+
@enum.typecast( nil).should == nil
|
84
69
|
end
|
85
70
|
end
|
86
71
|
end
|
87
72
|
|
88
73
|
describe 'of Enum created from integer list' do
|
89
74
|
before :all do
|
90
|
-
@enum = DataMapper::
|
75
|
+
@enum = User.property(:enum, DataMapper::Property::Enum, :flags => [1, 2, 3])
|
91
76
|
end
|
92
77
|
|
93
78
|
describe 'when given an integer' do
|
94
79
|
it 'uses Enum type' do
|
95
|
-
@enum.typecast(1
|
80
|
+
@enum.typecast(1).should == 1
|
96
81
|
end
|
97
82
|
end
|
98
83
|
|
99
84
|
describe 'when given a float' do
|
100
85
|
it 'uses Enum type' do
|
101
|
-
@enum.typecast(1.1
|
86
|
+
@enum.typecast(1.1).should == 1
|
102
87
|
end
|
103
88
|
end
|
104
89
|
|
105
90
|
describe 'when given nil' do
|
106
91
|
it 'returns nil' do
|
107
|
-
@enum.typecast( nil
|
92
|
+
@enum.typecast( nil).should == nil
|
108
93
|
end
|
109
94
|
end
|
110
95
|
end
|
111
96
|
|
112
97
|
describe 'of Enum created from a string' do
|
113
98
|
before :all do
|
114
|
-
@enum = DataMapper::
|
99
|
+
@enum = User.property(:enum, DataMapper::Property::Enum, :flags => ['uno'])
|
115
100
|
end
|
116
101
|
|
117
102
|
describe 'when given a symbol' do
|
118
103
|
it 'uses Enum type' do
|
119
|
-
@enum.typecast(:uno
|
104
|
+
@enum.typecast(:uno).should == 'uno'
|
120
105
|
end
|
121
106
|
end
|
122
107
|
|
123
108
|
describe 'when given a string' do
|
124
109
|
it 'uses Enum type' do
|
125
|
-
@enum.typecast('uno'
|
110
|
+
@enum.typecast('uno').should == 'uno'
|
126
111
|
end
|
127
112
|
end
|
128
113
|
|
129
114
|
describe 'when given nil' do
|
130
115
|
it 'returns nil' do
|
131
|
-
@enum.typecast( nil
|
116
|
+
@enum.typecast( nil).should == nil
|
132
117
|
end
|
133
118
|
end
|
134
119
|
end
|
@@ -1,7 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
try_spec do
|
4
|
-
describe DataMapper::
|
4
|
+
describe DataMapper::Property::EpochTime do
|
5
|
+
before :all do
|
6
|
+
class User
|
7
|
+
include DataMapper::Resource
|
8
|
+
property :id, Serial
|
9
|
+
property :bday, EpochTime
|
10
|
+
end
|
11
|
+
|
12
|
+
@property = User.properties[:bday]
|
13
|
+
end
|
14
|
+
|
5
15
|
describe '.dump' do
|
6
16
|
describe 'when given Time instance' do
|
7
17
|
before :all do
|
@@ -9,7 +19,7 @@ try_spec do
|
|
9
19
|
end
|
10
20
|
|
11
21
|
it 'returns timestamp' do
|
12
|
-
|
22
|
+
@property.dump(@input).should == @input.to_i
|
13
23
|
end
|
14
24
|
end
|
15
25
|
|
@@ -19,7 +29,8 @@ try_spec do
|
|
19
29
|
end
|
20
30
|
|
21
31
|
it 'returns timestamp' do
|
22
|
-
|
32
|
+
pending 'Does not work with < 1.8.7, see if backports fixes it' if RUBY_VERSION < '1.8.7'
|
33
|
+
@property.dump(@input).should == Time.parse(@input.to_s).to_i
|
23
34
|
end
|
24
35
|
end
|
25
36
|
|
@@ -29,7 +40,7 @@ try_spec do
|
|
29
40
|
end
|
30
41
|
|
31
42
|
it 'returns value as is' do
|
32
|
-
|
43
|
+
@property.dump(@input).should == @input
|
33
44
|
end
|
34
45
|
end
|
35
46
|
|
@@ -39,7 +50,7 @@ try_spec do
|
|
39
50
|
end
|
40
51
|
|
41
52
|
it 'returns value as is' do
|
42
|
-
|
53
|
+
@property.dump(@input).should == @input
|
43
54
|
end
|
44
55
|
end
|
45
56
|
end
|
@@ -47,14 +58,14 @@ try_spec do
|
|
47
58
|
describe '.load' do
|
48
59
|
describe 'when value is nil' do
|
49
60
|
it 'returns nil' do
|
50
|
-
|
61
|
+
@property.load(nil).should == nil
|
51
62
|
end
|
52
63
|
end
|
53
64
|
|
54
65
|
describe 'when value is an integer' do
|
55
66
|
it 'returns time object from timestamp' do
|
56
67
|
t = Time.now.to_i
|
57
|
-
|
68
|
+
@property.load(Time.now.to_i).should == Time.at(t)
|
58
69
|
end
|
59
70
|
end
|
60
71
|
end
|
data/spec/unit/file_path_spec.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require './spec/fixtures/software_package'
|
2
3
|
|
3
4
|
try_spec do
|
4
|
-
describe DataMapper::
|
5
|
+
describe DataMapper::Property::FilePath do
|
6
|
+
before :all do
|
7
|
+
@property = DataMapper::Types::Fixtures::SoftwarePackage.properties[:source_path]
|
8
|
+
end
|
9
|
+
|
5
10
|
before do
|
6
11
|
@input = '/usr/bin/ruby'
|
7
12
|
@path = Pathname.new(@input)
|
@@ -10,19 +15,19 @@ try_spec do
|
|
10
15
|
describe '.dump' do
|
11
16
|
describe 'when input is a string' do
|
12
17
|
it 'does not modify input' do
|
13
|
-
|
18
|
+
@property.dump(@input).should == @input
|
14
19
|
end
|
15
20
|
end
|
16
21
|
|
17
22
|
describe 'when input is nil' do
|
18
23
|
it 'returns nil' do
|
19
|
-
|
24
|
+
@property.dump(nil).should be_nil
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
23
28
|
describe 'when input is a blank string' do
|
24
29
|
it 'returns nil' do
|
25
|
-
|
30
|
+
@property.dump('').should be_nil
|
26
31
|
end
|
27
32
|
end
|
28
33
|
end
|
@@ -30,19 +35,19 @@ try_spec do
|
|
30
35
|
describe '.load' do
|
31
36
|
describe 'when value is a non-blank file path' do
|
32
37
|
it 'returns Pathname for a path' do
|
33
|
-
|
38
|
+
@property.load(@input).should == @path
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
42
|
describe 'when value is nil' do
|
38
43
|
it 'return nil' do
|
39
|
-
|
44
|
+
@property.load(nil).should be_nil
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
43
48
|
describe 'when value is a blank string' do
|
44
49
|
it 'returns nil' do
|
45
|
-
|
50
|
+
@property.load('').should be_nil
|
46
51
|
end
|
47
52
|
end
|
48
53
|
end
|
@@ -50,19 +55,19 @@ try_spec do
|
|
50
55
|
describe '.typecast' do
|
51
56
|
describe 'when a Pathname is given' do
|
52
57
|
it 'does not modify input' do
|
53
|
-
|
58
|
+
@property.typecast(@path).should == @path
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
57
62
|
describe 'when a nil is given' do
|
58
63
|
it 'does not modify input' do
|
59
|
-
|
64
|
+
@property.typecast(nil).should == nil
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
63
68
|
describe 'when a string is given' do
|
64
69
|
it 'returns Pathname for given path' do
|
65
|
-
|
70
|
+
@property.typecast(@input).should == @path
|
66
71
|
end
|
67
72
|
end
|
68
73
|
end
|
data/spec/unit/flag_spec.rb
CHANGED
@@ -1,41 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
it 'creates a Class' do
|
5
|
-
DataMapper::Types::Flag.new.should be_instance_of(Class)
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'creates unique a Class each call' do
|
9
|
-
DataMapper::Types::Flag.new.should_not == DataMapper::Types::Flag.new
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'builds up flags map from arguments' do
|
13
|
-
DataMapper::Types::Flag.new(:first, :second, :third).flag_map.values.should == [ :first, :second, :third ]
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should create keys that is +1 for every increment for the @flag_map hash, staring at 0' do
|
17
|
-
DataMapper::Types::Flag.new(:one, :two, :three, :four, :five).flag_map.keys.should include(0, 1, 2, 3, 4)
|
18
|
-
end
|
19
|
-
end
|
3
|
+
require './spec/fixtures/tshirt'
|
20
4
|
|
21
5
|
try_spec do
|
22
|
-
describe DataMapper::
|
23
|
-
describe '.new' do
|
24
|
-
it_should_behave_like 'factory method for Flag type'
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '.[]' do
|
28
|
-
it_should_behave_like 'factory method for Flag type'
|
29
|
-
end
|
30
|
-
|
6
|
+
describe DataMapper::Property::Flag do
|
31
7
|
describe '.dump' do
|
32
8
|
before :all do
|
33
|
-
@flag = DataMapper::Types::
|
9
|
+
@flag = DataMapper::Types::Fixtures::TShirt.property(
|
10
|
+
:stuff, DataMapper::Property::Flag, :flags => [:first, :second, :third, :fourth, :fifth])
|
34
11
|
end
|
35
12
|
|
36
13
|
describe 'when argument matches a value in the flag map' do
|
37
14
|
before :all do
|
38
|
-
@result = @flag.dump(:first
|
15
|
+
@result = @flag.dump(:first)
|
39
16
|
end
|
40
17
|
|
41
18
|
it 'returns flag bit of value' do
|
@@ -45,7 +22,7 @@ try_spec do
|
|
45
22
|
|
46
23
|
describe 'when argument matches 2nd value in the flag map' do
|
47
24
|
before :all do
|
48
|
-
@result = @flag.dump(:second
|
25
|
+
@result = @flag.dump(:second)
|
49
26
|
end
|
50
27
|
|
51
28
|
it 'returns flag bit of value' do
|
@@ -55,7 +32,7 @@ try_spec do
|
|
55
32
|
|
56
33
|
describe 'when argument matches multiple Symbol values in the flag map' do
|
57
34
|
before :all do
|
58
|
-
@result = @flag.dump([ :second, :fourth ]
|
35
|
+
@result = @flag.dump([ :second, :fourth ])
|
59
36
|
end
|
60
37
|
|
61
38
|
it 'builds binary flag from key values of all matches' do
|
@@ -65,7 +42,7 @@ try_spec do
|
|
65
42
|
|
66
43
|
describe 'when argument matches multiple string values in the flag map' do
|
67
44
|
before :all do
|
68
|
-
@result = @flag.dump(['first', 'second', 'third', 'fourth', 'fifth']
|
45
|
+
@result = @flag.dump(['first', 'second', 'third', 'fourth', 'fifth'])
|
69
46
|
end
|
70
47
|
|
71
48
|
it 'builds binary flag from key values of all matches' do
|
@@ -75,7 +52,7 @@ try_spec do
|
|
75
52
|
|
76
53
|
describe 'when argument does not match a single value in the flag map' do
|
77
54
|
before :all do
|
78
|
-
@result = @flag.dump(:zero
|
55
|
+
@result = @flag.dump(:zero)
|
79
56
|
end
|
80
57
|
|
81
58
|
it 'returns zero' do
|
@@ -86,12 +63,12 @@ try_spec do
|
|
86
63
|
|
87
64
|
describe '.load' do
|
88
65
|
before :all do
|
89
|
-
@flag = DataMapper::Types::Flag[:uno, :dos, :tres, :cuatro, :cinco]
|
66
|
+
@flag = DataMapper::Types::Fixtures::TShirt.property(:stuff, DataMapper::Property::Flag, :flags => [:uno, :dos, :tres, :cuatro, :cinco])
|
90
67
|
end
|
91
68
|
|
92
69
|
describe 'when argument matches a key in the flag map' do
|
93
70
|
before :all do
|
94
|
-
@result = @flag.load(4
|
71
|
+
@result = @flag.load(4)
|
95
72
|
end
|
96
73
|
|
97
74
|
it 'returns array with a single matching element' do
|
@@ -101,7 +78,7 @@ try_spec do
|
|
101
78
|
|
102
79
|
describe 'when argument matches multiple keys in the flag map' do
|
103
80
|
before :all do
|
104
|
-
@result = @flag.load(10
|
81
|
+
@result = @flag.load(10)
|
105
82
|
end
|
106
83
|
|
107
84
|
it 'returns array of matching values' do
|
@@ -111,7 +88,7 @@ try_spec do
|
|
111
88
|
|
112
89
|
describe 'when argument does not match a single key in the flag map' do
|
113
90
|
before :all do
|
114
|
-
@result = @flag.load(nil
|
91
|
+
@result = @flag.load(nil)
|
115
92
|
end
|
116
93
|
|
117
94
|
it 'returns an empty array' do
|
@@ -1,16 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
require './spec/fixtures/network_node'
|
4
|
+
|
3
5
|
try_spec do
|
4
|
-
describe DataMapper::
|
6
|
+
describe DataMapper::Property::IPAddress do
|
5
7
|
before :all do
|
6
8
|
@stored = '81.20.130.1'
|
7
9
|
@input = IPAddr.new(@stored)
|
10
|
+
@property = DataMapper::Types::Fixtures::NetworkNode.properties[:ip_address]
|
8
11
|
end
|
9
12
|
|
10
13
|
describe '.dump' do
|
11
14
|
describe 'when argument is an IP address given as Ruby object' do
|
12
15
|
before :all do
|
13
|
-
@result =
|
16
|
+
@result = @property.dump(@input)
|
14
17
|
end
|
15
18
|
|
16
19
|
it 'dumps input into a string' do
|
@@ -20,7 +23,7 @@ try_spec do
|
|
20
23
|
|
21
24
|
describe 'when argument is nil' do
|
22
25
|
before :all do
|
23
|
-
@result =
|
26
|
+
@result = @property.dump(nil)
|
24
27
|
end
|
25
28
|
|
26
29
|
it 'returns nil' do
|
@@ -30,7 +33,7 @@ try_spec do
|
|
30
33
|
|
31
34
|
describe 'when input is a blank string' do
|
32
35
|
before :all do
|
33
|
-
@result =
|
36
|
+
@result = @property.dump('')
|
34
37
|
end
|
35
38
|
|
36
39
|
it 'retuns a blank string' do
|
@@ -42,7 +45,7 @@ try_spec do
|
|
42
45
|
describe '.load' do
|
43
46
|
describe 'when argument is a valid IP address as a string' do
|
44
47
|
before :all do
|
45
|
-
@result =
|
48
|
+
@result = @property.load(@stored)
|
46
49
|
end
|
47
50
|
|
48
51
|
it 'returns IPAddr instance from stored value' do
|
@@ -52,7 +55,7 @@ try_spec do
|
|
52
55
|
|
53
56
|
describe 'when argument is nil' do
|
54
57
|
before :all do
|
55
|
-
@result =
|
58
|
+
@result = @property.load(nil)
|
56
59
|
end
|
57
60
|
|
58
61
|
it 'returns nil' do
|
@@ -62,7 +65,7 @@ try_spec do
|
|
62
65
|
|
63
66
|
describe 'when argument is a blank string' do
|
64
67
|
before :all do
|
65
|
-
@result =
|
68
|
+
@result = @property.load('')
|
66
69
|
end
|
67
70
|
|
68
71
|
it 'returns IPAddr instance from stored value' do
|
@@ -72,7 +75,7 @@ try_spec do
|
|
72
75
|
|
73
76
|
describe 'when argument is an Array instance' do
|
74
77
|
before :all do
|
75
|
-
@operation = lambda {
|
78
|
+
@operation = lambda { @property.load([]) }
|
76
79
|
end
|
77
80
|
|
78
81
|
it 'raises ArgumentError with a meaningful message' do
|
@@ -84,7 +87,7 @@ try_spec do
|
|
84
87
|
describe '.typecast' do
|
85
88
|
describe 'when argument is an IpAddr object' do
|
86
89
|
before :all do
|
87
|
-
@result =
|
90
|
+
@result = @property.typecast(@input)
|
88
91
|
end
|
89
92
|
|
90
93
|
it 'does not change the value' do
|
@@ -94,7 +97,7 @@ try_spec do
|
|
94
97
|
|
95
98
|
describe 'when argument is a valid IP address as a string' do
|
96
99
|
before :all do
|
97
|
-
@result =
|
100
|
+
@result = @property.typecast(@stored)
|
98
101
|
end
|
99
102
|
|
100
103
|
it 'instantiates IPAddr instance' do
|