Sha256: 8260bdb72a3d6f9592682551fe02551f402c106f91f33be3a3d4561d2087a625

Contents?: true

Size: 711 Bytes

Versions: 6

Compression:

Stored size: 711 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

module Synvert::Core
  describe Rewriter::RemoveAction do
    subject {
      source = "user = User.new params[:user]\nuser.save\nrender\n"
      send_node = Parser::CurrentRuby.parse(source).children[1]
      instance = double(current_node: send_node, file_source: source)
      Rewriter::RemoveAction.new(instance)
    }

    it 'gets begin_pos' do
      expect(subject.begin_pos).to eq "user = User.new params[:user]\n".length
    end

    it 'gets end_pos' do
      expect(subject.end_pos).to eq "user = User.new params[:user]\nuser.save\n".length
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
synvert-core-0.56.1 spec/synvert/core/rewriter/action/remove_action_spec.rb
synvert-core-0.56.0 spec/synvert/core/rewriter/action/remove_action_spec.rb
synvert-core-0.55.0 spec/synvert/core/rewriter/action/remove_action_spec.rb
synvert-core-0.54.3 spec/synvert/core/rewriter/action/remove_action_spec.rb
synvert-core-0.54.2 spec/synvert/core/rewriter/action/remove_action_spec.rb
synvert-core-0.54.1 spec/synvert/core/rewriter/action/remove_action_spec.rb