Sha256: 1869fba54f5255e906c570b3c817e9c91c172dcbc4f82332c9b734aeab011897
Contents?: true
Size: 1.21 KB
Versions: 22
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require 'spec_helper' module Synvert::Core RSpec.describe Rewriter::ReplaceErbStmtWithExprAction do context 'replace with whitespace' do subject { erb_source = "<% form_for post do |f| %>\n<% end %>" source = Engine::Erb.encode(erb_source) node = Parser::CurrentRuby.parse(source).children.first described_class.new(node, erb_source).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 context 'replace without whitespace' do subject { erb_source = "<%form_for post do |f|%>\n<%end%>" source = Engine::Erb.encode(erb_source) node = Parser::CurrentRuby.parse(source).children.first described_class.new(node, erb_source).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
22 entries across 22 versions & 1 rubygems