dm-validations 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/Rakefile +23 -18
  2. data/VERSION +1 -0
  3. data/dm-validations.gemspec +188 -0
  4. data/lib/dm-validations.rb +25 -75
  5. data/lib/dm-validations/auto_validate.rb +7 -7
  6. data/lib/dm-validations/contextual_validators.rb +4 -18
  7. data/lib/dm-validations/exceptions.rb +3 -1
  8. data/lib/dm-validations/support/context.rb +40 -1
  9. data/lib/dm-validations/validation_errors.rb +2 -13
  10. data/lib/dm-validations/validators/absent_field_validator.rb +2 -2
  11. data/lib/dm-validations/validators/acceptance_validator.rb +14 -16
  12. data/lib/dm-validations/validators/confirmation_validator.rb +17 -15
  13. data/lib/dm-validations/validators/format_validator.rb +18 -11
  14. data/lib/dm-validations/validators/generic_validator.rb +45 -15
  15. data/lib/dm-validations/validators/length_validator.rb +2 -11
  16. data/lib/dm-validations/validators/method_validator.rb +2 -2
  17. data/lib/dm-validations/validators/numeric_validator.rb +8 -6
  18. data/lib/dm-validations/validators/primitive_validator.rb +1 -1
  19. data/lib/dm-validations/validators/uniqueness_validator.rb +13 -9
  20. data/lib/dm-validations/validators/within_validator.rb +4 -3
  21. data/spec/fixtures/basketball_player.rb +0 -3
  22. data/spec/fixtures/bill_of_landing.rb +1 -1
  23. data/spec/fixtures/city.rb +0 -1
  24. data/spec/fixtures/company.rb +1 -3
  25. data/spec/fixtures/corporate_world.rb +0 -6
  26. data/spec/fixtures/country.rb +0 -1
  27. data/spec/fixtures/event.rb +1 -1
  28. data/spec/fixtures/page.rb +2 -2
  29. data/spec/fixtures/reservation.rb +1 -1
  30. data/spec/fixtures/scm_operation.rb +0 -8
  31. data/spec/integration/absent_field_validator/absent_field_validator_spec.rb +6 -2
  32. data/spec/integration/acceptance_validator/acceptance_validator_spec.rb +36 -36
  33. data/spec/integration/automatic_validation/custom_messages_for_inferred_validation_spec.rb +2 -2
  34. data/spec/integration/automatic_validation/disabling_inferred_validation_spec.rb +4 -4
  35. data/spec/integration/automatic_validation/inferred_boolean_properties_validation_spec.rb +2 -2
  36. data/spec/integration/automatic_validation/inferred_float_property_validation_spec.rb +2 -0
  37. data/spec/integration/automatic_validation/inferred_format_validation_spec.rb +3 -1
  38. data/spec/integration/automatic_validation/inferred_integer_properties_validation_spec.rb +2 -0
  39. data/spec/integration/automatic_validation/inferred_length_validation_spec.rb +6 -2
  40. data/spec/integration/automatic_validation/inferred_presence_validation_spec.rb +8 -4
  41. data/spec/integration/automatic_validation/inferred_primitive_validation_spec.rb +3 -1
  42. data/spec/integration/automatic_validation/spec_helper.rb +6 -6
  43. data/spec/integration/block_validator/block_validator_spec.rb +1 -1
  44. data/spec/integration/conditional_validation/if_condition_spec.rb +3 -1
  45. data/spec/integration/confirmation_validator/confirmation_validator_spec.rb +3 -1
  46. data/spec/integration/datamapper_models/association_validation_spec.rb +4 -1
  47. data/spec/integration/datamapper_models/inheritance_spec.rb +6 -2
  48. data/spec/integration/duplicated_validations/duplicated_validations_spec.rb +3 -1
  49. data/spec/integration/format_validator/email_format_validator_spec.rb +5 -1
  50. data/spec/integration/format_validator/format_validator_spec.rb +5 -1
  51. data/spec/integration/format_validator/regexp_validator_spec.rb +5 -1
  52. data/spec/integration/format_validator/url_format_validator_spec.rb +8 -4
  53. data/spec/integration/length_validator/default_value_spec.rb +4 -2
  54. data/spec/integration/length_validator/equality_spec.rb +3 -1
  55. data/spec/integration/length_validator/error_message_spec.rb +3 -1
  56. data/spec/integration/length_validator/maximum_spec.rb +3 -1
  57. data/spec/integration/length_validator/minimum_spec.rb +3 -1
  58. data/spec/integration/length_validator/range_spec.rb +3 -1
  59. data/spec/integration/method_validator/method_validator_spec.rb +3 -1
  60. data/spec/integration/numeric_validator/equality_with_float_type_spec.rb +5 -1
  61. data/spec/integration/numeric_validator/equality_with_integer_type_spec.rb +5 -1
  62. data/spec/integration/numeric_validator/float_type_spec.rb +3 -1
  63. data/spec/integration/numeric_validator/gt_with_float_type_spec.rb +3 -1
  64. data/spec/integration/numeric_validator/gte_with_float_type_spec.rb +3 -1
  65. data/spec/integration/numeric_validator/integer_only_true_spec.rb +11 -9
  66. data/spec/integration/numeric_validator/integer_type_spec.rb +10 -8
  67. data/spec/integration/numeric_validator/lt_with_float_type_spec.rb +3 -1
  68. data/spec/integration/numeric_validator/lte_with_float_type_spec.rb +3 -1
  69. data/spec/integration/primitive_validator/primitive_validator_spec.rb +3 -1
  70. data/spec/integration/pure_ruby_objects/plain_old_ruby_object_validation_spec.rb +6 -6
  71. data/spec/integration/required_field_validator/association_spec.rb +9 -4
  72. data/spec/integration/required_field_validator/boolean_type_value_spec.rb +24 -18
  73. data/spec/integration/required_field_validator/date_type_value_spec.rb +21 -19
  74. data/spec/integration/required_field_validator/datetime_type_value_spec.rb +21 -19
  75. data/spec/integration/required_field_validator/float_type_value_spec.rb +21 -19
  76. data/spec/integration/required_field_validator/integer_type_value_spec.rb +17 -15
  77. data/spec/integration/required_field_validator/shared_examples.rb +5 -3
  78. data/spec/integration/required_field_validator/string_type_value_spec.rb +20 -16
  79. data/spec/integration/required_field_validator/text_type_value_spec.rb +10 -6
  80. data/spec/integration/uniqueness_validator/uniqueness_validator_spec.rb +23 -25
  81. data/spec/integration/within_validator/within_validator_spec.rb +7 -3
  82. data/spec/public/resource_spec.rb +5 -6
  83. data/spec/rcov.opts +6 -0
  84. data/spec/spec.opts +2 -0
  85. data/spec/unit/contextual_validators/emptiness_spec.rb +1 -1
  86. data/spec/unit/contextual_validators/execution_spec.rb +9 -16
  87. data/spec/unit/generic_validator/equality_operator_spec.rb +3 -3
  88. data/spec/unit/validation_errors/adding_spec.rb +1 -1
  89. data/spec/unit/validation_errors/emptiness_spec.rb +1 -1
  90. data/spec/unit/validation_errors/enumerable_spec.rb +1 -1
  91. data/tasks/ci.rake +1 -0
  92. data/tasks/metrics.rake +36 -0
  93. data/tasks/spec.rake +41 -0
  94. data/tasks/yard.rake +9 -0
  95. data/tasks/yardstick.rake +19 -0
  96. metadata +36 -18
  97. data/History.rdoc +0 -45
  98. data/Manifest.txt +0 -139
  99. data/TODO +0 -16
  100. data/lib/dm-validations/version.rb +0 -5
  101. data/tasks/install.rb +0 -13
  102. data/tasks/spec.rb +0 -25
