dm-validations 0.10.1 → 0.10.2
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/Rakefile +23 -18
- data/VERSION +1 -0
- data/dm-validations.gemspec +188 -0
- data/lib/dm-validations.rb +25 -75
- data/lib/dm-validations/auto_validate.rb +7 -7
- data/lib/dm-validations/contextual_validators.rb +4 -18
- data/lib/dm-validations/exceptions.rb +3 -1
- data/lib/dm-validations/support/context.rb +40 -1
- data/lib/dm-validations/validation_errors.rb +2 -13
- data/lib/dm-validations/validators/absent_field_validator.rb +2 -2
- data/lib/dm-validations/validators/acceptance_validator.rb +14 -16
- data/lib/dm-validations/validators/confirmation_validator.rb +17 -15
- data/lib/dm-validations/validators/format_validator.rb +18 -11
- data/lib/dm-validations/validators/generic_validator.rb +45 -15
- data/lib/dm-validations/validators/length_validator.rb +2 -11
- data/lib/dm-validations/validators/method_validator.rb +2 -2
- data/lib/dm-validations/validators/numeric_validator.rb +8 -6
- data/lib/dm-validations/validators/primitive_validator.rb +1 -1
- data/lib/dm-validations/validators/uniqueness_validator.rb +13 -9
- data/lib/dm-validations/validators/within_validator.rb +4 -3
- data/spec/fixtures/basketball_player.rb +0 -3
- data/spec/fixtures/bill_of_landing.rb +1 -1
- data/spec/fixtures/city.rb +0 -1
- data/spec/fixtures/company.rb +1 -3
- data/spec/fixtures/corporate_world.rb +0 -6
- data/spec/fixtures/country.rb +0 -1
- data/spec/fixtures/event.rb +1 -1
- data/spec/fixtures/page.rb +2 -2
- data/spec/fixtures/reservation.rb +1 -1
- data/spec/fixtures/scm_operation.rb +0 -8
- data/spec/integration/absent_field_validator/absent_field_validator_spec.rb +6 -2
- data/spec/integration/acceptance_validator/acceptance_validator_spec.rb +36 -36
- data/spec/integration/automatic_validation/custom_messages_for_inferred_validation_spec.rb +2 -2
- data/spec/integration/automatic_validation/disabling_inferred_validation_spec.rb +4 -4
- data/spec/integration/automatic_validation/inferred_boolean_properties_validation_spec.rb +2 -2
- data/spec/integration/automatic_validation/inferred_float_property_validation_spec.rb +2 -0
- data/spec/integration/automatic_validation/inferred_format_validation_spec.rb +3 -1
- data/spec/integration/automatic_validation/inferred_integer_properties_validation_spec.rb +2 -0
- data/spec/integration/automatic_validation/inferred_length_validation_spec.rb +6 -2
- data/spec/integration/automatic_validation/inferred_presence_validation_spec.rb +8 -4
- data/spec/integration/automatic_validation/inferred_primitive_validation_spec.rb +3 -1
- data/spec/integration/automatic_validation/spec_helper.rb +6 -6
- data/spec/integration/block_validator/block_validator_spec.rb +1 -1
- data/spec/integration/conditional_validation/if_condition_spec.rb +3 -1
- data/spec/integration/confirmation_validator/confirmation_validator_spec.rb +3 -1
- data/spec/integration/datamapper_models/association_validation_spec.rb +4 -1
- data/spec/integration/datamapper_models/inheritance_spec.rb +6 -2
- data/spec/integration/duplicated_validations/duplicated_validations_spec.rb +3 -1
- data/spec/integration/format_validator/email_format_validator_spec.rb +5 -1
- data/spec/integration/format_validator/format_validator_spec.rb +5 -1
- data/spec/integration/format_validator/regexp_validator_spec.rb +5 -1
- data/spec/integration/format_validator/url_format_validator_spec.rb +8 -4
- data/spec/integration/length_validator/default_value_spec.rb +4 -2
- data/spec/integration/length_validator/equality_spec.rb +3 -1
- data/spec/integration/length_validator/error_message_spec.rb +3 -1
- data/spec/integration/length_validator/maximum_spec.rb +3 -1
- data/spec/integration/length_validator/minimum_spec.rb +3 -1
- data/spec/integration/length_validator/range_spec.rb +3 -1
- data/spec/integration/method_validator/method_validator_spec.rb +3 -1
- data/spec/integration/numeric_validator/equality_with_float_type_spec.rb +5 -1
- data/spec/integration/numeric_validator/equality_with_integer_type_spec.rb +5 -1
- data/spec/integration/numeric_validator/float_type_spec.rb +3 -1
- data/spec/integration/numeric_validator/gt_with_float_type_spec.rb +3 -1
- data/spec/integration/numeric_validator/gte_with_float_type_spec.rb +3 -1
- data/spec/integration/numeric_validator/integer_only_true_spec.rb +11 -9
- data/spec/integration/numeric_validator/integer_type_spec.rb +10 -8
- data/spec/integration/numeric_validator/lt_with_float_type_spec.rb +3 -1
- data/spec/integration/numeric_validator/lte_with_float_type_spec.rb +3 -1
- data/spec/integration/primitive_validator/primitive_validator_spec.rb +3 -1
- data/spec/integration/pure_ruby_objects/plain_old_ruby_object_validation_spec.rb +6 -6
- data/spec/integration/required_field_validator/association_spec.rb +9 -4
- data/spec/integration/required_field_validator/boolean_type_value_spec.rb +24 -18
- data/spec/integration/required_field_validator/date_type_value_spec.rb +21 -19
- data/spec/integration/required_field_validator/datetime_type_value_spec.rb +21 -19
- data/spec/integration/required_field_validator/float_type_value_spec.rb +21 -19
- data/spec/integration/required_field_validator/integer_type_value_spec.rb +17 -15
- data/spec/integration/required_field_validator/shared_examples.rb +5 -3
- data/spec/integration/required_field_validator/string_type_value_spec.rb +20 -16
- data/spec/integration/required_field_validator/text_type_value_spec.rb +10 -6
- data/spec/integration/uniqueness_validator/uniqueness_validator_spec.rb +23 -25
- data/spec/integration/within_validator/within_validator_spec.rb +7 -3
- data/spec/public/resource_spec.rb +5 -6
- data/spec/rcov.opts +6 -0
- data/spec/spec.opts +2 -0
- data/spec/unit/contextual_validators/emptiness_spec.rb +1 -1
- data/spec/unit/contextual_validators/execution_spec.rb +9 -16
- data/spec/unit/generic_validator/equality_operator_spec.rb +3 -3
- data/spec/unit/validation_errors/adding_spec.rb +1 -1
- data/spec/unit/validation_errors/emptiness_spec.rb +1 -1
- data/spec/unit/validation_errors/enumerable_spec.rb +1 -1
- data/tasks/ci.rake +1 -0
- data/tasks/metrics.rake +36 -0
- data/tasks/spec.rake +41 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +19 -0
- metadata +36 -18
- data/History.rdoc +0 -45
- data/Manifest.txt +0 -139
- data/TODO +0 -16
- data/lib/dm-validations/version.rb +0 -5
- data/tasks/install.rb +0 -13
- data/tasks/spec.rb +0 -25
@@ -210,8 +210,10 @@ describe "Haskell" do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
|
213
|
-
describe DataMapper::Validate::Fixtures::Event do
|
213
|
+
describe 'DataMapper::Validate::Fixtures::Event' do
|
214
214
|
before :all do
|
215
|
+
DataMapper::Validate::Fixtures::Event.auto_migrate!
|
216
|
+
|
215
217
|
@model = DataMapper::Validate::Fixtures::Event.new(:name => "Fools day 2009")
|
216
218
|
end
|
217
219
|
|
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe DataMapper::Validate::Fixtures::BasketballCourt do
|
4
|
+
describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
5
|
+
before :all do
|
6
|
+
DataMapper::Validate::Fixtures::BasketballCourt.auto_migrate!
|
7
|
+
end
|
8
|
+
|
5
9
|
describe "with valid set of attributes" do
|
6
10
|
before :all do
|
7
11
|
@model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance
|
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe DataMapper::Validate::Fixtures::LerneanHydra do
|
4
|
+
describe 'DataMapper::Validate::Fixtures::LerneanHydra' do
|
5
|
+
before :all do
|
6
|
+
DataMapper::Validate::Fixtures::LerneanHydra.auto_migrate!
|
7
|
+
end
|
8
|
+
|
5
9
|
describe "with valid set of attributes" do
|
6
10
|
before :all do
|
7
11
|
@model = DataMapper::Validate::Fixtures::LerneanHydra.valid_instance
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe DataMapper::Validate::Fixtures::BasketballPlayer do
|
4
|
+
describe 'DataMapper::Validate::Fixtures::BasketballPlayer' do
|
5
5
|
before :all do
|
6
|
+
DataMapper::Validate::Fixtures::BasketballPlayer.auto_migrate!
|
7
|
+
|
6
8
|
@model = DataMapper::Validate::Fixtures::BasketballPlayer.new(:name => "Michael Jordan", :height => 198.1, :weight => 97.2)
|
7
9
|
end
|
8
10
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe DataMapper::Validate::Fixtures::BasketballCourt do
|
4
|
+
describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
5
5
|
before :all do
|
6
|
+
DataMapper::Validate::Fixtures::BasketballCourt.auto_migrate!
|
7
|
+
|
6
8
|
@model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance
|
7
9
|
@model.valid?
|
8
10
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe DataMapper::Validate::Fixtures::BasketballCourt do
|
4
|
+
describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
5
5
|
before :all do
|
6
|
+
DataMapper::Validate::Fixtures::BasketballCourt.auto_migrate!
|
7
|
+
|
6
8
|
@model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance
|
7
9
|
@model.valid?
|
8
10
|
end
|
@@ -1,13 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe Country do
|
5
|
-
before
|
4
|
+
describe 'Country' do
|
5
|
+
before do
|
6
|
+
Country.auto_migrate!
|
7
|
+
|
6
8
|
@country = Country.new(:name => "Italy", :area => "301318")
|
7
9
|
end
|
8
10
|
|
9
11
|
describe "with area as integer" do
|
10
|
-
before
|
12
|
+
before do
|
11
13
|
# no op in this case
|
12
14
|
end
|
13
15
|
|
@@ -18,7 +20,7 @@ describe Country do
|
|
18
20
|
|
19
21
|
|
20
22
|
describe "with area as integer" do
|
21
|
-
before
|
23
|
+
before do
|
22
24
|
@country.area = 1603
|
23
25
|
end
|
24
26
|
|
@@ -29,7 +31,7 @@ describe Country do
|
|
29
31
|
|
30
32
|
|
31
33
|
describe "with area as string containing only integers" do
|
32
|
-
before
|
34
|
+
before do
|
33
35
|
@country.area = "301318"
|
34
36
|
end
|
35
37
|
|
@@ -40,7 +42,7 @@ describe Country do
|
|
40
42
|
|
41
43
|
|
42
44
|
describe "with area as string containing a float" do
|
43
|
-
before
|
45
|
+
before do
|
44
46
|
@country.area = "301318.6"
|
45
47
|
end
|
46
48
|
|
@@ -51,7 +53,7 @@ describe Country do
|
|
51
53
|
|
52
54
|
|
53
55
|
describe "with area as string containing random alphanumeric characters" do
|
54
|
-
before
|
56
|
+
before do
|
55
57
|
@country.area = "area=51"
|
56
58
|
end
|
57
59
|
|
@@ -62,7 +64,7 @@ describe Country do
|
|
62
64
|
|
63
65
|
|
64
66
|
describe "with area as string containing random punctuation characters" do
|
65
|
-
before
|
67
|
+
before do
|
66
68
|
@country.area = "$$ * $?"
|
67
69
|
end
|
68
70
|
|
@@ -73,7 +75,7 @@ describe Country do
|
|
73
75
|
|
74
76
|
|
75
77
|
describe "with unknown area" do
|
76
|
-
before
|
78
|
+
before do
|
77
79
|
@country.area = nil
|
78
80
|
end
|
79
81
|
|
@@ -1,13 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe City do
|
5
|
-
before
|
4
|
+
describe 'City' do
|
5
|
+
before do
|
6
|
+
City.auto_migrate!
|
7
|
+
|
6
8
|
@city = City.new(:name => "Tokyo", :founded_in => 1603)
|
7
9
|
end
|
8
10
|
|
9
11
|
describe "with foundation year as integer" do
|
10
|
-
before
|
12
|
+
before do
|
11
13
|
# no op in this case
|
12
14
|
end
|
13
15
|
|
@@ -18,7 +20,7 @@ describe City do
|
|
18
20
|
|
19
21
|
|
20
22
|
describe "with foundation year as integer" do
|
21
|
-
before
|
23
|
+
before do
|
22
24
|
@city.founded_in = 1603
|
23
25
|
end
|
24
26
|
|
@@ -29,7 +31,7 @@ describe City do
|
|
29
31
|
|
30
32
|
|
31
33
|
describe "with foundation year as string containing only integers" do
|
32
|
-
before
|
34
|
+
before do
|
33
35
|
@city.founded_in = "1603"
|
34
36
|
end
|
35
37
|
|
@@ -40,7 +42,7 @@ describe City do
|
|
40
42
|
|
41
43
|
|
42
44
|
describe "with foundation year as string containing a float" do
|
43
|
-
before
|
45
|
+
before do
|
44
46
|
@city.founded_in = "1603.6"
|
45
47
|
end
|
46
48
|
|
@@ -51,7 +53,7 @@ describe City do
|
|
51
53
|
|
52
54
|
|
53
55
|
describe "with foundation year as string that is not an integer or float" do
|
54
|
-
before
|
56
|
+
before do
|
55
57
|
@string = "founded-in=1603"
|
56
58
|
|
57
59
|
@city.founded_in = @string
|
@@ -68,7 +70,7 @@ describe City do
|
|
68
70
|
|
69
71
|
|
70
72
|
describe "with unknown foundation date" do
|
71
|
-
before
|
73
|
+
before do
|
72
74
|
@city.founded_in = nil
|
73
75
|
end
|
74
76
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe DataMapper::Validate::Fixtures::BasketballCourt do
|
4
|
+
describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
5
5
|
before :all do
|
6
|
+
DataMapper::Validate::Fixtures::BasketballCourt.auto_migrate!
|
7
|
+
|
6
8
|
@model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance
|
7
9
|
@model.valid?
|
8
10
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe DataMapper::Validate::Fixtures::BasketballCourt do
|
4
|
+
describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
5
5
|
before :all do
|
6
|
+
DataMapper::Validate::Fixtures::BasketballCourt.auto_migrate!
|
7
|
+
|
6
8
|
@model = DataMapper::Validate::Fixtures::BasketballCourt.valid_instance
|
7
9
|
@model.valid?
|
8
10
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/primitive_validator/spec_helper'
|
3
3
|
|
4
|
-
describe DataMapper::Validate::Fixtures::MemoryObject do
|
4
|
+
describe 'DataMapper::Validate::Fixtures::MemoryObject' do
|
5
5
|
include DataMapper::Validate::Fixtures
|
6
6
|
|
7
7
|
before :all do
|
8
|
+
DataMapper::Validate::Fixtures::MemoryObject.auto_migrate!
|
9
|
+
|
8
10
|
@model = DataMapper::Validate::Fixtures::MemoryObject.new
|
9
11
|
end
|
10
12
|
|
@@ -33,14 +33,14 @@ module PureRubyObjects
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
describe PureRubyObjects::Country do
|
37
|
-
before
|
36
|
+
describe 'PureRubyObjects::Country' do
|
37
|
+
before do
|
38
38
|
# Powerset says so
|
39
39
|
@model = PureRubyObjects::Country.new("Italy", 58_147_733)
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "without name" do
|
43
|
-
before
|
43
|
+
before do
|
44
44
|
@model.name = nil
|
45
45
|
end
|
46
46
|
|
@@ -54,7 +54,7 @@ describe PureRubyObjects::Country do
|
|
54
54
|
|
55
55
|
|
56
56
|
describe "without name and without population information" do
|
57
|
-
before
|
57
|
+
before do
|
58
58
|
@model.name = nil
|
59
59
|
@model.population = nil
|
60
60
|
end
|
@@ -75,7 +75,7 @@ describe PureRubyObjects::Country do
|
|
75
75
|
|
76
76
|
|
77
77
|
describe "with name and without population information" do
|
78
|
-
before
|
78
|
+
before do
|
79
79
|
@model.population = nil
|
80
80
|
end
|
81
81
|
|
@@ -99,7 +99,7 @@ describe PureRubyObjects::Country do
|
|
99
99
|
|
100
100
|
|
101
101
|
describe "with a 2 characters long name" do
|
102
|
-
before
|
102
|
+
before do
|
103
103
|
@model.name = "It"
|
104
104
|
@model.valid?
|
105
105
|
end
|
@@ -61,14 +61,19 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
61
61
|
|
62
62
|
|
63
63
|
|
64
|
-
describe Album do
|
65
|
-
before :
|
64
|
+
describe 'Album' do
|
65
|
+
before :all do
|
66
|
+
Artist.auto_migrate!
|
67
|
+
Album.auto_migrate!
|
68
|
+
end
|
69
|
+
|
70
|
+
before do
|
66
71
|
@artist = Artist.create(:name => "Oceanlab")
|
67
72
|
@album = @artist.albums.new(:name => "Sirens of the sea")
|
68
73
|
end
|
69
74
|
|
70
75
|
describe 'with a missing artist' do
|
71
|
-
before
|
76
|
+
before do
|
72
77
|
@album.artist = nil
|
73
78
|
end
|
74
79
|
|
@@ -83,7 +88,7 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
83
88
|
end
|
84
89
|
|
85
90
|
describe 'with specified artist and name' do
|
86
|
-
before
|
91
|
+
before do
|
87
92
|
# no op
|
88
93
|
end
|
89
94
|
|
@@ -4,15 +4,19 @@ require 'integration/required_field_validator/spec_helper'
|
|
4
4
|
if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
5
5
|
# keep in mind any ScmOperation has a default value for brand property
|
6
6
|
# so it is used
|
7
|
-
describe GitOperation do
|
8
|
-
before :
|
7
|
+
describe 'GitOperation' do
|
8
|
+
before :all do
|
9
|
+
GitOperation.auto_migrate!
|
10
|
+
end
|
11
|
+
|
12
|
+
before do
|
9
13
|
@operation = GitOperation.new(:network_connection => true,
|
10
14
|
:clean_working_copy => true,
|
11
15
|
:message => "I did it! I did it!! Hell yeah!!!")
|
12
16
|
end
|
13
17
|
|
14
18
|
describe "without operation name" do
|
15
|
-
before
|
19
|
+
before do
|
16
20
|
@operation.name = nil
|
17
21
|
end
|
18
22
|
it_should_behave_like "unnamed SCM operation"
|
@@ -21,7 +25,7 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
21
25
|
|
22
26
|
|
23
27
|
describe "without network connection" do
|
24
|
-
before
|
28
|
+
before do
|
25
29
|
# now note that false make sense from readability
|
26
30
|
# point of view but is incorrect from validator
|
27
31
|
# point of view ;)
|
@@ -48,10 +52,10 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
48
52
|
it "is not valid in default context" do
|
49
53
|
@operation.should_not be_valid
|
50
54
|
end
|
51
|
-
end
|
55
|
+
end
|
52
56
|
|
53
57
|
describe "with a network connection" do
|
54
|
-
before
|
58
|
+
before do
|
55
59
|
@operation.network_connection = false
|
56
60
|
end
|
57
61
|
|
@@ -70,11 +74,11 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
70
74
|
it "is not valid in default context" do
|
71
75
|
@operation.should_not be_valid
|
72
76
|
end
|
73
|
-
end
|
77
|
+
end
|
74
78
|
|
75
79
|
|
76
80
|
describe "WITHOUT a clean working copy" do
|
77
|
-
before
|
81
|
+
before do
|
78
82
|
@operation.clean_working_copy = nil
|
79
83
|
end
|
80
84
|
|
@@ -93,10 +97,10 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
93
97
|
it "is not valid in default context" do
|
94
98
|
@operation.should_not be_valid
|
95
99
|
end
|
96
|
-
end
|
100
|
+
end
|
97
101
|
|
98
102
|
describe "with a clean working copy" do
|
99
|
-
before
|
103
|
+
before do
|
100
104
|
@operation.clean_working_copy = true
|
101
105
|
end
|
102
106
|
|
@@ -115,25 +119,27 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
115
119
|
it "is not valid in default context" do
|
116
120
|
@operation.should_not be_valid
|
117
121
|
end
|
118
|
-
end
|
119
|
-
end
|
122
|
+
end
|
123
|
+
end
|
120
124
|
|
121
125
|
|
122
|
-
describe SubversionOperation do
|
123
|
-
before
|
126
|
+
describe 'SubversionOperation' do
|
127
|
+
before do
|
128
|
+
SubversionOperation.auto_migrate!
|
129
|
+
|
124
130
|
@operation = SubversionOperation.new :name => "ci", :network_connection => true,
|
125
131
|
:message => "v1.5.8", :clean_working_copy => true
|
126
132
|
end
|
127
133
|
|
128
134
|
describe "without operation name" do
|
129
|
-
before
|
135
|
+
before do
|
130
136
|
@operation.name = nil
|
131
137
|
end
|
132
138
|
it_should_behave_like "unnamed SCM operation"
|
133
139
|
end
|
134
140
|
|
135
141
|
describe "without network connection" do
|
136
|
-
before
|
142
|
+
before do
|
137
143
|
@operation.network_connection = nil
|
138
144
|
end
|
139
145
|
|
@@ -141,6 +147,6 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
141
147
|
@operation.should_not be_valid_for_committing
|
142
148
|
@operation.should_not be_valid_for_log_viewing
|
143
149
|
end
|
144
|
-
end
|
150
|
+
end
|
145
151
|
end
|
146
|
-
end
|
152
|
+
end
|
@@ -22,18 +22,20 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
22
22
|
|
23
23
|
validates_present :on
|
24
24
|
end
|
25
|
-
Holiday.auto_migrate!
|
26
25
|
|
26
|
+
describe 'Holiday' do
|
27
|
+
before :all do
|
28
|
+
Holiday.auto_migrate!
|
29
|
+
end
|
27
30
|
|
28
|
-
|
29
|
-
before :each do
|
31
|
+
before do
|
30
32
|
@ny09 = Holiday.new(:on => Date.new(2008, 12, 31))
|
31
33
|
@ny09.should be_valid
|
32
34
|
end
|
33
35
|
|
34
36
|
|
35
37
|
describe "with on = nil" do
|
36
|
-
before
|
38
|
+
before do
|
37
39
|
@ny09.on = nil
|
38
40
|
end
|
39
41
|
|
@@ -46,11 +48,11 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
46
48
|
@ny09.on = Date.new(2008, 12, 31)
|
47
49
|
@ny09.should be_valid
|
48
50
|
end
|
49
|
-
end
|
51
|
+
end
|
50
52
|
|
51
53
|
|
52
54
|
describe "with on = valid date" do
|
53
|
-
before
|
55
|
+
before do
|
54
56
|
@ny09.on = 0.0
|
55
57
|
end
|
56
58
|
|
@@ -58,12 +60,12 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
58
60
|
# yes, presence validator does not care
|
59
61
|
@ny09.should be_valid
|
60
62
|
end
|
61
|
-
end
|
63
|
+
end
|
62
64
|
|
63
65
|
|
64
66
|
|
65
67
|
describe "with on = 0" do
|
66
|
-
before
|
68
|
+
before do
|
67
69
|
@ny09.on = 0
|
68
70
|
end
|
69
71
|
|
@@ -71,34 +73,34 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
71
73
|
# yes, presence validator does not care
|
72
74
|
@ny09.should be_valid
|
73
75
|
end
|
74
|
-
end
|
76
|
+
end
|
75
77
|
|
76
78
|
|
77
79
|
|
78
80
|
describe "with on = 100" do
|
79
|
-
before
|
81
|
+
before do
|
80
82
|
@ny09.on = 100
|
81
83
|
end
|
82
84
|
|
83
85
|
it "IS valid" do
|
84
86
|
@ny09.should be_valid
|
85
87
|
end
|
86
|
-
end
|
88
|
+
end
|
87
89
|
|
88
90
|
|
89
91
|
describe "with on = 100.0" do
|
90
|
-
before
|
92
|
+
before do
|
91
93
|
@ny09.on = 100.0
|
92
94
|
end
|
93
95
|
|
94
96
|
it "IS valid" do
|
95
97
|
@ny09.should be_valid
|
96
98
|
end
|
97
|
-
end
|
99
|
+
end
|
98
100
|
|
99
101
|
|
100
102
|
describe "with on = -1100" do
|
101
|
-
before
|
103
|
+
before do
|
102
104
|
# presence validator does not care
|
103
105
|
@ny09.on = -1100
|
104
106
|
end
|
@@ -106,11 +108,11 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
106
108
|
it "IS valid" do
|
107
109
|
@ny09.should be_valid
|
108
110
|
end
|
109
|
-
end
|
111
|
+
end
|
110
112
|
|
111
113
|
|
112
114
|
describe "with on = -1100.5" do
|
113
|
-
before
|
115
|
+
before do
|
114
116
|
# presence validator does not care
|
115
117
|
@ny09.on = -1100.5
|
116
118
|
end
|
@@ -118,6 +120,6 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
118
120
|
it "IS valid" do
|
119
121
|
@ny09.should be_valid
|
120
122
|
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|