Permalink
Browse files

- Changes in part_extensions#to_content so it can receive a none

  xistin part name without raise an exception

- Fixed a cucumber step.
  • Loading branch information...
rochgs committed Sep 8, 2011
1 parent 1d193e1 commit 3e27cdd4c547c953c9ba588fc7c97782d0e2d66f
Showing with 9 additions and 7 deletions.
  1. +2 −2 features/manage_snippets.feature
  2. +7 −5 lib/extensions/page_extensions.rb
@@ -21,7 +21,7 @@ Feature: Snippets
And I follow "Add New Snippet"
And I fill in "Title" with "This is a test of the first string field"
And I press "Save"
- Then I should see "'This is a test of the first string field' was successfully added."
+ Then I should see "This is a test of the first string field was successfully added."
And I should have 1 snippet
@snippets-invalid @invalid
@@ -60,4 +60,4 @@ Feature: Snippets
And I follow "Remove this snippet forever"
Then I should see "'UniqueTitleOne' was successfully removed."
And I should have 0 snippets
-
+
@@ -28,11 +28,13 @@ def content_for(part_title)
part.title.downcase.gsub(" ", "_") == part_title.to_s.downcase.gsub(" ", "_")
end
- content = ""
- content += part.snippets.before.map{|snippet| snippet.try(:body)}.join
- part_body = part.try(:body)
- content += part_body unless part_body.nil?
- content += part.snippets.after.map{|snippet| snippet.try(:body)}.join
+ if part
+ content = ""
+ content += part.snippets.before.map{|snippet| snippet.try(:body)}.join
+ part_body = part.try(:body)
+ content += part_body unless part_body.nil?
+ content += part.snippets.after.map{|snippet| snippet.try(:body)}.join
+ end
end
def snippets

0 comments on commit 3e27cdd

Please sign in to comment.