Commit 5494235237c47ae58ef2d9753316f59bf4736e12
1 parent
c97dfe83
Exists in
master
and in
28 other branches
Fixing tests
Showing
4 changed files
with
22 additions
and
8 deletions
Show diff stats
app/models/forum.rb
features/profile_activities.feature
| ... | ... | @@ -7,15 +7,17 @@ Feature: list activities of a profile |
| 7 | 7 | | login | name | |
| 8 | 8 | | joaosilva | Joao Silva | |
| 9 | 9 | And the following articles |
| 10 | - | owner | name | body | | |
| 11 | - | booking | article to comment | first paragraph | | |
| 10 | + | owner | name | body | | |
| 11 | + | joaosilva | article to comment | first paragraph | | |
| 12 | 12 | And the following comments |
| 13 | - | article | author | title | body | | |
| 14 | - | article with comment | booking | hi | how are you? | | |
| 13 | + | article | author | title | body | | |
| 14 | + | article to comment | joaosilva | hi | how are you? | | |
| 15 | 15 | |
| 16 | 16 | Scenario: see the activity of a profile |
| 17 | 17 | Given I am logged in as "joaosilva" |
| 18 | - When I go to Jose Silva's homepage | |
| 18 | + When I go to Joao Silva's homepage | |
| 19 | +#Não tá rodando o delayed job :( | |
| 20 | +Then I should see "dkjfhv" | |
| 19 | 21 | Then I should see "first paragraph" within ".profile-activity-item" |
| 20 | 22 | And I should see "how are you?" within ".profile-wall-activities-comments" |
| 21 | 23 | ... | ... |
test/functional/profile_controller_test.rb
| ... | ... | @@ -1306,7 +1306,7 @@ class ProfileControllerTest < ActionController::TestCase |
| 1306 | 1306 | count = activity.comments.count |
| 1307 | 1307 | |
| 1308 | 1308 | assert_equal 0, count |
| 1309 | - post :leave_comment_on_activity, :profile => profile.identifier, :comment => {:body => 'something', :source_id => activity.id} | |
| 1309 | + post :leave_comment_on_activity, :profile => profile.identifier, :comment => {:body => 'something'}, :source_id => activity.id | |
| 1310 | 1310 | assert_equal count + 1, activity.comments.count |
| 1311 | 1311 | assert_response :success |
| 1312 | 1312 | assert_equal "Comment successfully added.", assigns(:message) |
| ... | ... | @@ -1318,9 +1318,9 @@ class ProfileControllerTest < ActionController::TestCase |
| 1318 | 1318 | TinyMceArticle.create!(:profile => another_person, :name => 'An article about free software') |
| 1319 | 1319 | activity = ActionTracker::Record.last |
| 1320 | 1320 | count = activity.comments.count |
| 1321 | - | |
| 1321 | +puts activity.inspect | |
| 1322 | 1322 | assert_equal 0, count |
| 1323 | - post :leave_comment_on_activity, :profile => another_person.identifier, :comment => {:body => 'something', :source_id => activity.id} | |
| 1323 | + post :leave_comment_on_activity, :profile => another_person.identifier, :comment => {:body => 'something'}, :source_id => activity.id | |
| 1324 | 1324 | assert_equal count + 1, activity.comments.count |
| 1325 | 1325 | assert_response :success |
| 1326 | 1326 | assert_equal "Comment successfully added.", assigns(:message) | ... | ... |
test/unit/forum_test.rb
| ... | ... | @@ -122,4 +122,15 @@ class ForumTest < ActiveSupport::TestCase |
| 122 | 122 | f = fast_create(Forum, :body => 'Nothing to do here') |
| 123 | 123 | assert_equal '', f.first_paragraph |
| 124 | 124 | end |
| 125 | + | |
| 126 | + should 'provide first_paragraph even if body was not given' do | |
| 127 | + f = fast_create(Forum) | |
| 128 | + assert_equal '', f.first_paragraph | |
| 129 | + end | |
| 130 | + | |
| 131 | + should 'provide first_paragraph even if body is nil' do | |
| 132 | + f = fast_create(Forum, :body => nil) | |
| 133 | + assert_equal '', f.first_paragraph | |
| 134 | + end | |
| 135 | + | |
| 125 | 136 | end | ... | ... |