Skip to content

Commit

Permalink
Simplify spec further
Browse files Browse the repository at this point in the history
This way this spec doesn't require FileHelper
  • Loading branch information
marcandre authored and bbatsov committed May 12, 2020
1 parent da710f5 commit 657a330
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions spec/rubocop/processed_source_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

RSpec.describe RuboCop::ProcessedSource do
include FileHelper

subject(:processed_source) { described_class.new(source, ruby_version, path) }

let(:source) { <<~RUBY }
Expand All @@ -12,13 +10,15 @@ def some_method
end
some_method
RUBY
let(:path) { 'ast/and_node_spec.rb' }

let(:path) { 'path/to/file.rb' }

describe '.from_file', :isolated_environment do
describe '.from_file' do
describe 'when the file exists' do
before do
create_file(path, 'foo')
around do |example|
org_pwd = Dir.pwd
Dir.chdir(__dir__)
example.run
Dir.chdir(org_pwd)
end

let(:processed_source) { described_class.from_file(path, ruby_version) }
Expand Down Expand Up @@ -329,7 +329,7 @@ def foo # comment one

describe '#file_path' do
it 'returns file path' do
expect(processed_source.file_path).to eq 'path/to/file.rb'
expect(processed_source.file_path).to eq path
end
end

Expand Down

0 comments on commit 657a330

Please sign in to comment.