Changeset 283
- Timestamp:
- 10/25/08 10:05:58 (2 months ago)
- Files:
-
- nethorus/app/helpers/application_helper.rb (modified) (1 diff)
- nethorus/spec/helpers/application_helper_spec.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
nethorus/app/helpers/application_helper.rb
r276 r283 52 52 53 53 def format_l3_interface(l2_interface) 54 55 54 56 55 # Check we've really been passed an L2Interface object nethorus/spec/helpers/application_helper_spec.rb
r280 r283 45 45 46 46 it "should correctly generate a page subtitle, even when blank" do 47 params[:controller] = "foobar_controller" 48 params[:action] = "index" 49 generate_title_line_2.should eql("Foobar_controller") 50 51 params[:controller] = "foobar" 52 generate_title_line_2.should eql("Foobar") 53 54 params[:action] = "baz" 55 generate_title_line_2.should eql("Foobar: Baz") 56 47 57 @subtitle = "foobar" 48 58 generate_title_line_2.should eql("foobar") … … 130 140 # TODO: Write tests for link_to_controller 131 141 # TODO: Write tests for format_l2_interface 132 # TODO: Write tests for format_interface_name 142 143 it "should return 'none' if no Layer 2 interface address is passed, otherwise return the Layer 2 interface address" do 144 format_l2_interface(nil).should eql("none") 145 format_l2_interface("").should eql("none") 146 format_l2_interface("foobar").should eql("foobar") 147 end 148 149 it "should return an empty string if no interface name is passed, the interface name if the description is blank, or the interface name and description if both have been passed" do 150 format_interface_name(nil, nil).should eql("") 151 format_interface_name("", "").should eql("") 152 format_interface_name("foo", "").should eql("foo") 153 format_interface_name("", "bar").should eql("") 154 format_interface_name("foo", "bar").should eql("foo (bar)") 155 end 156 157 it "should return 'Unknown' for an unknown Layer 2 interface type, otherwise return the interface type" do 158 format_l2_interface_type(nil).should eql("Unknown") 159 format_l2_interface_type("").should eql("Unknown") 160 format_l2_interface_type("foobar").should eql("foobar") 161 end 162 163 133 164 # TODO: Write tests for format_site 134 # TODO: Write tests for format_l2_interface_type135 165 # TODO: Write tests for remaining functions in generate_title_line_2 136 166 end
