fear 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +27 -0
  3. data/.github/workflows/rubocop.yml +39 -0
  4. data/.github/workflows/spec.yml +42 -0
  5. data/.rubocop.yml +4 -60
  6. data/.simplecov +17 -0
  7. data/CHANGELOG.md +29 -1
  8. data/Gemfile +5 -5
  9. data/Gemfile.lock +86 -50
  10. data/README.md +240 -209
  11. data/Rakefile +72 -65
  12. data/examples/pattern_extracting.rb +10 -8
  13. data/examples/pattern_matching_binary_tree_set.rb +7 -2
  14. data/examples/pattern_matching_number_in_words.rb +48 -42
  15. data/fear.gemspec +33 -34
  16. data/lib/dry/types/fear/option.rb +125 -0
  17. data/lib/dry/types/fear.rb +8 -0
  18. data/lib/fear/await.rb +33 -0
  19. data/lib/fear/awaitable.rb +28 -0
  20. data/lib/fear/either.rb +15 -4
  21. data/lib/fear/either_api.rb +4 -0
  22. data/lib/fear/either_pattern_match.rb +9 -5
  23. data/lib/fear/empty_partial_function.rb +3 -1
  24. data/lib/fear/failure.rb +7 -7
  25. data/lib/fear/failure_pattern_match.rb +4 -0
  26. data/lib/fear/for.rb +4 -2
  27. data/lib/fear/for_api.rb +5 -1
  28. data/lib/fear/future.rb +157 -82
  29. data/lib/fear/future_api.rb +17 -4
  30. data/lib/fear/left.rb +3 -9
  31. data/lib/fear/left_pattern_match.rb +2 -0
  32. data/lib/fear/none.rb +28 -10
  33. data/lib/fear/none_pattern_match.rb +2 -0
  34. data/lib/fear/option.rb +30 -2
  35. data/lib/fear/option_api.rb +4 -0
  36. data/lib/fear/option_pattern_match.rb +8 -3
  37. data/lib/fear/partial_function/and_then.rb +4 -2
  38. data/lib/fear/partial_function/any.rb +2 -0
  39. data/lib/fear/partial_function/combined.rb +3 -1
  40. data/lib/fear/partial_function/empty.rb +6 -0
  41. data/lib/fear/partial_function/guard/and.rb +2 -0
  42. data/lib/fear/partial_function/guard/and3.rb +2 -0
  43. data/lib/fear/partial_function/guard/or.rb +2 -0
  44. data/lib/fear/partial_function/guard.rb +8 -6
  45. data/lib/fear/partial_function/lifted.rb +2 -0
  46. data/lib/fear/partial_function/or_else.rb +5 -1
  47. data/lib/fear/partial_function.rb +18 -9
  48. data/lib/fear/partial_function_class.rb +3 -1
  49. data/lib/fear/pattern_match.rb +3 -11
  50. data/lib/fear/pattern_matching_api.rb +6 -28
  51. data/lib/fear/promise.rb +7 -5
  52. data/lib/fear/right.rb +3 -9
  53. data/lib/fear/right_biased.rb +5 -3
  54. data/lib/fear/right_pattern_match.rb +4 -0
  55. data/lib/fear/some.rb +35 -8
  56. data/lib/fear/some_pattern_match.rb +2 -0
  57. data/lib/fear/struct.rb +237 -0
  58. data/lib/fear/success.rb +7 -8
  59. data/lib/fear/success_pattern_match.rb +4 -0
  60. data/lib/fear/try.rb +8 -2
  61. data/lib/fear/try_api.rb +4 -0
  62. data/lib/fear/try_pattern_match.rb +9 -5
  63. data/lib/fear/unit.rb +6 -2
  64. data/lib/fear/utils.rb +14 -2
  65. data/lib/fear/version.rb +4 -1
  66. data/lib/fear.rb +26 -44
  67. data/spec/dry/types/fear/option/constrained_spec.rb +22 -0
  68. data/spec/dry/types/fear/option/core_spec.rb +77 -0
  69. data/spec/dry/types/fear/option/default_spec.rb +21 -0
  70. data/spec/dry/types/fear/option/hash_spec.rb +58 -0
  71. data/spec/dry/types/fear/option/option_spec.rb +97 -0
  72. data/spec/fear/awaitable_spec.rb +19 -0
  73. data/spec/fear/done_spec.rb +7 -5
  74. data/spec/fear/either/mixin_spec.rb +4 -2
  75. data/spec/fear/either_pattern_match_spec.rb +10 -8
  76. data/spec/fear/either_pattern_matching_spec.rb +28 -0
  77. data/spec/fear/either_spec.rb +26 -0
  78. data/spec/fear/failure_spec.rb +57 -70
  79. data/spec/fear/for/mixin_spec.rb +15 -0
  80. data/spec/fear/for_spec.rb +19 -17
  81. data/spec/fear/future_spec.rb +477 -237
  82. data/spec/fear/guard_spec.rb +136 -24
  83. data/spec/fear/left_spec.rb +57 -70
  84. data/spec/fear/none_spec.rb +39 -43
  85. data/spec/fear/option/mixin_spec.rb +9 -7
  86. data/spec/fear/option_pattern_match_spec.rb +10 -8
  87. data/spec/fear/option_pattern_matching_spec.rb +34 -0
  88. data/spec/fear/option_spec.rb +142 -0
  89. data/spec/fear/partial_function/any_spec.rb +25 -0
  90. data/spec/fear/partial_function/empty_spec.rb +12 -10
  91. data/spec/fear/partial_function_and_then_spec.rb +39 -37
  92. data/spec/fear/partial_function_composition_spec.rb +46 -44
  93. data/spec/fear/partial_function_or_else_spec.rb +92 -90
  94. data/spec/fear/partial_function_spec.rb +91 -61
  95. data/spec/fear/pattern_match_spec.rb +19 -51
  96. data/spec/fear/pattern_matching_api_spec.rb +31 -0
  97. data/spec/fear/promise_spec.rb +23 -23
  98. data/spec/fear/right_biased/left.rb +28 -26
  99. data/spec/fear/right_biased/right.rb +51 -49
  100. data/spec/fear/right_spec.rb +48 -68
  101. data/spec/fear/some_spec.rb +30 -40
  102. data/spec/fear/success_spec.rb +40 -60
  103. data/spec/fear/try/mixin_spec.rb +19 -3
  104. data/spec/fear/try_api_spec.rb +23 -0
  105. data/spec/fear/try_pattern_match_spec.rb +10 -8
  106. data/spec/fear/try_pattern_matching_spec.rb +34 -0
  107. data/spec/fear/utils_spec.rb +16 -14
  108. data/spec/spec_helper.rb +13 -7
  109. data/spec/struct_pattern_matching_spec.rb +36 -0
  110. data/spec/struct_spec.rb +194 -0
  111. data/spec/support/dry_types.rb +6 -0
  112. metadata +128 -87
  113. data/.travis.yml +0 -13
  114. data/lib/fear/extractor/anonymous_array_splat_matcher.rb +0 -8
  115. data/lib/fear/extractor/any_matcher.rb +0 -15
  116. data/lib/fear/extractor/array_head_matcher.rb +0 -34
  117. data/lib/fear/extractor/array_matcher.rb +0 -38
  118. data/lib/fear/extractor/array_splat_matcher.rb +0 -14
  119. data/lib/fear/extractor/empty_list_matcher.rb +0 -18
  120. data/lib/fear/extractor/extractor_matcher.rb +0 -42
  121. data/lib/fear/extractor/grammar.rb +0 -201
  122. data/lib/fear/extractor/grammar.treetop +0 -129
  123. data/lib/fear/extractor/identifier_matcher.rb +0 -16
  124. data/lib/fear/extractor/matcher/and.rb +0 -36
  125. data/lib/fear/extractor/matcher.rb +0 -54
  126. data/lib/fear/extractor/named_array_splat_matcher.rb +0 -15
  127. data/lib/fear/extractor/pattern.rb +0 -55
  128. data/lib/fear/extractor/typed_identifier_matcher.rb +0 -24
  129. data/lib/fear/extractor/value_matcher.rb +0 -17
  130. data/lib/fear/extractor.rb +0 -108
  131. data/lib/fear/extractor_api.rb +0 -33
  132. data/spec/fear/extractor/array_matcher_spec.rb +0 -228
  133. data/spec/fear/extractor/extractor_matcher_spec.rb +0 -151
  134. data/spec/fear/extractor/grammar_array_spec.rb +0 -23
  135. data/spec/fear/extractor/identified_matcher_spec.rb +0 -47
  136. data/spec/fear/extractor/identifier_matcher_spec.rb +0 -66
  137. data/spec/fear/extractor/pattern_spec.rb +0 -32
  138. data/spec/fear/extractor/typed_identifier_matcher_spec.rb +0 -62
  139. data/spec/fear/extractor/value_matcher_number_spec.rb +0 -77
  140. data/spec/fear/extractor/value_matcher_string_spec.rb +0 -86
  141. data/spec/fear/extractor/value_matcher_symbol_spec.rb +0 -69
  142. data/spec/fear/extractor_api_spec.rb +0 -113
  143. data/spec/fear/extractor_spec.rb +0 -59
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Fear::Either do
4
+ describe "pattern matching" do
5
+ subject do
6
+ case value
7
+ in Fear::Right[Integer => int]
8
+ "right of #{int}"
9
+ in Fear::Left[Integer => int]
10
+ "left of #{int}"
11
+ else
12
+ "something else"
13
+ end
14
+ end
15
+
16
+ context "when value is right of integer" do
17
+ let(:value) { Fear.right(42) }
18
+
19
+ it { is_expected.to eq("right of 42") }
20
+ end
21
+
22
+ context "when value is left of integer" do
23
+ let(:value) { Fear.left(42) }
24
+
25
+ it { is_expected.to eq("left of 42") }
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Fear::Either do
4
+ describe "#matcher" do
5
+ subject(:result) { matcher.(value) }
6
+
7
+ let(:matcher) do
8
+ described_class.matcher do |m|
9
+ m.right { |x| "right of #{x}" }
10
+ m.left { |x| "left of #{x}" }
11
+ end
12
+ end
13
+
14
+ context "when matches the right branch" do
15
+ let(:value) { Fear.right(42) }
16
+
17
+ it { is_expected.to eq("right of 42") }
18
+ end
19
+
20
+ context "when matches the left branch" do
21
+ let(:value) { Fear.left(42) }
22
+
23
+ it { is_expected.to eq("left of 42") }
24
+ end
25
+ end
26
+ end
@@ -1,155 +1,164 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Fear::Failure do
2
- let(:exception) { RuntimeError.new('error') }
4
+ let(:exception) { RuntimeError.new("error") }
3
5
  let(:failure) { Fear.failure(exception) }
