Sha256: 0424f388084be3fa74206d573a825ea4369083d4e65545eb401fd2322c30a944
Contents?: true
Size: 721 Bytes
Versions: 2
Compression:
Stored size: 721 Bytes
Contents
require 'spec_helper' require 'parser/current' describe Unparser::Comments, '#take_before' do let(:ast_and_comments) do Parser::CurrentRuby.parse_with_comments(<<-RUBY) def hi # EOL 1 # comment end # EOL 2 RUBY end let(:ast) { ast_and_comments[0] } let(:comments) { ast_and_comments[1] } let(:object) { described_class.new(comments) } it 'should return no comments none are before the node' do expect(object.take_before(ast, :expression)).to eql([]) end it 'should only the comments that are before the specified part of the node' do expect(object.take_before(ast, :end)).to eql(comments.first(2)) expect(object.take_all).to eql([comments[2]]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
unparser-0.1.4 | spec/unit/unparser/comments/take_before_spec.rb |
unparser-0.1.3 | spec/unit/unparser/comments/take_before_spec.rb |