Skip to content

Commit

Permalink
Refactor spec, fix labels
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Jul 9, 2020
1 parent c787af3 commit e4f47c9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spec/rubocop/ast/processed_source_spec.rb
Expand Up @@ -252,23 +252,23 @@ def foo # comment one
end

describe '#commented?' do
subject(:commented) { processed_source.commented?(range) }

let(:source) { <<~RUBY }
# comment
[ 1, 2 ]
RUBY

context 'provided source_range on line with comment' do
it 'returns true' do
bracket_range = processed_source.find_token(&:left_bracket?).pos
expect(processed_source.commented?(bracket_range)).to be false
end
context 'provided source_range on line without comment' do
let(:range) { processed_source.find_token(&:left_bracket?).pos }

it { is_expected.to be false }
end

context 'provided source_range on line without comment' do
it 'returns false' do
comment_range = processed_source.find_token(&:comment?).pos
expect(processed_source.commented?(comment_range)).to be true
end
context 'provided source_range on line with comment' do
let(:range) { processed_source.find_token(&:comment?).pos }

it { is_expected.to be true }
end
end

Expand Down

0 comments on commit e4f47c9

Please sign in to comment.