4
6
 
5
7
  it_behaves_like Fear::RightBiased::Left do
6
8
  let(:left) { failure }
7
9
  end
8
10
 
9
- describe '#exception' do
11
+ describe "#exception" do
10
12
  subject { failure.exception }
11
13
  it { is_expected.to eq(exception) }
12
14
  end
13
15
 
14
- describe '#success?' do
16
+ describe "#success?" do
15
17
  subject { failure }
16
18
  it { is_expected.not_to be_success }
17
19
  end
18
20
 
19
- describe '#failure?' do
21
+ describe "#failure?" do
20
22
  subject { failure }
21
23
  it { is_expected.to be_failure }
22
24
  end
23
25
 
24
- describe '#get' do
26
+ describe "#get" do
25
27
  subject { proc { failure.get } }
26
- it { is_expected.to raise_error(RuntimeError, 'error') }
28
+ it { is_expected.to raise_error(RuntimeError, "error") }
27
29
  end
28
30
 
29
- describe '#or_else' do
30
- context 'default does not fail' do
31
- subject { failure.or_else { Fear::Success.new('value') } }
32
- it { is_expected.to eq(Fear::Success.new('value')) }
31
+ describe "#or_else" do
32
+ context "default does not fail" do
33
+ subject { failure.or_else { Fear::Success.new("value") } }
34
+ it { is_expected.to eq(Fear::Success.new("value")) }
33
35
  end