@@ -3,14 +3,16 @@ require 'integration/uniqueness_validator/spec_helper'
3
3
 
4
4
 
5
5
  if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
6
- describe DataMapper::Validate::Fixtures::Department do
6
+ describe 'DataMapper::Validate::Fixtures::Department' do
7
7
  before :all do
8
- ::DataMapper::Validate::Fixtures::Department.create(:name => "HR")
8
+ DataMapper::Validate::Fixtures::Department.auto_migrate!
9
+
10
+ DataMapper::Validate::Fixtures::Department.create(:name => "HR")
9
11
  end
10
12
 
11
13
  describe "with unique name" do
12
14
  before :all do
13
- @model = ::DataMapper::Validate::Fixtures::Department.new(:name => "R & D")
15
+ @model = DataMapper::Validate::Fixtures::Department.new(:name => "R & D")
14
16
  end
15
17
 
16
18
  it_should_behave_like "valid model"
@@ -18,19 +20,19 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
18
20
 
19
21
  describe "with a duplicate name" do
20
22
  before :all do
21
- @model = ::DataMapper::Validate::Fixtures::Department.new(:name => "HR")
23
+ @model = DataMapper::Validate::Fixtures::Department.new(:name => "HR")
22
24
  end
23
25
 
24
26
  it_should_behave_like "invalid model"
