Sha256: 6b64079afcd89dcf3ff5ecfbf6dfc8ed92eb9e76f7be76fd673eebe1c4f94a53

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

module Synvert::Core
  RSpec.describe Rewriter::IfExistCondition do
    let(:source) { <<~EOS }
      RSpec.configure do |config|
        config.include EmailSpec::Helpers
        config.include EmailSpec::Methods
      end
    EOS
    let(:node) { Parser::CurrentRuby.parse(source) }
    let(:instance) { double(current_node: node, parser: :parser) }

    describe '#process' do
      it 'call block if match anything' do
        run = false
        condition =
          Rewriter::IfExistCondition.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 not match anything' do
        run = false
        condition =
          Rewriter::IfExistCondition.new instance,
                                         type: 'send',
                                         message: 'include',
                                         arguments: ['FactoryGirl::SyntaxMethods'] do
            run = true
          end
        condition.process
        expect(run).to be_falsey
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
synvert-core-1.35.4 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.35.3 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.35.2 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.35.1 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.35.0 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.34.0 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.33.3 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.33.2 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.33.1 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.33.0 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.32.1 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.32.0 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.31.1 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.31.0 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.30.3 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.30.2 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.30.1 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb
synvert-core-1.30.0 spec/synvert/core/rewriter/condition/if_exist_condition_spec.rb