34
36
 
35
- context 'default fails with error' do
36
- subject(:or_else) { failure.or_else { raise 'unexpected error' } }
37
+ context "default fails with error" do
38
+ subject(:or_else) { failure.or_else { raise "unexpected error" } }
37
39
  it { is_expected.to be_kind_of(described_class) }
38
- it { expect { or_else.get }.to raise_error(RuntimeError, 'unexpected error') }
40
+ it { expect { or_else.get }.to raise_error(RuntimeError, "unexpected error") }
39
41
  end
40
42
  end
41
43
 
42
- describe '#flatten' do
44
+ describe "#flatten" do
43
45
  subject { failure.flatten }
44
46
  it { is_expected.to eq(failure) }
45
47
  end
46
48
 
47
- describe '#select' do
48
- subject { failure.select { |v| v == 'value' } }
49
+ describe "#select" do
50
+ subject { failure.select { |v| v == "value" } }
49
51
  it { is_expected.to eq(failure) }
50
52
  end
51
53
 
52
- context '#recover_with' do
53
- context 'block matches the error and does not fail' do
54
+ context "#recover_with" do
55
+ context "block matches the error and does not fail" do
54
56
  subject do
55
57
  failure.recover_with do |m|
56
58
  m.case(RuntimeError) { |error| Fear.success(error.message) }
