free_mutant/spec/unit/mutant/ast/sexp_spec.rb
Markus Schirp 99ab9ff171 Change required Ruby version to >=2.3
* This commit does every 2.3 change required to get the build pass
* None of the changes can be extracted, without changing the build setup
2018-09-12 14:21:24 +00:00

38 lines
745 B
Ruby

# frozen_string_literal: true
RSpec.describe Mutant::AST::Sexp do
let(:object) do
Class.new do
include Mutant::AST::Sexp
public :n_not
public :s
end.new
end
describe '#n_not' do
subject { object.n_not(node) }
let(:node) { s(:true) }
it 'returns negated ast' do
expect(subject).to eql(s(:send, s(:true), :!))
end
end
describe '#s' do
subject { object.s(*arguments) }
context 'with single argument' do
let(:arguments) { %i[foo] }
it { should eql(Parser::AST::Node.new(:foo)) }
end
context 'with single multiple arguments' do
let(:arguments) { %i[foo bar baz] }
it { should eql(Parser::AST::Node.new(:foo, %i[bar baz])) }
end
end
end