require File.join(File.dirname(__FILE__), %w".. .. spec_helper") describe Redcar::Document::Indentation do class MockDoc def initialize(string) @string = string end def get_line(ix) lines[ix] + "\n" end def offset_at_line(ix) return 0 if ix == 0 lines[0..(ix - 1)].join("\n").length + 1 end def delim "\n" end private def lines @string.split("\n") end end describe "#get_level" do it "should report indent correctly" do ind = Redcar::Document::Indentation.new(MockDoc.new(<