virtus 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.rspec +2 -0
  2. data/.travis.yml +3 -0
  3. data/Changelog.md +9 -0
  4. data/Gemfile +2 -22
  5. data/Gemfile.devtools +44 -0
  6. data/README.md +78 -1
  7. data/Rakefile +3 -4
  8. data/config/flay.yml +2 -2
  9. data/config/mutant.yml +3 -0
  10. data/lib/virtus.rb +2 -1
  11. data/lib/virtus/attribute.rb +1 -1
  12. data/lib/virtus/attribute/array.rb +1 -0
  13. data/lib/virtus/attribute/class.rb +1 -1
  14. data/lib/virtus/attribute/hash.rb +84 -0
  15. data/lib/virtus/attribute/set.rb +1 -0
  16. data/lib/virtus/coercion/string.rb +6 -2
  17. data/lib/virtus/instance_methods.rb +8 -1
  18. data/lib/virtus/version.rb +1 -1
  19. data/spec/integration/default_values_spec.rb +22 -2
  20. data/spec/integration/hash_attributes_coercion_spec.rb +50 -0
  21. data/spec/shared/freeze_method_behavior.rb +1 -1
  22. data/spec/spec_helper.rb +6 -14
  23. data/spec/unit/virtus/attribute/hash/class_methods/merge_options_spec.rb +33 -0
  24. data/spec/unit/virtus/attribute/hash/coerce_spec.rb +20 -0
  25. data/spec/unit/virtus/attribute/hash/key_type_spec.rb +10 -0
  26. data/spec/unit/virtus/attribute/hash/value_type_spec.rb +10 -0
  27. data/spec/unit/virtus/coercion/string/class_methods/to_float_spec.rb +12 -0
  28. data/spec/unit/virtus/coercion/string/class_methods/to_integer_spec.rb +12 -0
  29. data/spec/unit/virtus/extensions/attribute_spec.rb +26 -0
  30. data/spec/unit/virtus/instance_methods/attributes_spec.rb +3 -1
  31. data/spec/unit/virtus/instance_methods/initialize_spec.rb +11 -5
  32. data/spec/unit/virtus/options/accept_options_spec.rb +1 -1
  33. data/spec/unit/virtus/options/accepted_options_spec.rb +1 -1
  34. data/spec/unit/virtus/options/options_spec.rb +1 -1
  35. data/spec/unit/virtus/type_lookup/determine_type_spec.rb +1 -1
  36. data/virtus.gemspec +4 -4
  37. metadata +76 -100
  38. data/lib/virtus/support/descendants_tracker.rb +0 -44
  39. data/spec/rcov.opts +0 -7
  40. data/spec/unit/virtus/attribute/object/class_methods/descendants_spec.rb +0 -22
  41. data/spec/unit/virtus/descendants_tracker/add_descendant_spec.rb +0 -24
  42. data/spec/unit/virtus/descendants_tracker/descendants_spec.rb +0 -22
  43. data/tasks/metrics/ci.rake +0 -7
  44. data/tasks/metrics/flay.rake +0 -41
  45. data/tasks/metrics/flog.rake +0 -43
  46. data/tasks/metrics/heckle.rake +0 -208
  47. data/tasks/metrics/metric_fu.rake +0 -29
  48. data/tasks/metrics/reek.rake +0 -9
  49. data/tasks/metrics/roodi.rake +0 -15
  50. data/tasks/metrics/yardstick.rake +0 -23
  51. data/tasks/spec.rake +0 -45
  52. data/tasks/yard.rake +0 -9
@@ -1,9 +0,0 @@
1
- begin
2
- require 'reek/rake/task'
3
-
4
- Reek::Rake::Task.new
5
- rescue LoadError
6
- task :reek do
7
- abort "Reek is not available. In order to run reek, you must: gem install reek"
8
- end
9
- end
@@ -1,15 +0,0 @@
1
- begin
2
- require 'roodi'
3
- require 'rake/tasklib'
4
- require 'roodi_task'
5
-
6
- RoodiTask.new do |t|
7
- t.verbose = false
8
- t.config = File.expand_path('../../../config/roodi.yml', __FILE__)
9
- t.patterns = %w[ lib/**/*.rb ]
10
- end
11
- rescue LoadError
12
- task :roodi do
13
- abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
14
- end
15
- end
@@ -1,23 +0,0 @@
1
- begin
2
- require 'pathname'
3
- require 'yardstick'
4
- require 'yardstick/rake/measurement'
5
- require 'yardstick/rake/verify'
6
- require 'yaml'
7
-
8
- config = YAML.load_file(File.expand_path('../../../config/yardstick.yml', __FILE__))
9
-
10
- # yardstick_measure task
11
- Yardstick::Rake::Measurement.new
12
-
13
- # verify_measurements task
14
- Yardstick::Rake::Verify.new do |verify|
15
- verify.threshold = config.fetch('threshold')
16
- end
17
- rescue LoadError
18
- %w[ yardstick_measure verify_measurements ].each do |name|
19
- task name.to_s do
20
- abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
21
- end
22
- end
23
- end
@@ -1,45 +0,0 @@
1
- begin
2
-
3
- begin
4
- require 'rspec/core/rake_task'
5
- rescue LoadError
6
- require 'spec/rake/spectask'
7
-
8
- module RSpec
9
- module Core
10
- RakeTask = Spec::Rake::SpecTask
11
- end
12
- end
13
- end
14
-
15
- desc 'run all specs'
16
- task :spec => %w[ spec:unit spec:integration ]
17
-
18
- namespace :spec do
19
- RSpec::Core::RakeTask.new(:integration) do |t|
20
- t.pattern = 'spec/integration/**/*_spec.rb'
21
- end
22
-
23
- RSpec::Core::RakeTask.new(:unit) do |t|
24
- t.pattern = 'spec/unit/**/*_spec.rb'
25
- end
26
- end
27
- rescue LoadError
28
- task :spec do
29
- abort 'rspec is not available. In order to run spec, you must: gem install rspec'
30
- end
31
- end
32
-
33
- begin
34
- desc "Generate code coverage"
35
- RSpec::Core::RakeTask.new(:rcov) do |t|
36
- t.rcov = true
37
- t.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
38
- end
39
- rescue LoadError
40
- task :rcov do
41
- abort 'rcov is not available. In order to run rcov, you must: gem install rcov'
42
- end
43
- end
44
-
45
- task :test => 'spec'
@@ -1,9 +0,0 @@
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