Sha256: 98a6e89dc29668f7efa732caec300a5b3dc612784f47bfabfd0b9702707ad666
Contents?: true
Size: 723 Bytes
Versions: 7
Compression:
Stored size: 723 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' module Synvert::Core describe Rewriter::ReplaceAction do context 'replace with single line' do subject { source = "'slug from title'.gsub(' ', '_')" node = Parser::CurrentRuby.parse(source) instance = double(current_node: node) Rewriter::ReplaceAction.new(instance, :message, with: 'tr') } it 'gets begin_pos' do expect(subject.begin_pos).to eq "'slug from title'.".length end it 'gets end_pos' do expect(subject.end_pos).to eq "'slug from title'.gsub".length end it 'gets rewritten_code' do expect(subject.rewritten_code).to eq 'tr' end end end end
Version data entries
7 entries across 7 versions & 1 rubygems