Sha256: 0b201e9e3f57d9c0c0a8aa88bfe7b1917c1ae981caeb05c1ec9b60e51a6332e0

Contents?: true

Size: 666 Bytes

Versions: 12

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

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

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

    it 'gets end_pos' do
      expect(subject.end_pos).to eq "class Bar\nend".length
    end

    it 'gets rewritten_code' do
      expect(subject.rewritten_code).to eq <<~EOS.strip
        module Foo
          class Bar
          end
        end
      EOS
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
synvert-core-0.56.1 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.56.0 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.55.0 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.54.3 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.54.2 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.54.1 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.54.0 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.53.0 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.52.1 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.52.0 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.51.1 spec/synvert/core/rewriter/action/wrap_action_spec.rb
synvert-core-0.51.0 spec/synvert/core/rewriter/action/wrap_action_spec.rb