25
27
  end
26
28
  end
27
29
 
28
-
29
-
30
- describe DataMapper::Validate::Fixtures::Organisation do
30
+ describe 'DataMapper::Validate::Fixtures::Organisation' do
31
31
  before :all do
32
- DataMapper.repository do
33
- @model = ::DataMapper::Validate::Fixtures::Organisation.create(:name => 'Apple', :domain => 'apple.com')
32
+ DataMapper::Validate::Fixtures::Organisation.auto_migrate!
33
+
34
+ @model = DataMapper.repository do
35
+ DataMapper::Validate::Fixtures::Organisation.create(:name => 'Apple', :domain => 'apple.com')
34
36
  end
35
37
  end
36
38
 
@@ -44,8 +46,7 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
44
46
 
45
47
  describe "with a duplicate domain" do
46
48
  before :all do
47
- @model.name = "Fake Apple"
48
- @model.domain = "apple.com"
49
+ @model = DataMapper::Validate::Fixtures::Organisation.new(:name => 'Fake Apple', :domain => 'apple.com')
49
50
  end
50
51
 
51
52
  it_should_behave_like "invalid model"
@@ -62,19 +63,16 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
62
63
  end
63
64
  end
64
65
 
65
-
66
-
67
- describe DataMapper::Validate::Fixtures::User do
66
+ describe 'DataMapper::Validate::Fixtures::User' do
68
67
  before :all do
69
- # remove data from previous spec runs
70
- ::DataMapper::Validate::Fixtures::Organisation.all.destroy!
71
- ::DataMapper::Validate::Fixtures::Department.all.destroy!
72
- ::DataMapper::Validate::Fixtures::User.all.destroy!
68
+ DataMapper::Validate::Fixtures::Organisation.auto_migrate!
69
+ DataMapper::Validate::Fixtures::Department.auto_migrate!
70
+ DataMapper::Validate::Fixtures::User.auto_migrate!
73
71
 
74
72
  DataMapper.repository do
75
- @organization = ::DataMapper::Validate::Fixtures::Organisation.create(:name => 'Org 101', :domain => '101')
76
- @dept = ::DataMapper::Validate::Fixtures::Department.create(:name => 'accounting')
77
- @user = ::DataMapper::Validate::Fixtures::User.create(:organisation => @organization, :user_name => 'guy', :department => @dept)
73
+ @organization = DataMapper::Validate::Fixtures::Organisation.create(:name => 'Org 101', :domain => '101')
74
+ @dept = DataMapper::Validate::Fixtures::Department.create(:name => 'accounting')
75
+ @user = DataMapper::Validate::Fixtures::User.create(:organisation => @organization, :user_name => 'guy', :department => @dept)
78
76
 
