/
todo_writer_spec.rb
31 lines (26 loc) · 1000 Bytes
/
todo_writer_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe RubocopChallenger::Rubocop::TodoWriter do
let(:todo_editor) { described_class.new(source, destination) }
describe '#delete_rule' do
let(:source) { 'spec/fixtures/.rubocop_todo.yml' }
let(:destination) { 'spec/fixtures/.modified_rubocop_todo.yml' }
let(:expected) { File.read('spec/fixtures/.expected_rubocop_todo.yml') }
let(:rule) { RubocopChallenger::Rubocop::Rule.new(<<~CONTENTS) }
# Offense count: 1
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Exclude:
- 'spec/lib/rubocop_challenger/rubocop/todo_reader_spec.rb'
CONTENTS
after do
File.delete(destination)
end
it 'deletes target rule' do
todo_editor.delete_rule(rule)
expect(File.read(destination)).to eq expected
end
end
end