Sha256: eaa44920830115ebb6367a87da18c56f7ca54234cebf52593ba05562e419dbf3
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper.rb' require 'reek/adapters/source' require 'stringio' include Reek describe Source do context 'when the parser fails' do before :each do @catcher = StringIO.new @old_err_io = (Source.err_io = @catcher) parser = mock('parser') @error_message = 'Error message' parser.should_receive(:parse).and_raise(SyntaxError.new(@error_message)) @source_name = 'Test source' @src = Source.new('', @source_name, parser) end it 'raises a SyntaxError' do @src.syntax_tree end it 'returns an empty syntax tree' do @src.syntax_tree.should == s() end it 'records the syntax error' do @src.syntax_tree @catcher.string.should match(SyntaxError.name) end it 'records the source name' do @src.syntax_tree @catcher.string.should match(@source_name) end it 'records the error message' do @src.syntax_tree @catcher.string.should match(@error_message) end after :each do Source.err_io = @old_err_io end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reek-1.2.6 | spec/reek/adapters/source_spec.rb |