ramda-ruby 0.1.0.alpha → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +23 -8
- data/docs/FUNCTIONS.md +2 -0
- data/lib/ramda.rb +2 -0
- data/lib/ramda/object.rb +23 -4
- data/lib/ramda/version.rb +1 -1
- data/spec/ramda/function_spec.rb +200 -0
- data/spec/ramda/internal/curried_method_spec.rb +16 -0
- data/spec/ramda/list_spec.rb +399 -0
- data/spec/ramda/logic_spec.rb +74 -0
- data/spec/ramda/math_spec.rb +75 -0
- data/spec/ramda/object_spec.rb +117 -0
- data/spec/ramda/relation_spec.rb +174 -0
- data/spec/ramda/string_spec.rb +44 -0
- data/spec/ramda_spec.rb +105 -0
- data/spec/spec_helper.rb +18 -0
- metadata +34 -29
- data/.bashrc.docker +0 -2
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -14
- data/.overcommit.yml +0 -73
- data/.pryrc.docker +0 -1
- data/.rspec +0 -2
- data/.rubocop.yml +0 -42
- data/.travis.yml +0 -35
- data/Dockerfile +0 -24
- data/Gemfile +0 -23
- data/Gemfile.dev +0 -6
- data/Gemfile.dev.lock +0 -38
- data/Rakefile +0 -6
- data/appveyor.yml +0 -26
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/codeclimate.yml +0 -6
- data/docker-compose.override.yml +0 -12
- data/docker-compose.yml +0 -15
- data/ramda-ruby.gemspec +0 -24
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ramda::Logic do
|
4
|
+
let(:r) { described_class }
|
5
|
+
|
6
|
+
it '#all_pass' do
|
7
|
+
is_queen = R.prop_eq(:rank, 'Queen')
|
8
|
+
is_spade = R.prop_eq(:suit, 'Spade')
|
9
|
+
|
10
|
+
is_queen_of_spades = r.all_pass([is_queen, is_spade])
|
11
|
+
|
12
|
+
expect(is_queen_of_spades.call(rank: 'King', suit: 'Spade')).to be_falsey
|
13
|
+
expect(is_queen_of_spades.call(rank: 'Queen', suit: 'Spade')).to be_truthy
|
14
|
+
end
|
15
|
+
|
16
|
+
it '#and' do
|
17
|
+
expect(r.and(true, true)).to be_truthy
|
18
|
+
expect(r.and(true, false)).to be_falsey
|
19
|
+
expect(r.and(false, true)).to be_falsey
|
20
|
+
expect(r.and(false, false)).to be_falsey
|
21
|
+
end
|
22
|
+
|
23
|
+
it '#any_pass' do
|
24
|
+
is_club = R.prop_eq(:suit, 'club')
|
25
|
+
is_spade = R.prop_eq(:suit, 'spade')
|
26
|
+
is_black_card = r.any_pass([is_club, is_spade])
|
27
|
+
|
28
|
+
expect(is_black_card.call(rank: '10', suit: 'club')).to be_truthy
|
29
|
+
expect(is_black_card.call(rank: 'Q', suit: 'spade')).to be_truthy
|
30
|
+
expect(is_black_card.call(rank: 'Q', suit: 'diamond')).to be_falsey
|
31
|
+
end
|
32
|
+
|
33
|
+
context '#if_else' do
|
34
|
+
it 'from docs' do
|
35
|
+
inc_count = R.if_else(
|
36
|
+
Ramda.prop(:count),
|
37
|
+
Ramda.prop(:count),
|
38
|
+
Ramda.identity
|
39
|
+
)
|
40
|
+
expect(inc_count.call({})).to eq({})
|
41
|
+
expect(inc_count.call(count: 1)).to eq(1)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context '#is_empty' do
|
46
|
+
it 'from docs' do
|
47
|
+
expect(r.is_empty([1, 2, 3])).to be_falsey
|
48
|
+
expect(r.is_empty([])).to be_truthy
|
49
|
+
expect(r.is_empty('')).to be_truthy
|
50
|
+
expect(r.is_empty(nil)).to be_falsey
|
51
|
+
expect(r.is_empty({})).to be_truthy
|
52
|
+
expect(r.is_empty(0)).to be_falsey
|
53
|
+
expect(r.is_empty(length: 0)).to be_falsey
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context '#not' do
|
58
|
+
it 'from docs' do
|
59
|
+
expect(r.not(true)).to be_falsey
|
60
|
+
expect(r.not(false)).to be_truthy
|
61
|
+
expect(r.not(0)).to be_falsey
|
62
|
+
expect(r.not(1)).to be_falsey
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context '#or' do
|
67
|
+
it 'from docs' do
|
68
|
+
expect(r.or(true, true)).to be_truthy
|
69
|
+
expect(r.or(true, false)).to be_truthy
|
70
|
+
expect(r.or(false, true)).to be_truthy
|
71
|
+
expect(r.or(false, false)).to be_falsey
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ramda::Math do
|
4
|
+
let(:r) { described_class }
|
5
|
+
|
6
|
+
context '#add' do
|
7
|
+
it 'from docs' do
|
8
|
+
expect(r.add(2, 3)).to be(5)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'is curried' do
|
12
|
+
expect(r.add(2).call(3)).to be(5)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context '#dec' do
|
17
|
+
it 'from docs' do
|
18
|
+
expect(r.dec(42)).to eq(41)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context '#divide' do
|
23
|
+
it 'from docs' do
|
24
|
+
expect(r.divide(71, 100)).to eq(0.71)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'is curried' do
|
28
|
+
expect(r.divide(1).call(4)).to eq(0.25)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context '#inc' do
|
33
|
+
it 'from docs' do
|
34
|
+
expect(r.inc(42)).to eq(43)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context '#multipy' do
|
39
|
+
it 'from docs' do
|
40
|
+
triple = r.multiply(3)
|
41
|
+
|
42
|
+
expect(triple.call(4)).to be(12)
|
43
|
+
expect(r.multiply(2, 5)).to be(10)
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#curried' do
|
47
|
+
expect(r.multiply(2).call(5)).to eq(10)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context '#product' do
|
52
|
+
it 'from docs' do
|
53
|
+
expect(r.product([2, 4, 6, 8, 100, 1])).to be(38_400)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context '#subsctrcat' do
|
58
|
+
it 'from docs' do
|
59
|
+
expect(r.subtract(10, 8)).to be(2)
|
60
|
+
|
61
|
+
minus5 = r.subtract(17)
|
62
|
+
expect(minus5.call(5)).to be(12)
|
63
|
+
|
64
|
+
complementary_angel = r.subtract(90)
|
65
|
+
expect(complementary_angel.call(30)).to be(60)
|
66
|
+
expect(complementary_angel.call(72)).to be(18)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context '#sum' do
|
71
|
+
it 'from docs' do
|
72
|
+
expect(r.sum([2, 4, 6, 8, 100, 1])).to be(121)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ramda::Object do
|
4
|
+
let(:r) { described_class }
|
5
|
+
|
6
|
+
context '#assoc' do
|
7
|
+
it 'from docs' do
|
8
|
+
expect(r.assoc(:c, 3, a: 1, b: 2)).to eq(a: 1, b: 2, c: 3)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context '#clone' do
|
13
|
+
it 'from docs' do
|
14
|
+
objects = [{}, {}, {}]
|
15
|
+
objects_clone = r.clone(objects)
|
16
|
+
expect(objects).not_to be(objects_clone)
|
17
|
+
expect(objects[0]).not_to be(objects_clone[0])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context '#dissoc' do
|
22
|
+
it 'from docs' do
|
23
|
+
expect(r.dissoc(:b, a: 1, b: 2, c: 3)).to eq(a: 1, c: 3)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context '#eq_props' do
|
28
|
+
it 'from docs' do
|
29
|
+
o1 = { a: 1, b: 2, c: 3, d: 4 }
|
30
|
+
o2 = { a: 10, b: 20, c: 3, d: 40 }
|
31
|
+
|
32
|
+
expect(r.eq_props(:a, o1, o2)).to be_falsey
|
33
|
+
expect(r.eq_props(:c, o1, o2)).to be_truthy
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'curried' do
|
37
|
+
o1 = { a: 1, b: 2, c: 3, d: 4 }
|
38
|
+
o2 = { a: 10, b: 20, c: 3, d: 40 }
|
39
|
+
|
40
|
+
expect(r.eq_props(:c).call(o1, o2)).to be_truthy
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#keys' do
|
45
|
+
it 'from docs' do
|
46
|
+
expect(r.keys(a: 1, b: 2, c: 3)).to eq([:a, :b, :c])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context '#merge' do
|
51
|
+
it 'from docs' do
|
52
|
+
expect(r.merge({ name: 'fred', age: 10 }, age: 40))
|
53
|
+
.to eq(name: 'fred', age: 40)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'is curried' do
|
57
|
+
expect(r.merge(a: 1).call(b: 2)).to eq(a: 1, b: 2)
|
58
|
+
# var resetToDefault = R.merge(R.__, {x: 0});
|
59
|
+
# resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context '#omit' do
|
64
|
+
it 'from docs' do
|
65
|
+
expect(r.omit([:a, :d], a: 1, b: 2, c: 3, d: 4)).to eq(b: 2, c: 3)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context '#pick' do
|
70
|
+
it 'from docs' do
|
71
|
+
expect(r.pick([:a, :d], a: 1, b: 2, c: 3, d: 4)).to eq(a: 1, d: 4)
|
72
|
+
expect(r.pick([:a, :e, :f], a: 1, b: 2, c: 3, d: 4)).to eq(a: 1)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context '#pick_all' do
|
77
|
+
it 'from docs' do
|
78
|
+
expect(r.pick_all([:a, :d], a: 1, b: 2, c: 3, d: 4)).to eq(a: 1, d: 4)
|
79
|
+
expect(r.pick_all([:a, :e, :f], a: 1, b: 2, c: 3, d: 4)).to eq(a: 1, e: nil, f: nil)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context '#project' do
|
84
|
+
it 'from docs' do
|
85
|
+
abby = { name: 'Abby', age: 7, hair: 'blond', grade: 2 }
|
86
|
+
fred = { name: 'Fred', age: 12, hair: 'brown', grade: 7 }
|
87
|
+
kids = [abby, fred]
|
88
|
+
|
89
|
+
expect(r.project([:name, :grade], kids))
|
90
|
+
.to eq([{ name: 'Abby', grade: 2 }, { name: 'Fred', grade: 7 }])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context '#prop' do
|
95
|
+
it 'from docs' do
|
96
|
+
expect(r.prop(:x, x: 100)).to be(100)
|
97
|
+
expect(r.prop(:x, {})).to be_nil
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context '#props' do
|
102
|
+
it 'from docs' do
|
103
|
+
expect(r.props([:x, :y], x: 1, y: 2)).to eq([1, 2])
|
104
|
+
expect(r.props([:c, :a, :b], b: 2, a: 1)).to eq([nil, 1, 2])
|
105
|
+
|
106
|
+
full_name = R.compose(R.join(' '), r.props([:first, :last]))
|
107
|
+
expect(full_name.call(last: 'Bullet-Tooth', age: 33, first: 'Tony'))
|
108
|
+
.to eq('Tony Bullet-Tooth')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context '#values' do
|
113
|
+
it 'from docs' do
|
114
|
+
expect(r.values(a: 1, b: 2, c: 3)).to eq([1, 2, 3])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ramda::Relation do
|
4
|
+
let(:r) { described_class }
|
5
|
+
|
6
|
+
context '#equals' do
|
7
|
+
it 'from docs' do
|
8
|
+
expect(r.equals(1, 1)).to be_truthy
|
9
|
+
expect(r.equals(1, '1')).to be_falsey
|
10
|
+
expect(r.equals([1, 2, 3], [1, 2, 3])).to be_truthy
|
11
|
+
expect(r.equals({}, {})).to be_truthy
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'is curried' do
|
15
|
+
expect(r.equals(1).call(1)).to be_truthy
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context '#count_by' do
|
20
|
+
it 'from docs' do
|
21
|
+
letters = ['a', 'b', 'A', 'a', 'B', 'c']
|
22
|
+
expect(r.count_by(R.to_lower).call(letters)).to eq('a' => 3, 'b' => 2, 'c' => 1)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context '#difference' do
|
27
|
+
it 'from docs' do
|
28
|
+
expect(r.difference([1, 2, 3, 4], [7, 6, 5, 4, 3])).to eq([1, 2])
|
29
|
+
expect(r.difference([7, 6, 5, 4, 3], [1, 2, 3, 4])).to eq([7, 6, 5])
|
30
|
+
expect(r.difference([{ a: 1 }, { b: 2 }], [{ a: 1 }, { c: 3 }])).to eq([{ b: 2 }])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context '#difference_with' do
|
35
|
+
it 'from docs' do
|
36
|
+
cmp = ->(x, y) { x.fetch(:a) == y.fetch(:a) }
|
37
|
+
l1 = [{ a: 1, b: 1 }, { a: 2, b: 1 }, { a: 3, b: 1 }]
|
38
|
+
l2 = [{ a: 3, b: 2 }, { a: 4, b: 2 }, { a: 5, b: 2 }]
|
39
|
+
|
40
|
+
expect(r.difference_with(cmp, l1, l2)).to eq([{ a: 1, b: 1 }, { a: 2, b: 1 }])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#eq_by' do
|
45
|
+
it 'from docs' do
|
46
|
+
size_fn = ->(x) { x.size }
|
47
|
+
expect(r.eq_by(size_fn, ['abc'], [100])).to be_truthy
|
48
|
+
expect(r.eq_by(size_fn, [1, 2], [1])).to be_falsey
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context '#gt' do
|
53
|
+
it 'from docs' do
|
54
|
+
expect(r.gt(2, 1)).to be_truthy
|
55
|
+
expect(r.gt(2, 2)).to be_falsey
|
56
|
+
expect(r.gt(2, 3)).to be_falsey
|
57
|
+
expect(r.gt('a', 'z')).to be_falsey
|
58
|
+
expect(r.gt('z', 'a')).to be_truthy
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'is curried' do
|
62
|
+
expect(r.gt(2).call(1)).to be_truthy
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context '#gte' do
|
67
|
+
it 'from docs' do
|
68
|
+
expect(r.gte(2, 1)).to be_truthy
|
69
|
+
expect(r.gte(2, 2)).to be_truthy
|
70
|
+
expect(r.gte(2, 3)).to be_falsey
|
71
|
+
expect(r.gte('a', 'z')).to be_falsey
|
72
|
+
expect(r.gte('z', 'a')).to be_truthy
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'is curried' do
|
76
|
+
expect(r.gte(2).call(1)).to be_truthy
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context '#intersection' do
|
81
|
+
it 'from docs' do
|
82
|
+
expect(r.intersection([1, 2, 3, 4], [7, 6, 5, 4, 3])).to eq([3, 4])
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'is curried' do
|
86
|
+
expect(r.intersection([1, 2, 3, 4]).call([7, 6, 5, 4, 3])).to match_array([3, 4])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context '#lt' do
|
91
|
+
it 'from docs' do
|
92
|
+
expect(r.lt(2, 1)).to be_falsey
|
93
|
+
expect(r.lt(2, 2)).to be_falsey
|
94
|
+
expect(r.lt(2, 3)).to be_truthy
|
95
|
+
expect(r.lt('a', 'z')).to be_truthy
|
96
|
+
expect(r.lt('z', 'a')).to be_falsey
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'is curried' do
|
100
|
+
expect(r.lt(2).call(1)).to be_falsey
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context '#lte' do
|
105
|
+
it 'from docs' do
|
106
|
+
expect(r.lte(2, 1)).to be_falsey
|
107
|
+
expect(r.lte(2, 2)).to be_truthy
|
108
|
+
expect(r.lte(2, 3)).to be_truthy
|
109
|
+
expect(r.lte('a', 'z')).to be_truthy
|
110
|
+
expect(r.lte('z', 'a')).to be_falsey
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'is curried' do
|
114
|
+
expect(r.lt(2).call(1)).to be_falsey
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context '#max' do
|
119
|
+
it 'from docs' do
|
120
|
+
expect(r.max(789, 123)).to be(789)
|
121
|
+
expect(r.max('a', 'b')).to eq('b')
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context '#min' do
|
126
|
+
it 'from docs' do
|
127
|
+
expect(r.min(789, 123)).to be(123)
|
128
|
+
expect(r.min('a', 'b')).to eq('a')
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context '#prop_eq' do
|
133
|
+
it 'from docs' do
|
134
|
+
abby = { name: 'Abby', age: 7, hair: 'blond' }
|
135
|
+
fred = { name: 'Fred', age: 12, hair: 'brown' }
|
136
|
+
rusty = { name: 'Rusty', age: 10, hair: 'brown' }
|
137
|
+
alois = { name: 'Alois', age: 15, disposition: 'surly' }
|
138
|
+
kids = [abby, fred, rusty, alois]
|
139
|
+
has_brown_hair = r.prop_eq(:hair, 'brown')
|
140
|
+
expect(R.filter(has_brown_hair, kids)).to eq([fred, rusty])
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context '#sort_by' do
|
145
|
+
it 'from docs 1' do
|
146
|
+
sort_by_first_item = r.sort_by(R.prop(0))
|
147
|
+
pairs = [[-1, 1], [-2, 2], [-3, 3]]
|
148
|
+
expect(sort_by_first_item.call(pairs)).to eq([[-3, 3], [-2, 2], [-1, 1]])
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'from docs 2' do
|
152
|
+
alice = { name: 'ALICE', age: 101 }
|
153
|
+
bob = { name: 'Bob', age: -10 }
|
154
|
+
clara = { name: 'clara', age: 314.159 }
|
155
|
+
people = [clara, bob, alice]
|
156
|
+
sort_by_name_case_insensitive = r.sort_by(R.compose(R.to_lower, R.prop(:name)))
|
157
|
+
expect(sort_by_name_case_insensitive.call(people)).to eq([alice, bob, clara])
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context '#union' do
|
162
|
+
it 'from docs' do
|
163
|
+
expect(r.union([1, 2, 3], [2, 3, 4])).to eq([1, 2, 3, 4])
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
context '#union_with' do
|
168
|
+
it 'from docs' do
|
169
|
+
l1 = [{ a: 1 }, { a: 2 }]
|
170
|
+
l2 = [{ a: 1 }, { a: 4 }]
|
171
|
+
expect(r.union_with(R.prop(:a), l1, l2)).to eq([{ a: 1 }, { a: 2 }, { a: 4 }])
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ramda::String do
|
4
|
+
let(:r) { described_class }
|
5
|
+
|
6
|
+
context '#match' do
|
7
|
+
it 'from docs' do
|
8
|
+
expect(r.match(/([a-z]a)/, 'bananas')).to eq('ba')
|
9
|
+
expect(r.match(/a/, 'b')).to eq(nil)
|
10
|
+
expect { r.match(/a/, nil) }.to raise_error(ArgumentError)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context '#split' do
|
15
|
+
it 'from docs' do
|
16
|
+
path_components = r.split('/')
|
17
|
+
|
18
|
+
expect(R.tail(path_components.call('/usr/local/bin/node')))
|
19
|
+
.to eq(['usr', 'local', 'bin', 'node'])
|
20
|
+
|
21
|
+
expect(r.split('.', 'a.b.c.xyz.d')).to eq(['a', 'b', 'c', 'xyz', 'd'])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context '#to_upper' do
|
26
|
+
it 'from docs' do
|
27
|
+
expect(r.to_upper('abc')).to eq('ABC')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'curried' do
|
31
|
+
expect(r.to_upper.call('abc')).to eq('ABC')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context '#to_lower' do
|
36
|
+
it 'from docs' do
|
37
|
+
expect(r.to_lower('XYZ')).to eq('xyz')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'curried' do
|
41
|
+
expect(r.to_lower.call('XYZ')).to eq('xyz')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|