summaryrefslogtreecommitdiff
path: root/spec/syntax_suggest/unit/capture_code_context_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/syntax_suggest/unit/capture_code_context_spec.rb')
-rw-r--r--spec/syntax_suggest/unit/capture_code_context_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/syntax_suggest/unit/capture_code_context_spec.rb b/spec/syntax_suggest/unit/capture_code_context_spec.rb
index 1563149b3c..46f13e8961 100644
--- a/spec/syntax_suggest/unit/capture_code_context_spec.rb
+++ b/spec/syntax_suggest/unit/capture_code_context_spec.rb
@@ -4,6 +4,32 @@ require_relative "../spec_helper"
module SyntaxSuggest
RSpec.describe CaptureCodeContext do
+ it "capture_before_after_kws two" do
+ source = <<~'EOM'
+ class OH
+
+ def hello
+
+ def hai
+ end
+ end
+ EOM
+
+ code_lines = CleanDocument.new(source: source).call.lines
+ block = CodeBlock.new(lines: code_lines[2])
+
+ display = CaptureCodeContext.new(
+ blocks: [block],
+ code_lines: code_lines
+ )
+ display.capture_before_after_kws(block)
+ expect(display.sorted_lines.join).to eq(<<~'EOM'.indent(2))
+ def hello
+ def hai
+ end
+ EOM
+ end
+
it "capture_before_after_kws" do
source = <<~'EOM'
def sit