Permalink
Browse files

fixed formatting of status text when the status doesn't even exist

  • Loading branch information...
1 parent 6905c5f commit 03b457bcdc0ee722d9173f98e39369ad00504aef @srushti srushti committed Oct 6, 2011
Showing with 5 additions and 1 deletion.
  1. +1 −1 app/helpers/application_helper.rb
  2. +4 −0 spec/helpers/application_helper_spec.rb
@@ -8,7 +8,7 @@ def build_status(build)
end
def status(s)
- s.gsub(/ /, '_')
+ s ? s.gsub(/ /, '_') : 'unknown'
end
def format_timestamp(timestamp)
@@ -6,6 +6,10 @@
helper.build_status(mock(Build, :status => 'build passed')).should == "build_passed"
end
+ it "reports on unknown status" do
+ helper.project_status(mock(Project, :latest_build_status => nil)).should == 'unknown'
+ end
+
it "formats timestamp" do
helper.format_timestamp(2.days.ago).should == "<span class=\"timestamp\" title=\"#{2.days.ago.strftime('%a, %Y/%m/%d %I:%M%p %Z')}\">2 days ago</span>"
end

0 comments on commit 03b457b

Please sign in to comment.