dm-validations 0.10.2 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +36 -0
- data/Gemfile +143 -0
- data/README.rdoc +52 -102
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/dm-validations.gemspec +126 -14
- data/lib/dm-validations.rb +78 -18
- data/lib/dm-validations/auto_validate.rb +27 -23
- data/lib/dm-validations/contextual_validators.rb +3 -3
- data/lib/dm-validations/formats/email.rb +3 -3
- data/lib/dm-validations/formats/url.rb +3 -3
- data/lib/dm-validations/support/context.rb +1 -1
- data/lib/dm-validations/validation_errors.rb +5 -7
- data/lib/dm-validations/validators/absent_field_validator.rb +13 -9
- data/lib/dm-validations/validators/acceptance_validator.rb +10 -7
- data/lib/dm-validations/validators/block_validator.rb +3 -3
- data/lib/dm-validations/validators/confirmation_validator.rb +10 -7
- data/lib/dm-validations/validators/format_validator.rb +14 -10
- data/lib/dm-validations/validators/generic_validator.rb +3 -3
- data/lib/dm-validations/validators/length_validator.rb +10 -7
- data/lib/dm-validations/validators/method_validator.rb +3 -3
- data/lib/dm-validations/validators/numeric_validator.rb +25 -14
- data/lib/dm-validations/validators/primitive_validator.rb +12 -8
- data/lib/dm-validations/validators/required_field_validator.rb +12 -9
- data/lib/dm-validations/validators/uniqueness_validator.rb +9 -6
- data/lib/dm-validations/validators/within_validator.rb +3 -3
- data/spec/fixtures/barcode.rb +10 -2
- data/spec/fixtures/basketball_court.rb +7 -7
- data/spec/fixtures/basketball_player.rb +3 -3
- data/spec/fixtures/beta_tester_account.rb +4 -4
- data/spec/fixtures/bill_of_landing.rb +7 -7
- data/spec/fixtures/boat_dock.rb +2 -2
- data/spec/fixtures/city.rb +1 -1
- data/spec/fixtures/company.rb +7 -7
- data/spec/fixtures/corporate_world.rb +24 -26
- data/spec/fixtures/country.rb +1 -1
- data/spec/fixtures/currency.rb +4 -4
- data/spec/fixtures/ethernet_frame.rb +5 -5
- data/spec/fixtures/event.rb +2 -2
- data/spec/fixtures/g3_concert.rb +3 -3
- data/spec/fixtures/jabberwock.rb +2 -2
- data/spec/fixtures/kayak.rb +2 -2
- data/spec/fixtures/lernean_hydra.rb +3 -3
- data/spec/fixtures/mathematical_function.rb +2 -2
- data/spec/fixtures/memory_object.rb +3 -3
- data/spec/fixtures/mittelschnauzer.rb +3 -3
- data/spec/fixtures/motor_launch.rb +1 -1
- data/spec/fixtures/page.rb +3 -3
- data/spec/fixtures/phone_number.rb +2 -2
- data/spec/fixtures/pirogue.rb +2 -2
- data/spec/fixtures/programming_language.rb +3 -3
- data/spec/fixtures/reservation.rb +5 -5
- data/spec/fixtures/scm_operation.rb +42 -45
- data/spec/fixtures/sms_message.rb +1 -1
- data/spec/fixtures/udp_packet.rb +3 -3
- data/spec/integration/absent_field_validator/absent_field_validator_spec.rb +6 -6
- data/spec/integration/acceptance_validator/acceptance_validator_spec.rb +3 -3
- data/spec/integration/automatic_validation/inferred_length_validation_spec.rb +5 -5
- data/spec/integration/automatic_validation/spec_helper.rb +1 -1
- data/spec/integration/block_validator/block_validator_spec.rb +2 -2
- data/spec/integration/conditional_validation/if_condition_spec.rb +3 -3
- data/spec/integration/confirmation_validator/confirmation_validator_spec.rb +3 -3
- data/spec/integration/datamapper_models/association_validation_spec.rb +5 -5
- data/spec/integration/datamapper_models/inheritance_spec.rb +6 -6
- data/spec/integration/duplicated_validations/duplicated_validations_spec.rb +3 -3
- data/spec/integration/format_validator/email_format_validator_spec.rb +6 -6
- data/spec/integration/format_validator/format_validator_spec.rb +8 -8
- data/spec/integration/format_validator/regexp_validator_spec.rb +4 -4
- data/spec/integration/format_validator/url_format_validator_spec.rb +4 -4
- data/spec/integration/length_validator/default_value_spec.rb +3 -3
- data/spec/integration/length_validator/equality_spec.rb +4 -4
- data/spec/integration/length_validator/error_message_spec.rb +3 -3
- data/spec/integration/length_validator/maximum_spec.rb +3 -3
- data/spec/integration/length_validator/minimum_spec.rb +3 -3
- data/spec/integration/length_validator/range_spec.rb +3 -3
- data/spec/integration/method_validator/method_validator_spec.rb +8 -8
- data/spec/integration/numeric_validator/equality_with_float_type_spec.rb +7 -7
- data/spec/integration/numeric_validator/equality_with_integer_type_spec.rb +5 -5
- data/spec/integration/numeric_validator/float_type_spec.rb +3 -3
- data/spec/integration/numeric_validator/gt_with_float_type_spec.rb +3 -3
- data/spec/integration/numeric_validator/gte_with_float_type_spec.rb +3 -3
- data/spec/integration/numeric_validator/lt_with_float_type_spec.rb +3 -3
- data/spec/integration/numeric_validator/lte_with_float_type_spec.rb +3 -3
- data/spec/integration/primitive_validator/primitive_validator_spec.rb +4 -4
- data/spec/integration/pure_ruby_objects/plain_old_ruby_object_validation_spec.rb +4 -4
- data/spec/integration/required_field_validator/association_spec.rb +19 -51
- data/spec/integration/required_field_validator/boolean_type_value_spec.rb +4 -1
- data/spec/integration/required_field_validator/date_type_value_spec.rb +4 -2
- data/spec/integration/required_field_validator/datetime_type_value_spec.rb +4 -2
- data/spec/integration/required_field_validator/float_type_value_spec.rb +4 -2
- data/spec/integration/required_field_validator/integer_type_value_spec.rb +4 -2
- data/spec/integration/required_field_validator/plain_old_ruby_object_spec.rb +6 -4
- data/spec/integration/required_field_validator/string_type_value_spec.rb +3 -1
- data/spec/integration/required_field_validator/text_type_value_spec.rb +3 -1
- data/spec/integration/shared/valid_and_invalid_model.rb +8 -0
- data/spec/integration/uniqueness_validator/uniqueness_validator_spec.rb +29 -25
- data/spec/integration/within_validator/within_validator_spec.rb +6 -6
- data/spec/public/resource_spec.rb +47 -9
- data/spec/spec_helper.rb +13 -27
- data/spec/unit/contextual_validators/emptiness_spec.rb +4 -4
- data/spec/unit/contextual_validators/execution_spec.rb +6 -6
- data/spec/unit/contextual_validators/spec_helper.rb +3 -3
- data/spec/unit/generic_validator/equality_operator_spec.rb +7 -7
- data/spec/unit/validation_errors/adding_spec.rb +2 -2
- data/spec/unit/validation_errors/emptiness_spec.rb +2 -2
- data/spec/unit/validation_errors/enumerable_spec.rb +2 -2
- data/tasks/local_gemfile.rake +18 -0
- data/tasks/spec.rake +0 -3
- metadata +157 -25
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'DataMapper::
|
3
|
+
describe 'DataMapper::Validations::Fixtures::ServiceCompany' do
|
4
4
|
before :all do
|
5
|
-
DataMapper::
|
5
|
+
DataMapper::Validations::Fixtures::ServiceCompany.auto_migrate!
|
6
6
|
|
7
|
-
@model = DataMapper::
|
7
|
+
@model = DataMapper::Validations::Fixtures::ServiceCompany.new(:title => "Monsters, Inc.", :area_of_expertise => "Little children's nightmares")
|
8
8
|
@model.valid?
|
9
9
|
end
|
10
10
|
|
@@ -35,11 +35,11 @@ end
|
|
35
35
|
|
36
36
|
|
37
37
|
|
38
|
-
describe 'DataMapper::
|
38
|
+
describe 'DataMapper::Validations::Fixtures::ProductCompany' do
|
39
39
|
before :all do
|
40
|
-
DataMapper::
|
40
|
+
DataMapper::Validations::Fixtures::ProductCompany.auto_migrate!
|
41
41
|
|
42
|
-
@model = DataMapper::
|
42
|
+
@model = DataMapper::Validations::Fixtures::ProductCompany.new(:title => "Apple", :flagship_product => "Macintosh")
|
43
43
|
@model.valid?
|
44
44
|
end
|
45
45
|
|
@@ -3,11 +3,11 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
require 'integration/duplicated_validations/spec_helper'
|
5
5
|
|
6
|
-
describe 'DataMapper::
|
6
|
+
describe 'DataMapper::Validations::Fixtures::Page' do
|
7
7
|
before :all do
|
8
|
-
DataMapper::
|
8
|
+
DataMapper::Validations::Fixtures::Page.auto_migrate!
|
9
9
|
|
10
|
-
@model = DataMapper::
|
10
|
+
@model = DataMapper::Validations::Fixtures::Page.new(:id => 1024)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "without body" do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/format_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::BillOfLading' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::BillOfLading.auto_migrate!
|
7
7
|
end
|
8
8
|
|
9
9
|
def valid_attributes
|
@@ -26,7 +26,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
26
26
|
|
27
27
|
describe "with email value of #{email} (RFC2822 compliant)" do
|
28
28
|
before :all do
|
29
|
-
@model = DataMapper::
|
29
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:email => email))
|
30
30
|
end
|
31
31
|
|
32
32
|
it_should_behave_like "valid model"
|
@@ -43,7 +43,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
43
43
|
'J. P. \'s-Gravezande, a.k.a. The Hacker!@example.com'].each do |email|
|
44
44
|
describe "with email value of #{email} (non RFC2822 compliant)" do
|
45
45
|
before :all do
|
46
|
-
@model = DataMapper::
|
46
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:email => email))
|
47
47
|
end
|
48
48
|
|
49
49
|
it_should_behave_like "invalid model"
|
@@ -65,7 +65,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
65
65
|
'http://www.example.com',
|
66
66
|
]
|
67
67
|
|
68
|
-
bol = DataMapper::
|
68
|
+
bol = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.except(:url))
|
69
69
|
bol.should_not be_valid
|
70
70
|
bol.errors.on(:url).should == [ 'Url has an invalid format' ]
|
71
71
|
|
@@ -85,7 +85,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
85
85
|
|
86
86
|
describe 'with a regexp' do
|
87
87
|
before do
|
88
|
-
@bol = DataMapper::
|
88
|
+
@bol = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes)
|
89
89
|
@bol.should be_valid
|
90
90
|
end
|
91
91
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/format_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::BillOfLading' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::BillOfLading.auto_migrate!
|
7
7
|
end
|
8
8
|
|
9
9
|
def valid_attributes
|
@@ -12,7 +12,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
12
12
|
|
13
13
|
describe "with doc no with value of 'BAD CODE :)'" do
|
14
14
|
before :all do
|
15
|
-
@model = DataMapper::
|
15
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:doc_no => 'BAD CODE :)'))
|
16
16
|
end
|
17
17
|
|
18
18
|
it_should_behave_like 'invalid model'
|
@@ -24,7 +24,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
24
24
|
|
25
25
|
describe "with doc no with value of 'A1234'" do
|
26
26
|
before :all do
|
27
|
-
@model = DataMapper::
|
27
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:doc_no => 'A1234'))
|
28
28
|
end
|
29
29
|
|
30
30
|
it_should_behave_like 'valid model'
|
@@ -32,7 +32,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
32
32
|
|
33
33
|
describe "with doc no with value of 'B123456X12'" do
|
34
34
|
before :all do
|
35
|
-
@model = DataMapper::
|
35
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:doc_no => 'B123456X12'))
|
36
36
|
end
|
37
37
|
|
38
38
|
it_should_behave_like 'valid model'
|
@@ -40,7 +40,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
40
40
|
|
41
41
|
describe "with missing url" do
|
42
42
|
before :all do
|
43
|
-
@model = DataMapper::
|
43
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.except(:url))
|
44
44
|
end
|
45
45
|
|
46
46
|
it_should_behave_like 'invalid model'
|
@@ -48,7 +48,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
48
48
|
|
49
49
|
describe "with blank name" do
|
50
50
|
before :all do
|
51
|
-
@model = DataMapper::
|
51
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:username => ''))
|
52
52
|
end
|
53
53
|
|
54
54
|
it_should_behave_like 'valid model'
|
@@ -56,7 +56,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
56
56
|
|
57
57
|
describe "with blank email" do
|
58
58
|
before :all do
|
59
|
-
@model = DataMapper::
|
59
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:email => ''))
|
60
60
|
end
|
61
61
|
|
62
62
|
it_should_behave_like 'valid model'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/format_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::BillOfLading' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::BillOfLading.auto_migrate!
|
7
7
|
end
|
8
8
|
|
9
9
|
def valid_attributes
|
@@ -12,7 +12,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
12
12
|
|
13
13
|
describe "with code of 123456" do
|
14
14
|
before :all do
|
15
|
-
@model = DataMapper::
|
15
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:code => '123456'))
|
16
16
|
end
|
17
17
|
|
18
18
|
it_should_behave_like 'valid model'
|
@@ -21,7 +21,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
21
21
|
|
22
22
|
describe "with code of 12" do
|
23
23
|
before :all do
|
24
|
-
@model = DataMapper::
|
24
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:code => '12'))
|
25
25
|
end
|
26
26
|
|
27
27
|
it_should_behave_like 'invalid model'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/format_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::BillOfLading' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::BillOfLading.auto_migrate!
|
7
7
|
end
|
8
8
|
|
9
9
|
def valid_attributes
|
@@ -21,7 +21,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
21
21
|
"http://localhost:4000", "http://localhost" ].each do |uri|
|
22
22
|
describe "with URL of #{uri}" do
|
23
23
|
before :all do
|
24
|
-
@model = DataMapper::
|
24
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:url => uri))
|
25
25
|
end
|
26
26
|
|
27
27
|
it_should_behave_like "invalid model"
|
@@ -58,7 +58,7 @@ describe 'DataMapper::Validate::Fixtures::BillOfLading' do
|
|
58
58
|
].each do |uri|
|
59
59
|
describe "with URL of #{uri}" do
|
60
60
|
before :all do
|
61
|
-
@model = DataMapper::
|
61
|
+
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:url => uri))
|
62
62
|
end
|
63
63
|
|
64
64
|
it_should_behave_like "valid model"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/length_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::BoatDock' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::BoatDock.auto_migrate!
|
7
7
|
|
8
|
-
@model = DataMapper::
|
8
|
+
@model = DataMapper::Validations::Fixtures::BoatDock.new
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "with default values that are valid" do
|
@@ -10,11 +10,11 @@ describe "entity with wrong destination MAC address length", :shared => true do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
|
13
|
-
describe 'DataMapper::
|
13
|
+
describe 'DataMapper::Validations::Fixtures::EthernetFrame' do
|
14
14
|
before :all do
|
15
|
-
DataMapper::
|
15
|
+
DataMapper::Validations::Fixtures::EthernetFrame.auto_migrate!
|
16
16
|
|
17
|
-
@model = DataMapper::
|
17
|
+
@model = DataMapper::Validations::Fixtures::EthernetFrame.valid_instance
|
18
18
|
@model.link_support_fragmentation = false
|
19
19
|
end
|
20
20
|
|
@@ -68,7 +68,7 @@ describe 'DataMapper::Validate::Fixtures::EthernetFrame' do
|
|
68
68
|
|
69
69
|
describe "with multibyte characters" do
|
70
70
|
before :all do
|
71
|
-
@model = DataMapper::
|
71
|
+
@model = DataMapper::Validations::Fixtures::Currency.valid_instance(
|
72
72
|
:name => 'Euro',
|
73
73
|
:code => 'EUR',
|
74
74
|
:symbol => '€'
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/length_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::Jabberwock' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::Jabberwock.auto_migrate!
|
7
7
|
|
8
|
-
@model = DataMapper::
|
8
|
+
@model = DataMapper::Validations::Fixtures::Jabberwock.new
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "without snickersnack" do
|
@@ -7,11 +7,11 @@ describe "barcode with invalid code length", :shared => true do
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
describe 'DataMapper::
|
10
|
+
describe 'DataMapper::Validations::Fixtures::Barcode' do
|
11
11
|
before :all do
|
12
|
-
DataMapper::
|
12
|
+
DataMapper::Validations::Fixtures::Barcode.auto_migrate!
|
13
13
|
|
14
|
-
@model = DataMapper::
|
14
|
+
@model = DataMapper::Validations::Fixtures::Barcode.valid_instance
|
15
15
|
end
|
16
16
|
|
17
17
|
it_should_behave_like "valid model"
|
@@ -7,11 +7,11 @@ describe "entity with a name shorter than 2 characters", :shared => true do
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
describe 'DataMapper::
|
10
|
+
describe 'DataMapper::Validations::Fixtures::Mittelschnauzer' do
|
11
11
|
before :all do
|
12
|
-
DataMapper::
|
12
|
+
DataMapper::Validations::Fixtures::Mittelschnauzer.auto_migrate!
|
13
13
|
|
14
|
-
@model = DataMapper::
|
14
|
+
@model = DataMapper::Validations::Fixtures::Mittelschnauzer.valid_instance
|
15
15
|
end
|
16
16
|
|
17
17
|
it_should_behave_like "valid model"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/length_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::EthernetFrame' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::EthernetFrame.auto_migrate!
|
7
7
|
|
8
|
-
@model = DataMapper::
|
8
|
+
@model = DataMapper::Validations::Fixtures::EthernetFrame.valid_instance
|
9
9
|
@model.link_support_fragmentation = false
|
10
10
|
end
|
11
11
|
|
@@ -75,7 +75,7 @@ end
|
|
75
75
|
|
76
76
|
describe "C" do
|
77
77
|
before :all do
|
78
|
-
@model = ::DataMapper::
|
78
|
+
@model = ::DataMapper::Validations::Fixtures::ProgrammingLanguage.new(:name => "C",
|
79
79
|
:allows_system_calls => true,
|
80
80
|
:allows_manual_memory_management => true,
|
81
81
|
:approved_by_linus => true,
|
@@ -98,7 +98,7 @@ end
|
|
98
98
|
|
99
99
|
describe "C++" do
|
100
100
|
before :all do
|
101
|
-
@model = ::DataMapper::
|
101
|
+
@model = ::DataMapper::Validations::Fixtures::ProgrammingLanguage.new(:name => "C++",
|
102
102
|
:allows_system_calls => true,
|
103
103
|
:allows_manual_memory_management => true,
|
104
104
|
:approved_by_linus => false,
|
@@ -125,7 +125,7 @@ end
|
|
125
125
|
|
126
126
|
describe "Ruby" do
|
127
127
|
before :all do
|
128
|
-
@model = ::DataMapper::
|
128
|
+
@model = ::DataMapper::Validations::Fixtures::ProgrammingLanguage.new(:name => "Ruby",
|
129
129
|
# well, C extensions do not really count
|
130
130
|
:allows_system_calls => false,
|
131
131
|
:allows_manual_memory_management => false,
|
@@ -153,7 +153,7 @@ end
|
|
153
153
|
|
154
154
|
describe "Scala" do
|
155
155
|
before :all do
|
156
|
-
@model = ::DataMapper::
|
156
|
+
@model = ::DataMapper::Validations::Fixtures::ProgrammingLanguage.new(:name => "Scala",
|
157
157
|
:allows_system_calls => false,
|
158
158
|
:allows_manual_memory_management => false,
|
159
159
|
:approved_by_linus => false,
|
@@ -181,7 +181,7 @@ end
|
|
181
181
|
|
182
182
|
describe "Haskell" do
|
183
183
|
before :all do
|
184
|
-
@model = ::DataMapper::
|
184
|
+
@model = ::DataMapper::Validations::Fixtures::ProgrammingLanguage.new(:name => "Haskell",
|
185
185
|
:allows_system_calls => false,
|
186
186
|
:allows_manual_memory_management => false,
|
187
187
|
:approved_by_linus => false,
|
@@ -210,11 +210,11 @@ describe "Haskell" do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
|
213
|
-
describe 'DataMapper::
|
213
|
+
describe 'DataMapper::Validations::Fixtures::Event' do
|
214
214
|
before :all do
|
215
|
-
DataMapper::
|
215
|
+
DataMapper::Validations::Fixtures::Event.auto_migrate!
|
216
216
|
|
217
|
-
@model = DataMapper::
|
217
|
+
@model = DataMapper::Validations::Fixtures::Event.new(:name => "Fools day 2009")
|
218
218
|
end
|
219
219
|
|
220
220
|
describe "with start time before end time" do
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::BasketballCourt' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::BasketballCourt.auto_migrate!
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "with valid set of attributes" do
|
10
10
|
before :all do
|
11
|
-
@model = DataMapper::
|
11
|
+
@model = DataMapper::Validations::Fixtures::BasketballCourt.valid_instance
|
12
12
|
@model.valid?
|
13
13
|
end
|
14
14
|
|
@@ -18,7 +18,7 @@ describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
|
18
18
|
|
19
19
|
describe "with rim height of 3.05" do
|
20
20
|
before :all do
|
21
|
-
@model = DataMapper::
|
21
|
+
@model = DataMapper::Validations::Fixtures::BasketballCourt.valid_instance(:rim_height => 3.05)
|
22
22
|
@model.valid?
|
23
23
|
end
|
24
24
|
|
@@ -28,7 +28,7 @@ describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
|
28
28
|
|
29
29
|
describe "with rim height of 3.30" do
|
30
30
|
before :all do
|
31
|
-
@model = DataMapper::
|
31
|
+
@model = DataMapper::Validations::Fixtures::BasketballCourt.valid_instance(:rim_height => 3.30)
|
32
32
|
@model.valid?
|
33
33
|
end
|
34
34
|
|
@@ -42,7 +42,7 @@ describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
|
42
42
|
|
43
43
|
describe "with free throw line distance of 4.57" do
|
44
44
|
before :all do
|
45
|
-
@model = DataMapper::
|
45
|
+
@model = DataMapper::Validations::Fixtures::BasketballCourt.valid_instance(:free_throw_line_distance => 4.57)
|
46
46
|
@model.valid?
|
47
47
|
end
|
48
48
|
|
@@ -52,7 +52,7 @@ describe 'DataMapper::Validate::Fixtures::BasketballCourt' do
|
|
52
52
|
|
53
53
|
describe "with free throw line distance of 3.10" do
|
54
54
|
before :all do
|
55
|
-
@model = DataMapper::
|
55
|
+
@model = DataMapper::Validations::Fixtures::BasketballCourt.valid_instance(:free_throw_line_distance => 3.10)
|
56
56
|
@model.valid?
|
57
57
|
end
|
58
58
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'integration/numeric_validator/spec_helper'
|
3
3
|
|
4
|
-
describe 'DataMapper::
|
4
|
+
describe 'DataMapper::Validations::Fixtures::LerneanHydra' do
|
5
5
|
before :all do
|
6
|
-
DataMapper::
|
6
|
+
DataMapper::Validations::Fixtures::LerneanHydra.auto_migrate!
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "with valid set of attributes" do
|
10
10
|
before :all do
|
11
|
-
@model = DataMapper::
|
11
|
+
@model = DataMapper::Validations::Fixtures::LerneanHydra.valid_instance
|
12
12
|
@model.valid?
|
13
13
|
end
|
14
14
|
|
@@ -18,7 +18,7 @@ describe 'DataMapper::Validate::Fixtures::LerneanHydra' do
|
|
18
18
|
|
19
19
|
describe "with 9 heads" do
|
20
20
|
before :all do
|
21
|
-
@model = DataMapper::
|
21
|
+
@model = DataMapper::Validations::Fixtures::LerneanHydra.valid_instance(:head_count => 9)
|
22
22
|
@model.valid?
|
23
23
|
end
|
24
24
|
|
@@ -28,7 +28,7 @@ describe 'DataMapper::Validate::Fixtures::LerneanHydra' do
|
|
28
28
|
|
29
29
|
describe "with only 3 heads" do
|
30
30
|
before :all do
|
31
|
-
@model = DataMapper::
|
31
|
+
@model = DataMapper::Validations::Fixtures::LerneanHydra.valid_instance(:head_count => 3)
|
32
32
|
@model.valid?
|
33
33
|
end
|
34
34
|
|