Sha256: 7cd81cb1b7664b0736d6612a0d881b9ae87443481386a46d4c46e58e1e6943aa

Contents?: true

Size: 870 Bytes

Versions: 29

Compression:

Stored size: 870 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[1]
        described_class.new(node).process
      }

      it 'gets start' do
        expect(subject.start).to eq '@output_buffer = output_buffer || ActionView::OutputBuffer.new;'.length
      end

      it 'gets end' do
        expect(subject.end).to eq '@output_buffer = output_buffer || ActionView::OutputBuffer.new;;   ; form_for post do |f| ;   ;'.length
      end

      it 'gets new_code' do
        expect(subject.new_code).to eq '@output_buffer.append=  form_for post do |f| ;  ;'
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
synvert-core-1.21.4 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.21.3 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.21.2 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.21.1 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.21.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.20.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.19.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.18.1 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.18.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.17.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.16.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.15.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.14.2 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.14.1 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.14.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.13.1 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.13.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.12.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.11.0 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb
synvert-core-1.10.1 spec/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action_spec.rb