Sha256: 95ffa40c787f41281a0cfe01aa3fb599c28a9b5e43acf24a373a8f99a8a8be70

Contents?: true

Size: 1.33 KB

Versions: 145

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

module Synvert::Core
  describe Rewriter::UnlessExistCondition 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 'call block if match anything' do
        run = false
        condition =
          Rewriter::UnlessExistCondition.new instance,
                                             type: 'send',
                                             message: 'include',
                                             arguments: ['FactoryGirl::Syntax::Methods'] 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::UnlessExistCondition.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

145 entries across 145 versions & 1 rubygems

Version Path
synvert-core-0.46.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.45.2 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.45.1 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.45.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.44.1 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.44.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.42.1 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.42.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.41.2 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.41.1 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.41.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.40.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.39.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.38.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.36.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.35.1 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.35.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.34.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.33.1 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb
synvert-core-0.33.0 spec/synvert/core/rewriter/condition/unless_exist_condition_spec.rb