Sha256: 4decb884c32d925324ffaa9e153dd22eb9e6594708178dd35de0454b9c558be6
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true require 'spec_helper' module Synvert::Core describe Rewriter::IfOnlyExistCondition do let(:source) { """ RSpec.configure do |config| config.include EmailSpec::Helpers config.include EmailSpec::Methods end """ } let(:node) { Parser::CurrentRuby.parse(source) } let(:instance) { double(:current_node => node) } describe '#process' do it 'gets matching nodes' do source = """ RSpec.configure do |config| config.include EmailSpec::Helpers end """ node = Parser::CurrentRuby.parse(source) instance = double(:current_node => node) run = false condition = Rewriter::IfOnlyExistCondition.new instance, type: 'send', message: 'include', arguments: ['EmailSpec::Helpers'] do run = true end condition.process expect(run).to be_truthy end it 'not call block if does not match' do run = false condition = Rewriter::IfOnlyExistCondition.new instance, type: 'send', message: 'include', arguments: ['EmailSpec::Helpers'] do run = true end condition.process expect(run).to be_falsey end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
synvert-core-0.16.1 | spec/synvert/core/rewriter/condition/if_only_exist_condition_spec.rb |
synvert-core-0.16.0 | spec/synvert/core/rewriter/condition/if_only_exist_condition_spec.rb |