Sha256: d52be23ac2c6163c4840a9c8a85e1882c81f248a2d99bceb1cdf2a19e07caeeb

Contents?: true

Size: 624 Bytes

Versions: 3

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

module Synvert::Core
  describe Rewriter::InsertAfterAction do
    subject {
      source = "  include Foo"
      node = Parser::CurrentRuby.parse(source)
      instance = double(current_node: node)
      Rewriter::InsertAfterAction.new(instance, 'include Bar')
    }

    it 'gets begin_pos' do
      expect(subject.begin_pos).to eq "  include Foo".length
    end

    it 'gets end_pos' do
      expect(subject.end_pos).to eq "  include Foo".length
    end

    it 'gets rewritten_code' do
      expect(subject.rewritten_code).to eq "\n  include Bar"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
synvert-core-0.17.0 spec/synvert/core/rewriter/action/insert_after_action_spec.rb
synvert-core-0.16.1 spec/synvert/core/rewriter/action/insert_after_action_spec.rb
synvert-core-0.16.0 spec/synvert/core/rewriter/action/insert_after_action_spec.rb