79
77
  @organization.should be_saved
80
78
  @dept.should be_saved
@@ -84,7 +82,7 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
84
82
 
85
83
  describe "with username not valid across the organization" do
86
84
  before :all do
87
- @model = ::DataMapper::Validate::Fixtures::User.new(:organisation => @organization, :user_name => 'guy')
85
+ @model = DataMapper::Validate::Fixtures::User.new(:organisation => @organization, :user_name => 'guy')
88
86
  end
89
87
 
90
88
  it "is not valid for signing up" do
@@ -99,7 +97,7 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
99
97
 
100
98
  describe "with username not valid across the department" do
101
99
  before :all do
102
- @model = ::DataMapper::Validate::Fixtures::User.new(:user_name => 'guy', :department => @dept)
100
+ @model = DataMapper::Validate::Fixtures::User.new(:user_name => 'guy', :department => @dept)
103
101
  end
104
102
 
105
103
  it "is not valid for setting up the account" do
@@ -110,5 +108,5 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
110
108
  @model.errors.on(:user_name).should == [ 'User name is already taken' ]
111
109
  end
112
110
  end
113
- end # describe DataMapper::Validate::Fixtures::User
114
- end # if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
111
+ end
112
+ end
@@ -1,8 +1,10 @@
1
1
  require 'spec_helper'
2
2
  require 'integration/within_validator/spec_helper'
3
3
 
4
- describe DataMapper::Validate::Fixtures::PhoneNumber do
5
- before(:all) do
4
+ describe 'DataMapper::Validate::Fixtures::PhoneNumber' do
5
+ before :all do
6
+ DataMapper::Validate::Fixtures::PhoneNumber.auto_migrate!
7
+
6
8
  @model = DataMapper::Validate::Fixtures::PhoneNumber.new(:type_of_number => 'cell')
7
9
  @model.should be_valid
8
10
  end
@@ -49,8 +51,10 @@ end
49
51
 
50
52
 
51
53
 
52
- describe DataMapper::Validate::Fixtures::MathematicalFunction do
54
+ describe 'DataMapper::Validate::Fixtures::MathematicalFunction' do
53
55
  before :all do
56
+ DataMapper::Validate::Fixtures::MathematicalFunction.auto_migrate!
57
+
54
58
  @model = DataMapper::Validate::Fixtures::MathematicalFunction.new(:input => 2, :output => -2)
55
59
  @model.should be_valid
56
60
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe DataMapper::Resource do
3
+ describe 'DataMapper::Resource' do
4
4
  before :all do
5
5
  DataMapper::Validate::Fixtures::Barcode.auto_migrate!
6
6
 
@@ -34,10 +34,9 @@ describe DataMapper::Resource do
34
34
 
35
35
  describe 'when provided invalid attributes and a context' do
36
36
  before :all do
37
- # remove data from previous spec runs
38
- ::DataMapper::Validate::Fixtures::Organisation.all.destroy!
39
- ::DataMapper::Validate::Fixtures::Department.all.destroy!
40
- ::DataMapper::Validate::Fixtures::User.all.destroy!
37
+ DataMapper::Validate::Fixtures::Organisation.auto_migrate!
38
+ DataMapper::Validate::Fixtures::Department.auto_migrate!
39
+ DataMapper::Validate::Fixtures::User.auto_migrate!
41
40
 
42
41
  organization = DataMapper::Validate::Fixtures::Organisation.create(:name => 'Org 101', :domain => '101')
43
42
  dept = DataMapper::Validate::Fixtures::Department.create(:name => 'accounting')
@@ -51,7 +50,7 @@ describe DataMapper::Resource do
51
50
  # create a record that will be a dupe when User#update is executed below
