1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
require 'spec_helper'
describe Temple::Filters::CodeMerger do
before do
@filter = Temple::Filters::CodeMerger.new
end
it 'should merge serveral codes' do
expect(@filter.call([:multi,
[:code, "a"],
[:code, "b"],
[:code, "c"]
])).to eq [:code, "a; b; c"]
end
it 'should merge serveral codes around static' do
expect(@filter.call([:multi,
[:code, "a"],
[:code, "b"],
[:static, "123"],
[:code, "a"],
[:code, "b"]
])).to eq [:multi,
[:code, "a; b"],
[:static, "123"],
[:code, "a; b"]
]
end
it 'should merge serveral codes with newlines' do
expect(@filter.call([:multi,
[:code, "a"],
[:code, "b"],
[:newline],
[:code, "c"]
])).to eq [:code, "a; b\nc"]
end
end
|