Sha256: a4c4b29886ab2b5ada1853e4dc2549dd07beac45f23828c670ea047a3f2e608d

Contents?: true

Size: 717 Bytes

Versions: 27

Compression:

Stored size: 717 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

module Synvert::Core
  describe Rewriter::ReplaceAction do
    context 'replace with single line' do
      subject {
        source = 'FactoryBot.create(:user)'
        node = Parser::CurrentRuby.parse(source)
        instance = double(current_node: node)
        Rewriter::ReplaceAction.new(instance, :receiver, :dot, :message, with: 'create').process
      }

      it 'gets begin_pos' do
        expect(subject.begin_pos).to eq 0
      end

      it 'gets end_pos' do
        expect(subject.end_pos).to eq 'FactoryBot.create'.length
      end

      it 'gets rewritten_code' do
        expect(subject.rewritten_code).to eq 'create'
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
synvert-core-1.4.0 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.3.1 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.3.0 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.2.1 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.2.0 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.1.1 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.1.0 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.0.5 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.0.4 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.0.3 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.0.2 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-1.0.1 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-0.64.0 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-0.63.1 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-0.63.0 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-0.62.1 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-0.62.0 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-0.61.2 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-0.61.1 spec/synvert/core/rewriter/action/replace_action_spec.rb
synvert-core-0.61.0 spec/synvert/core/rewriter/action/replace_action_spec.rb