Sha256: f03896735c98cbbe5b67efa7b759e535c0875c39c6bd0c6b9e6bfec2b1fd571d
Contents?: true
Size: 1.26 KB
Versions: 28
Compression:
Stored size: 1.26 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_parse(source).children.first described_class.new(node, erb_source, adapter: NodeMutation::ParserAdapter.new).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_parse(source).children.first described_class.new(node, erb_source, adapter: NodeMutation::ParserAdapter.new).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
28 entries across 28 versions & 1 rubygems