2011-05-03 11:49:09 -04:00
|
|
|
describe Pry::Helpers::CommandHelpers do
|
|
|
|
before do
|
|
|
|
@helper = Pry::Helpers::CommandHelpers
|
|
|
|
end
|
|
|
|
|
2013-02-01 04:24:01 -05:00
|
|
|
describe "unindent" do
|
|
|
|
it "should remove the same prefix from all lines" do
|
2015-03-10 16:49:29 -04:00
|
|
|
expect(@helper.unindent(" one\n two\n")).to eq("one\ntwo\n")
|
2013-02-01 04:24:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should not be phased by empty lines" do
|
2015-03-10 16:49:29 -04:00
|
|
|
expect(@helper.unindent(" one\n\n two\n")).to eq("one\n\ntwo\n")
|
2013-02-01 04:24:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should only remove a common prefix" do
|
2015-03-10 16:49:29 -04:00
|
|
|
expect(@helper.unindent(" one\n two\n")).to eq(" one\ntwo\n")
|
2013-02-01 04:24:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should also remove tabs if present" do
|
2015-03-10 16:49:29 -04:00
|
|
|
expect(@helper.unindent("\tone\n\ttwo\n")).to eq("one\ntwo\n")
|
2013-02-01 04:24:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should ignore lines starting with --" do
|
2015-03-10 16:49:29 -04:00
|
|
|
expect(@helper.unindent(" one\n--\n two\n")).to eq("one\n--\ntwo\n")
|
2013-02-01 04:24:01 -05:00
|
|
|
end
|
|
|
|
end
|
2011-05-03 11:49:09 -04:00
|
|
|
end
|