Sha256: f927ac5fb74357f84e7332cf8318c7d7302e2b7833d202314c2c5408b850e83c

Contents?: true

Size: 671 Bytes

Versions: 5

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

module Synvert::Core
  RSpec.describe Rewriter::ReplaceErbStmtWithExprAction do
    context 'replace with single line' do
      subject {
        source = "<% form_for post do |f| %>\n<% end %>"
        source = Engine::Erb.encode(source)
        node = Parser::CurrentRuby.parse(source).children.first
        described_class.new(node).process
      }

      it 'gets start' do
        expect(subject.start).to eq '<%'.length
      end

      it 'gets end' do
        expect(subject.end).to eq '<%'.length
      end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
synvert-core-1.22.1 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.22.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.21.7 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.21.6 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.21.5 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb