virtus 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Changelog.md +9 -0
- data/Gemfile +2 -22
- data/Gemfile.devtools +44 -0
- data/README.md +78 -1
- data/Rakefile +3 -4
- data/config/flay.yml +2 -2
- data/config/mutant.yml +3 -0
- data/lib/virtus.rb +2 -1
- data/lib/virtus/attribute.rb +1 -1
- data/lib/virtus/attribute/array.rb +1 -0
- data/lib/virtus/attribute/class.rb +1 -1
- data/lib/virtus/attribute/hash.rb +84 -0
- data/lib/virtus/attribute/set.rb +1 -0
- data/lib/virtus/coercion/string.rb +6 -2
- data/lib/virtus/instance_methods.rb +8 -1
- data/lib/virtus/version.rb +1 -1
- data/spec/integration/default_values_spec.rb +22 -2
- data/spec/integration/hash_attributes_coercion_spec.rb +50 -0
- data/spec/shared/freeze_method_behavior.rb +1 -1
- data/spec/spec_helper.rb +6 -14
- data/spec/unit/virtus/attribute/hash/class_methods/merge_options_spec.rb +33 -0
- data/spec/unit/virtus/attribute/hash/coerce_spec.rb +20 -0
- data/spec/unit/virtus/attribute/hash/key_type_spec.rb +10 -0
- data/spec/unit/virtus/attribute/hash/value_type_spec.rb +10 -0
- data/spec/unit/virtus/coercion/string/class_methods/to_float_spec.rb +12 -0
- data/spec/unit/virtus/coercion/string/class_methods/to_integer_spec.rb +12 -0
- data/spec/unit/virtus/extensions/attribute_spec.rb +26 -0
- data/spec/unit/virtus/instance_methods/attributes_spec.rb +3 -1
- data/spec/unit/virtus/instance_methods/initialize_spec.rb +11 -5
- data/spec/unit/virtus/options/accept_options_spec.rb +1 -1
- data/spec/unit/virtus/options/accepted_options_spec.rb +1 -1
- data/spec/unit/virtus/options/options_spec.rb +1 -1
- data/spec/unit/virtus/type_lookup/determine_type_spec.rb +1 -1
- data/virtus.gemspec +4 -4
- metadata +76 -100
- data/lib/virtus/support/descendants_tracker.rb +0 -44
- data/spec/rcov.opts +0 -7
- data/spec/unit/virtus/attribute/object/class_methods/descendants_spec.rb +0 -22
- data/spec/unit/virtus/descendants_tracker/add_descendant_spec.rb +0 -24
- data/spec/unit/virtus/descendants_tracker/descendants_spec.rb +0 -22
- data/tasks/metrics/ci.rake +0 -7
- data/tasks/metrics/flay.rake +0 -41
- data/tasks/metrics/flog.rake +0 -43
- data/tasks/metrics/heckle.rake +0 -208
- data/tasks/metrics/metric_fu.rake +0 -29
- data/tasks/metrics/reek.rake +0 -9
- data/tasks/metrics/roodi.rake +0 -15
- data/tasks/metrics/yardstick.rake +0 -23
- data/tasks/spec.rake +0 -45
- data/tasks/yard.rake +0 -9
data/tasks/metrics/reek.rake
DELETED
data/tasks/metrics/roodi.rake
DELETED
@@ -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
|
data/tasks/spec.rake
DELETED
@@ -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'
|