-
Notifications
You must be signed in to change notification settings - Fork 1
/
_legend.html.erb_spec.rb
68 lines (60 loc) · 2.55 KB
/
_legend.html.erb_spec.rb
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe "/features/_legend.html.erb" do
context "display for file changes" do
before(:each) do
render :locals => {:diff_from => "file", :diff_to => "file"}
end
it "should have a legend displaying system changes as green" do
response.should have_selector :span, attribute = {:id => "legend"} do |legend_wrapper|
legend_wrapper.should have_selector :span, attribute = {:class => "gd"} do |content|
content.should contain "Removing from file"
end
end
end
it "should have a legend displaying file changes as red" do
response.should have_selector :span, attribute = {:id => "legend"} do |legend_wrapper|
legend_wrapper.should have_selector :span, attribute = {:class => "gi"} do |content|
content.should contain "Adding to file"
end
end
end
end
context "display for system changes" do
before(:each) do
render :locals => {:diff_from => "system", :diff_to => "system"}
end
it "should have a legend displaying system changes as green" do
response.should have_selector :span, attribute = {:id => "legend"} do |legend_wrapper|
legend_wrapper.should have_selector :span, attribute = {:class => "gi"} do |content|
content.should contain "Adding to system"
end
end
end
it "should have a legend displaying file changes as red" do
response.should have_selector :span, attribute = {:id => "legend"} do |legend_wrapper|
legend_wrapper.should have_selector :span, attribute = {:class => "gd"} do |content|
content.should contain "Removing from system"
end
end
end
end
context "passing a change parameter" do
before(:each) do
render :locals => {:diff_from => "system", :diff_to => "file", :change => true}
end
it "should display a different copy for changes to the system" do
response.should have_selector :span, attribute = {:id => "legend"} do |legend_wrapper|
legend_wrapper.should have_selector :span, attribute = {:class => "gd"} do |content|
content.should contain "Changes to the system"
end
end
end
it "should display a different copy for changes to the file" do
response.should have_selector :span, attribute = {:id => "legend"} do |legend_wrapper|
legend_wrapper.should have_selector :span, attribute = {:class => "gi"} do |content|
content.should contain "Changes to the file"
end
end
end
end
end