57
59
  end
58
60
  end
59
61
 
60
- it 'returns result of evaluation of the block against the error' do
61
- is_expected.to eq(Fear::Success.new('error'))
62
+ it "returns result of evaluation of the block against the error" do
63
+ is_expected.to eq(Fear::Success.new("error"))
62
64
  end
63
65
  end
64
66
 
65
- context 'block does not match the error' do
67
+ context "block does not match the error" do
66
68
  subject do
67
69
  failure.recover_with do |m|
68
70
  m.case(ZeroDivisionError) { Fear.success(0) }
69
71
  end
70
72
  end
71
73
 
72
- it 'returns the same failure' do
74
+ it "returns the same failure" do
73
75
  is_expected.to eq(failure)
74
76
  end
75
77
  end
76
78
 
77
- context 'block fails' do
78
- subject(:recover_with) { failure.recover_with { raise 'unexpected error' } }
79
+ context "block fails" do
80
+ subject(:recover_with) { failure.recover_with { raise "unexpected error" } }
79
81
 
80
82
  it { is_expected.to be_kind_of(described_class) }
81
- it { expect { recover_with.get }.to raise_error(RuntimeError, 'unexpected error') }
83
+ it { expect { recover_with.get }.to raise_error(RuntimeError, "unexpected error") }
82
84
  end
83
85
  end
84
86
 
85
- context '#recover' do
86
- context 'block matches the error and does not fail' do
87
+ context "#recover" do
88
+ context "block matches the error and does not fail" do
87
89
  subject do
88
90
  failure.recover do |m|
89
91
  m.case(RuntimeError, &:message)
90
92
  end
91
93
  end
92
94
 
93
- it 'returns Success of evaluation of the block against the error' do
94
- is_expected.to eq(Fear.success('error'))
95
+ it "returns Success of evaluation of the block against the error" do
96
+ is_expected.to eq(Fear.success("error"))
95
97
  end
96
98
  end
97
99
 
98
- context 'block does not match the error' do
100
+ context "block does not match the error" do
99
101
  subject do
100
102
  failure.recover do |m|
101
103
  m.case(ZeroDivisionError, &:message)
102
104
  end
103
105
  end
104
106
 
105
- it 'returns the same failure' do
107
+ it "returns the same failure" do
106
108
  is_expected.to eq(failure)
107
109
  end
108
110
  end
109
111
 
110
- context 'block fails' do
112
+ context "block fails" do
111
113
  subject(:recover) do
112
114
  failure.recover do
113
- raise 'unexpected error'
115
+ raise "unexpected error"
114
116
  end
115
117
  end
116
118
 
117
119
  it { is_expected.to be_kind_of(described_class) }
118
- it { expect { recover.get }.to raise_error(RuntimeError, 'unexpected error') }
120
+ it { expect { recover.get }.to raise_error(RuntimeError, "unexpected error") }
119
121
  end
120
122
  end
121
123
 
122
- describe '#to_either' do
124
+ describe "#to_either" do
123
125
  subject { failure.to_either }
124
126
  it { is_expected.to eq(Fear.left(exception)) }
125
127
  end
126
128
 
127
- describe '#===' do
129
+ describe "#===" do
128
130
  subject { match === failure }
129
131
 
130
- context 'matches erectly' do
132
+ context "matches erectly" do
131
133
  let(:match) { Fear.failure(exception) }
132
134
  it { is_expected.to eq(true) }
133
135
  end
134
136
 