52
51
  DataMapper::Validate::Fixtures::User.create(attributes).should be_saved
53
52
 
54
- @resource = DataMapper::Validate::Fixtures::User.new
53
+ @resource = DataMapper::Validate::Fixtures::User.create(attributes.merge(:user_name => 'other'))
55
54
 
56
55
  @response = @resource.update(attributes, :signing_up_for_department_account)
57
56
  end
@@ -0,0 +1,6 @@
1
+ --exclude "spec"
2
+ --sort coverage
3
+ --callsites
4
+ --xrefs
5
+ --profile
6
+ --text-summary
@@ -1,2 +1,4 @@
1
1
  --colour
2
2
  --loadby random
3
+ --format profile
4
+ --backtrace
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
  require 'unit/contextual_validators/spec_helper'
4
4
 
5
- describe DataMapper::Validate::ContextualValidators do
5
+ describe 'DataMapper::Validate::ContextualValidators' do
6
6
  before :all do
7
7
  @model = DataMapper::Validate::ContextualValidators.new
8
8
  end
@@ -2,30 +2,23 @@
2
2
  require 'spec_helper'
3
3
  require 'unit/contextual_validators/spec_helper'
4
4
 
5
- describe DataMapper::Validate::ContextualValidators do
5
+ describe 'DataMapper::Validate::ContextualValidators' do
6
6
  before :all do
7
7
  @model = DataMapper::Validate::ContextualValidators.new
8
8
  end
9
9
 
10
10
  describe "#execute(name, target)" do
11
- before :each do
11
+ before do
12
12
  @validator_one = DataMapper::Validate::RequiredFieldValidator.new(:name)
13
13
  @validator_two = DataMapper::Validate::WithinValidator.new(:operating_system, :set => ["Mac OS X", "Linux", "FreeBSD", "Solaris"])
14
14
 
15
15
  @model.context(:default) << @validator_one << @validator_two
16
16
  end
17
17
 
