Skip to content

Commit 7e802cd

Browse files
committed
Copy Wrapper options to Parser
1 parent 38126c0 commit 7e802cd

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

lib/parser.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ def parser(options)
8080
ENV['position_in_serializer'] = p
8181
has_set_position['position_in_serializer'] = true
8282
end
83+
84+
opts.on('--w', '--wrapper STR', 'Wrap annotation with the text passed as parameter.',
85+
'If --w option is used, the same text will be used as opening and closing') do |p|
86+
ENV['wrapper'] = p
87+
end
88+
89+
opts.on('--wo', '--wrapper-open STR', 'Annotation wrapper opening.') do |p|
90+
ENV['wrapper_open'] = p
91+
end
92+
93+
opts.on('--wc', '--wrapper-close STR', 'Annotation wrapper closing') do |p|
94+
ENV['wrapper_close'] = p
95+
end
8396
end
8497
end
8598

spec/parser_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,34 @@
141141
end
142142
end
143143
end
144+
145+
['--w', '--wrapper'].each do |option|
146+
describe option do
147+
let(:set_value) { 'STR' }
148+
it 'sets the ENV variable' do
149+
expect(ENV).to receive(:[]=).with('wrapper', set_value)
150+
Parser.parse([option, set_value])
151+
end
152+
end
153+
end
154+
155+
['--wo', '--wrapper-open'].each do |option|
156+
describe option do
157+
let(:set_value) { 'STR' }
158+
it 'sets the ENV variable' do
159+
expect(ENV).to receive(:[]=).with('wrapper_open', set_value)
160+
Parser.parse([option, set_value])
161+
end
162+
end
163+
end
164+
165+
['--wc', '--wrapper-close'].each do |option|
166+
describe option do
167+
let(:set_value) { 'STR' }
168+
it 'sets the ENV variable' do
169+
expect(ENV).to receive(:[]=).with('wrapper_close', set_value)
170+
Parser.parse([option, set_value])
171+
end
172+
end
173+
end
144174
end

0 commit comments

Comments
 (0)