File: code_merger_spec.rb

package info (click to toggle)
ruby-temple 0.10.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 476 kB
  • sloc: ruby: 3,347; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (2)
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