darthjee-core_ext 1.7.3 → 1.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +19 -8
- data/.gitignore +1 -0
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +7 -3
- data/Dockerfile +9 -0
- data/README.md +5 -6
- data/Rakefile +2 -0
- data/config/yardstick.rb +13 -0
- data/config/yardstick.yml +35 -0
- data/core_ext.gemspec +9 -7
- data/docker-compose.yml +3 -6
- data/lib/darthjee/core_ext/array.rb +2 -2
- data/lib/darthjee/core_ext/class.rb +90 -4
- data/lib/darthjee/core_ext/enumerable.rb +5 -1
- data/lib/darthjee/core_ext/hash.rb +30 -0
- data/lib/darthjee/core_ext/hash/cameliazable.rb +91 -0
- data/lib/darthjee/core_ext/hash/chain_fetcher.rb +10 -0
- data/lib/darthjee/core_ext/hash/key_changeable.rb +85 -53
- data/lib/darthjee/core_ext/hash/key_changer.rb +41 -31
- data/lib/darthjee/core_ext/hash/value_changer.rb +128 -11
- data/lib/darthjee/core_ext/version.rb +1 -1
- data/spec/integration/yard/{array → darthjee/core_ext/array}/hash_builder_spec.rb +3 -3
- data/spec/integration/yard/{array_spec.rb → darthjee/core_ext/array_spec.rb} +0 -0
- data/spec/integration/yard/darthjee/core_ext/class/default_value_spec.rb +143 -0
- data/spec/integration/yard/{date → darthjee/core_ext/date}/days_between_spec.rb +6 -6
- data/spec/integration/yard/{enumerable_spec.rb → darthjee/core_ext/enumerable_spec.rb} +0 -0
- data/spec/integration/yard/darthjee/core_ext/hash/cameliazable_spec.rb +34 -0
- data/spec/integration/yard/darthjee/core_ext/hash/chain_fetcher_spec.rb +51 -0
- data/spec/integration/yard/darthjee/core_ext/hash/key_changeable_spec.rb +48 -0
- data/spec/integration/yard/{hash → darthjee/core_ext/hash}/transformable_spec.rb +7 -3
- data/spec/integration/yard/darthjee/core_ext/hash/value_changer_spec.rb +66 -0
- data/spec/integration/yard/darthjee/core_ext/hash_spec.rb +42 -0
- data/spec/lib/array_spec.rb +27 -17
- data/spec/lib/class_spec.rb +108 -7
- data/spec/lib/darthjee/core_ext/hash/deep_hash_constructor_spec.rb +1 -1
- data/spec/lib/darthjee/core_ext/hash/key_changer_spec.rb +8 -8
- data/spec/lib/darthjee/core_ext/hash/keys_sorter_spec.rb +1 -0
- data/spec/lib/darthjee/core_ext/hash/to_hash_mapper_spec.rb +1 -0
- data/spec/lib/darthjee/core_ext/hash/value_changer_spec.rb +246 -0
- data/spec/lib/date_spec.rb +5 -4
- data/spec/lib/hash_spec.rb +45 -32
- data/spec/lib/math_spec.rb +1 -0
- data/spec/lib/numeric_spec.rb +39 -17
- data/spec/lib/object_spec.rb +7 -7
- data/spec/lib/symbol_spec.rb +2 -2
- data/spec/lib/time_spec.rb +5 -4
- data/spec/support/models/default_reader_model.rb +8 -0
- data/spec/support/models/default_value_model.rb +2 -0
- data/spec/support/models/dummy_iterator.rb +15 -0
- data/spec/support/models/dummy_transformer.rb +15 -0
- data/spec/support/shared_examples/array/array_random.rb +2 -1
- data/spec/support/shared_examples/clean.rb +20 -20
- data/spec/support/shared_examples/date.rb +18 -13
- data/spec/support/shared_examples/hash/chain_fetch.rb +4 -3
- data/spec/support/shared_examples/hash/chain_hash_keys_changer.rb +14 -7
- data/spec/support/shared_examples/hash/hash_keys_changer.rb +10 -4
- data/spec/support/shared_examples/hash/hash_transpose.rb +1 -1
- data/spec/support/shared_examples/hash/keys_appender.rb +14 -4
- data/spec/support/shared_examples/hash/keys_camelizer.rb +7 -7
- data/spec/support/shared_examples/hash/keys_sorter.rb +3 -3
- data/spec/support/shared_examples/hash/keys_underscorer.rb +2 -2
- data/spec/support/shared_examples/hash/map_to_hash.rb +14 -12
- data/spec/support/shared_examples/hash/remap.rb +4 -4
- data/spec/support/shared_examples/hash/value_changer.rb +40 -33
- metadata +70 -20
- data/spec/integration/yard/class/default_value_spec.rb +0 -58
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: false
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Class do
|
6
|
-
describe 'yard' do
|
7
|
-
describe '#default_value' do
|
8
|
-
subject { klass.new }
|
9
|
-
|
10
|
-
let(:klass) do
|
11
|
-
Class.new do
|
12
|
-
default_value :name, 'John'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'when calling method' do
|
17
|
-
it 'returns the same value always' do
|
18
|
-
expect(subject.name).to eq('John')
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'returns the same instance accros instances of the class' do
|
22
|
-
expect(subject.name).not_to be_equal('John')
|
23
|
-
expect(subject.name).to be_equal(klass.new.name)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#default_values' do
|
29
|
-
subject { klass.new }
|
30
|
-
|
31
|
-
let(:klass) do
|
32
|
-
Class.new do
|
33
|
-
default_values :name, :nick_name, 'John'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'when calling method' do
|
38
|
-
it 'returns the same value always' do
|
39
|
-
expect(subject.name).to eq('John')
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'returns the same value always' do
|
43
|
-
expect(subject.nick_name).to eq('John')
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'returns the same instance accros instances of the class' do
|
47
|
-
expect(subject.name).not_to be_equal('John')
|
48
|
-
expect(subject.name).to be_equal(klass.new.name)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'returns the same instance for all methods' do
|
52
|
-
expect(subject.nick_name).not_to be_equal('John')
|
53
|
-
expect(subject.name).to be_equal(subject.nick_name)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|