135
- context 'value does not match' do
137
+ context "value does not match" do
136
138
  let(:match) { Fear.failure(ArgumentError.new) }
137
139
  it { is_expected.to eq(false) }
138
140
  end
139
141
 
140
- context 'matches by class' do
142
+ context "matches by class" do
141
143
  let(:match) { Fear.failure(RuntimeError) }
142
144
  it { is_expected.to eq(true) }
143
145
  end
144
146
 
145
- context 'does not matches by class' do
147
+ context "does not match by class" do
146
148
  let(:match) { Fear.failure(ArgumentError) }
147
149
  it { is_expected.to eq(false) }
148
150
  end
151
+
152
+ context "does not match non-try" do
153
+ let(:match) { Fear.failure(ArgumentError) }
154
+ let(:failure) { ArgumentError.new }
155
+
156
+ it { is_expected.to eq(false) }
157
+ end
149
158
  end
150
159
 
151
- describe '#match' do
152
- context 'matched' do
160
+ describe "#match" do
161
+ context "matched" do
153
162
  subject do
154
163
  failure.match do |m|
155
164
  m.failure(->(x) { x.message.length < 2 }) { |x| "Error: #{x}" }
@@ -158,15 +167,15 @@ RSpec.describe Fear::Failure do
158
167
  end
159
168
  end
160
169
 
161
- it { is_expected.to eq('Error: error') }
170
+ it { is_expected.to eq("Error: error") }
162
171
  end
163
172
 
164
- context 'nothing matched and no else given' do
173
+ context "nothing matched and no else given" do
165
174
  subject do
166
175
  proc do
167
176
  failure.match do |m|
168
177
  m.failure(->(x) { x.message.length < 2 }) { |x| "Error: #{x}" }
169
- m.success { 'noop' }
178
+ m.success { "noop" }
170
179
  end
171
180
  end
172
181
  end
@@ -174,7 +183,7 @@ RSpec.describe Fear::Failure do
174
183
  it { is_expected.to raise_error(Fear::MatchError) }
175
184
  end
176
185
 
177
- context 'nothing matched and else given' do
186
+ context "nothing matched and else given" do
178
187
  subject do
179
188
  failure.match do |m|
180
189
  m.failure(->(x) { x.message.length < 2 }) { |x| "Error: #{x}" }
@@ -186,31 +195,9 @@ RSpec.describe Fear::Failure do
186
195
  end
187
196
  end
188
197
 
189
- describe '#to_s' do
198
+ describe "#to_s" do
190
199
  subject { failure.to_s }
191
200
 
192
- it { is_expected.to eq('#<Fear::Failure exception=#<RuntimeError: error>>') }
193
- end
194
-
195
- describe 'pattern matching' do
196
- subject { Fear.xcase('Failure(v : ArgumentError)') { 'matched' }.call_or_else(var) { 'nothing' } }
197
-
198
- context 'failure of ArgumentError' do
199
- let(:var) { Fear.failure(ArgumentError.new) }
200
-
201
- it { is_expected.to eq('matched') }
202
- end
203
-
204
- context 'failure of RuntimeError' do
205
- let(:var) { Fear.failure(RuntimeError.new) }
206
-
207
- it { is_expected.to eq('nothing') }
208
- end
209
-
210
- context 'not failure' do
211
- let(:var) { '42' }
212
-
213
- it { is_expected.to eq('nothing') }
214
- end
201
+ it { is_expected.to eq("#<Fear::Failure exception=#<RuntimeError: error>>") }
215
202
  end
216
203
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Fear::For::Mixin do
4
+ include Fear::For::Mixin
5
+
6
+ describe "For()" do
7
+ subject do
8
+ For([1, 2], [2, 3], [3, 4]) do |a, b, c|
9
+ a * b * c
10
+ end
11
+ end
12
+
13
+ it { is_expected.to eq([6, 8, 9, 12, 12, 16, 18, 24]) }
14
+ end
15
+ end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Fear::For do
2
- context 'unary' do
3
- context 'Some' do
4
+ context "unary" do
5
+ context "Some" do
4
6
  subject do
5
7
  Fear.for(Fear.some(2)) { |a| a * 2 }
6
8
  end
@@ -8,7 +10,7 @@ RSpec.describe Fear::For do
8
10
  it { is_expected.to eq(Fear.some(4)) }
9
11
  end