18
- describe "when context was never referred to before" do
19
- it "raises ArgumentError" do
20
- lambda { @model.execute(:some_unknown_context, Object.new) }.
21
- should raise_error(ArgumentError, /validation context some_unknown_context doesn't seem to be defined/)
22
- end
23
- end
24
-
25
18
 
26
19
  describe "when target satisfies all validators" do
27
- before :each do
28
- @target = ::DataMapper::Validate::Fixtures::PieceOfSoftware.new(:name => 'gcc', :operating_system => "Mac OS X")
20
+ before do
21
+ @target = DataMapper::Validate::Fixtures::PieceOfSoftware.new(:name => 'gcc', :operating_system => "Mac OS X")
29
22
  @validator_one.call(@target).should be_true
30
23
  @validator_two.call(@target).should be_true
31
24
 
@@ -39,8 +32,8 @@ describe DataMapper::Validate::ContextualValidators do
39
32
 
40
33
 
41
34
  describe "when target does not satisfy all validators" do
42
- before :each do
43
- @target = ::DataMapper::Validate::Fixtures::PieceOfSoftware.new(:name => 'Skitch', :operating_system => "Haiku")
35
+ before do
36
+ @target = DataMapper::Validate::Fixtures::PieceOfSoftware.new(:name => 'Skitch', :operating_system => "Haiku")
44
37
  @validator_one.call(@target).should be_true
45
38
  @validator_two.call(@target).should be_false
46
39
 
@@ -50,6 +43,6 @@ describe DataMapper::Validate::ContextualValidators do
50
43
  it "returns true" do
51
44
  @result.should be_false
52
45
  end
53
- end # describe "when target does not satisfy all validators"
54
- end # describe "#execute(name, target)"
55
- end # describe DataMapper::Validate::ContextualValidators
46
+ end
47
+ end
48
+ end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe DataMapper::Validate::GenericValidator do
3
+ describe 'DataMapper::Validate::GenericValidator' do
4
4
  describe "when types and fields are equal" do
5
5
  it "returns true" do
6
6
  DataMapper::Validate::RequiredFieldValidator.new(:name).
7
7
  should == DataMapper::Validate::RequiredFieldValidator.new(:name)
8
8
  end
9
- end # describe "#==" do
9
+ end
10
10
 
11
11
 
12
12
  describe "when types differ" do
@@ -23,4 +23,4 @@ describe DataMapper::Validate::GenericValidator do
23
23
  should_not == DataMapper::Validate::RequiredFieldValidator.new(:last_name)
24
24
  end
25
25
  end
26
- end # describe DataMapper::Validate::GenericValidator
26
+ end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe DataMapper::Validate::ValidationErrors do
4
+ describe 'DataMapper::Validate::ValidationErrors' do
5
5
  before :all do
6
6
  @model = DataMapper::Validate::ValidationErrors.new(Object.new)
7
7
  end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe DataMapper::Validate::ValidationErrors do
4
+ describe 'DataMapper::Validate::ValidationErrors' do
5
5
  before :all do
6
6
  @model = DataMapper::Validate::ValidationErrors.new(Object.new)
7
7
  end
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe DataMapper::Validate::ValidationErrors do
4
+ describe 'DataMapper::Validate::ValidationErrors' do
5
5
  before :all do
6
6
  @model = DataMapper::Validate::ValidationErrors.new(Object.new)
7
7
  @model.add(:ip_address, "must have valid format")
@@ -0,0 +1 @@
1
+ task :ci => [ :verify_measurements, 'metrics:all' ]
@@ -0,0 +1,36 @@
1
+ begin
2
+ require 'metric_fu'
3
+ rescue LoadError
4
+ namespace :metrics do
5
+ task :all do
6
+ abort 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
7
+ end
8
+ end
9
+ end
10
+
11
+ begin
12
+ require 'reek/adapters/rake_task'
13
+
14
+ Reek::RakeTask.new do |t|
15
+ t.fail_on_error = true
16
+ t.verbose = false
17
+ t.source_files = 'lib/**/*.rb'
18
+ end
19
+ rescue LoadError
20
+ task :reek do
21
+ abort 'Reek is not available. In order to run reek, you must: gem install reek'
22
+ end
23
+ end
24
+
25
+ begin
26
+ require 'roodi'
27
+ require 'roodi_task'
28
+
29
+ RoodiTask.new do |t|
30
+ t.verbose = false
31
+ end
32
+ rescue LoadError
33
+ task :roodi do
34
+ abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
35
+ end
36
+ end
@@ -0,0 +1,41 @@
1
+ spec_defaults = lambda do |spec|
2
+ spec.pattern = 'spec/**/*_spec.rb'
3
+ spec.libs << 'lib' << 'spec'
4
+ spec.spec_opts << '--options' << 'spec/spec.opts'
5
+ end
6
+
7
+ begin
8
+ require 'spec/rake/spectask'
9
+
10
+ Spec::Rake::SpecTask.new(:spec, &spec_defaults)
11
+ rescue LoadError
12
+ task :spec do
13
+ abort 'rspec is not available. In order to run spec, you must: gem install rspec'
14
+ end
15
+ end
16
+
17
+ begin
18
+ require 'rcov'
19
+ require 'spec/rake/verify_rcov'
20
+
21
+ Spec::Rake::SpecTask.new(:rcov) do |rcov|
22
+ spec_defaults.call(rcov)
23
+ rcov.rcov = true
24
+ rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
25
+ end
26
+
27
+ RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov|
28
+ rcov.threshold = 100
29
+ end
30
+ rescue LoadError
31
+ %w[ rcov verify_rcov ].each do |name|
32
+ task name do
33
+ abort "rcov is not available. In order to run #{name}, you must: gem install rcov"
34
+ end
35
+ end
36
+ end
37
+
38
+ task :spec => :check_dependencies
39
+ task :rcov => :check_dependencies
40
+
41
+ task :default => :spec
@@ -0,0 +1,9 @@
1
+ begin
2
+ require 'yard'
3
+
4
+ YARD::Rake::YardocTask.new
5
+ rescue LoadError
6
+ task :yard do
7
+ abort 'YARD is not available. In order to run yard, you must: gem install yard'
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ begin
2
+ require 'pathname'
3
+ require 'yardstick/rake/measurement'
4
+ require 'yardstick/rake/verify'
5
+
6
+ # yardstick_measure task
7
+ Yardstick::Rake::Measurement.new
8
+
9
+ # verify_measurements task
10
+ Yardstick::Rake::Verify.new do |verify|
11
+ verify.threshold = 100
12
+ end
13
+ rescue LoadError
14
+ %w[ yardstick_measure verify_measurements ].each do |name|
15
+ task name.to_s do
16
+ abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
- - Guy van den Berg, DataMapper development team
7
+ - Guy van den Berg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-30 00:00:00 -07:00
12
+ date: 2009-12-11 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,29 +18,45 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - "="
21
+ - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.10.1
23
+ version: 0.10.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.9
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: yard
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.4.0
24
44
  version:
25
45
  description: Library for performing validations on DM models and pure Ruby object
26
- email:
27
- - vandenberg.guy [a] gmail [d] com
46
+ email: vandenberg.guy [a] gmail [d] com
28
47
  executables: []
29
48
 
30
49
  extensions: []
31
50
 
32
51
  extra_rdoc_files:
33
- - README.rdoc
34
52
  - LICENSE
35
- - TODO
36
- - History.rdoc
53
+ - README.rdoc
37
54
  files:
38
- - History.rdoc
39
55
  - LICENSE
40
- - Manifest.txt
41
56
  - README.rdoc
42
57
  - Rakefile
43
- - TODO
58
+ - VERSION
59
+ - dm-validations.gemspec
44
60
  - lib/dm-validations.rb
45
61
  - lib/dm-validations/auto_validate.rb
46
62
  - lib/dm-validations/contextual_validators.rb
@@ -63,7 +79,6 @@ files:
63
79
  - lib/dm-validations/validators/required_field_validator.rb
64
80
  - lib/dm-validations/validators/uniqueness_validator.rb
65
81
  - lib/dm-validations/validators/within_validator.rb
66
- - lib/dm-validations/version.rb
67
82
  - spec/fixtures/barcode.rb
68
83
  - spec/fixtures/basketball_court.rb
69
84
  - spec/fixtures/basketball_player.rb
@@ -163,6 +178,7 @@ files:
163
178
  - spec/integration/within_validator/spec_helper.rb
164
179
  - spec/integration/within_validator/within_validator_spec.rb
165
180
  - spec/public/resource_spec.rb
181
+ - spec/rcov.opts
166
182
  - spec/spec.opts
167
183
  - spec/spec_helper.rb
168
184
  - spec/unit/contextual_validators/emptiness_spec.rb
@@ -172,16 +188,18 @@ files:
172
188
  - spec/unit/validation_errors/adding_spec.rb
173
189
  - spec/unit/validation_errors/emptiness_spec.rb
174
190
  - spec/unit/validation_errors/enumerable_spec.rb
175
- - tasks/install.rb
176
- - tasks/spec.rb
191
+ - tasks/ci.rake
192
+ - tasks/metrics.rake
193
+ - tasks/spec.rake
194
+ - tasks/yard.rake
195
+ - tasks/yardstick.rake
177
196
  has_rdoc: true
178
197
  homepage: http://github.com/datamapper/dm-more/tree/master/dm-validations
179
198
  licenses: []
180
199
 
181
200
  post_install_message:
182
201
  rdoc_options:
183
- - --main
184
- - README.rdoc
202
+ - --charset=UTF-8
185
203
  require_paths:
186
204
  - lib
187
205
  required_ruby_version: !ruby/object:Gem::Requirement