Refactored Diff::Display classes
[gitorious:yousource.git] / vendor / diff-display / spec / renderer / base_spec.rb
1 require File.dirname(__FILE__) + '/../spec_helper.rb'
2
3 describe Diff::Renderer::Base do
4   
5   before(:each) do
6     @data = Diff::Display::Unified::Generator.run(load_diff("big"))
7     @base_renderer = Diff::Renderer::Base.new
8   end
9   
10   it "classifies a classname" do
11     @base_renderer.send(:classify, Diff::Display::RemBlock.new).should == "remblock"
12   end
13   
14   it "calls the before_headerblock" do
15     @base_renderer.expects(:before_headerblock).at_least_once
16     @base_renderer.render(@data)
17   end
18   
19   # it "calls the before_sepblock" do
20   #   @base_renderer.expects(:before_sepblock).at_least_once
21   #   @base_renderer.render(@data)
22   # end
23   
24   it "calls the before_modblock" do
25     @base_renderer.expects(:before_modblock).at_least_once
26     @base_renderer.render(@data)
27   end
28   
29   it "calls the before_unmodblock" do
30     @base_renderer.expects(:before_unmodblock).at_least_once
31     @base_renderer.render(@data)
32   end
33   
34   it "calls the before_addblock" do
35     @base_renderer.expects(:before_addblock).at_least_once
36     @base_renderer.render(@data)
37   end
38   
39   it "calls the before_remblock" do
40     @base_renderer.expects(:before_remblock).at_least_once
41     @base_renderer.render(@data)
42   end
43   
44   it "calls headerline" do
45     @base_renderer.expects(:headerline).at_least_once
46     @base_renderer.render(@data)
47   end
48   
49   it "calls unmodline" do
50     @base_renderer.expects(:unmodline).at_least_once
51     @base_renderer.render(@data)
52   end  
53   
54   it "calls addline" do
55     @base_renderer.expects(:addline).at_least_once
56     @base_renderer.render(@data)
57   end
58   
59   it "calls remline" do
60     @base_renderer.expects(:remline).at_least_once
61     @base_renderer.render(@data)
62   end
63   
64   it "calls the after_headerblock" do
65     @base_renderer.expects(:after_headerblock).at_least_once
66     @base_renderer.render(@data)
67   end
68   
69   # it "calls the after_sepblock" do
70   #   @base_renderer.expects(:after_sepblock).at_least_once
71   #   @base_renderer.render(@data)
72   # end
73   
74   it "calls the after_modblock" do
75     @base_renderer.expects(:after_modblock).at_least_once
76     @base_renderer.render(@data)
77   end
78   
79   it "calls the after_unmodblock" do
80     @base_renderer.expects(:after_unmodblock).at_least_once
81     @base_renderer.render(@data)
82   end
83   
84   it "calls the after_addblock" do
85     @base_renderer.expects(:after_addblock).at_least_once
86     @base_renderer.render(@data)
87   end
88   
89   it "calls the after_remblock" do
90     @base_renderer.expects(:after_remblock).at_least_once
91     @base_renderer.render(@data)
92   end
93   
94   it "renders a basic datastructure" do
95     output = @base_renderer.render(@data)
96     output.should_not == nil
97   end
98 end