10
12
 
11
- context 'None' do
13
+ context "None" do
12
14
  subject do
13
15
  Fear.for(Fear.none) { |a| a * 2 }
14
16
  end
@@ -17,7 +19,7 @@ RSpec.describe Fear::For do
17
19
  end
18
20
  end
19
21
 
20
- context 'arrays' do
22
+ context "arrays" do
21
23
  subject do
22
24
  Fear.for([1, 2], [2, 3], [3, 4]) do |a, b, c|
23
25
  a * b * c
@@ -27,14 +29,14 @@ RSpec.describe Fear::For do
27
29
  it { is_expected.to eq([6, 8, 9, 12, 12, 16, 18, 24]) }
28
30
  end
29
31
 
30
- context 'ternary' do
32
+ context "ternary" do
31
33
  subject do
32
34
  Fear.for(first, second, third) do |a, b, c|
33
35
  a * b * c
34
36
  end
35
37
  end
36
38
 
37
- context 'all Same' do
39
+ context "all Same" do
38
40
  let(:first) { Fear.some(2) }
39
41
  let(:second) { Fear.some(3) }
40
42
  let(:third) { Fear.some(4) }
@@ -42,7 +44,7 @@ RSpec.describe Fear::For do
42
44
  it { is_expected.to eq(Fear.some(24)) }
43
45
  end
44
46
 
45
- context 'first is None' do
47
+ context "first is None" do
46
48
  let(:first) { Fear.none }
47
49
  let(:second) { Fear.some(3) }
48
50
  let(:third) { Fear.some(4) }
@@ -50,7 +52,7 @@ RSpec.describe Fear::For do
50
52
  it { is_expected.to eq(Fear.none) }
51
53
  end
52
54
 
53
- context 'second is None' do
55
+ context "second is None" do
54
56
  let(:first) { Fear.some(2) }
55
57
  let(:second) { Fear.none }
56
58
  let(:third) { Fear.some(4) }
@@ -58,7 +60,7 @@ RSpec.describe Fear::For do
58
60
  it { is_expected.to eq(Fear.none) }
59
61
  end
60
62
 
61
- context 'last is None' do
63
+ context "last is None" do
62
64
  let(:first) { Fear.some(2) }
63
65
  let(:second) { Fear.some(3) }
64
66
  let(:third) { Fear.none }
@@ -66,7 +68,7 @@ RSpec.describe Fear::For do
66
68
  it { is_expected.to eq(Fear.none) }
67
69
  end
68
70
 
69
- context 'all Same in lambdas' do
71
+ context "all Same in lambdas" do
70
72
  let(:first) { proc { Fear.some(2) } }
71
73
  let(:second) { proc { Fear.some(3) } }
72
74
  let(:third) { proc { Fear.some(4) } }
@@ -74,28 +76,28 @@ RSpec.describe Fear::For do
74
76
  it { is_expected.to eq(Fear.some(24)) }
75
77
  end
76
78
 
77
- context 'first is None in lambda, second is failure in lambda' do
79
+ context "first is None in lambda, second is failure in lambda" do
78
80
  let(:first) { proc { Fear.none } }
79
- let(:second) { proc { raise 'kaboom' } }
81
+ let(:second) { proc { raise "kaboom" } }
80
82
  let(:third) { proc {} }
81
83
 
82
- it 'returns None without evaluating second and third' do
84
+ it "returns None without evaluating second and third" do
83
85
  is_expected.to eq(Fear.none)
84
86
  end
85
87
  end
86
88
 
87
- context 'second is None in lambda, third is failure in lambda' do
89
+ context "second is None in lambda, third is failure in lambda" do
88
90
  let(:first) { Fear.some(2) }
89
91
  let(:second) { proc { Fear.none } }
90
- let(:third) { proc { raise 'kaboom' } }
92
+ let(:third) { proc { raise "kaboom" } }
91
93
 
92
- it 'returns None without evaluating third' do
94
+ it "returns None without evaluating third" do
93
95
  is_expected.to eq(Fear.none)
94
96
  end
95
97
  end
96
98
  end
97
99
 
98
- context 'refer to previous variable from lambda' do
100
+ context "refer to previous variable from lambda" do
99
101
  subject do
100
102
  Fear.for(first, second, third) do |_, b, c|
101
103
  b * c