Sha256: 04560231574239a9212aa926d4f137be09b1d3d52c3528ec6c12ec7977a90c08
Contents?: true
Size: 989 Bytes
Versions: 14
Compression:
Stored size: 989 Bytes
Contents
require 'spec_helper' module Ridley describe Mixin::FromFile do describe '.from_file' do context 'when there is bad Ruby in the file' do let(:instance) { Class.new { include Ridley::Mixin::FromFile }.new } before do allow(File).to receive(:exists?).and_return(true) allow(File).to receive(:readable?).and_return(true) allow(IO).to receive(:read).and_return('invalid Ruby code') end it 'raises a FromFileParserError' do expect { instance.from_file('/path') }.to raise_error(Errors::FromFileParserError) end it 'includes the backtrace from the original error' do expect { instance.from_file('/path') }.to raise_error { |error| expect(error.message).to include("undefined local variable or method `code' for") expect(error.backtrace).to include("/path:1:in `block in from_file'") } end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems