Skip to content

Commit 221b598

Browse files
committed
Add spec for testing position flag
The position flag sets the same value for file types (fixture, models, etc.) if it's not already set. Add a spec to test this behavior.
1 parent 56af715 commit 221b598

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

spec/parser_spec.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,25 @@ module Annotate # rubocop:disable Metrics/ModuleLength
4848
expect(ENV).to have_received(:[]=).with(file_type, position)
4949
end
5050
end
51-
52-
context 'the ENV value for different file type has already been set' do
53-
end
5451
end
5552
end
5653
end
5754
end
5855

56+
context 'when position_in_class is set to top' do
57+
context 'and when position is a different value' do
58+
it 'does not override' do
59+
other_commands = %w[--pc top]
60+
position_command = %w[-p bottom]
61+
options = other_commands + position_command
62+
63+
Parser.parse(options)
64+
expect(ENV['position_in_class']).to eq('top')
65+
expect(ENV['position']).to eq('bottom')
66+
end
67+
end
68+
end
69+
5970
%w[--pc --position-in-class].each do |option|
6071
describe option do
6172
let(:env_key) { 'position_in_class' }

0 commit comments

Comments
 (0)