Commit 78366cacb7258e9899765527b3acc1aaede11c53

Authored by Antonio Terceiro
1 parent f24ef96b

ActionItem910: a better organization of the tests

Also added a new test for the case where more than one e-mail is
specified in the textarea.
Showing 1 changed file with 14 additions and 1 deletions   Show diff stats
test/functional/friends_controller_test.rb
... ... @@ -80,25 +80,38 @@ class FriendsControllerTest < Test::Unit::TestCase
80 80 assert_template 'invite'
81 81 end
82 82  
83   - should 'actualy add invite' do
  83 + should 'actualy invite manually added addresses with name and e-mail' do
84 84 assert_difference InviteFriend, :count, 1 do
85 85 post :invite, :manual_import_addresses => "Test Name <test@test.com>", :import_from => "manual", :message => "click: <url>", :confirmation => 1
86 86 assert_redirected_to :action => 'index'
87 87 end
  88 + end
88 89  
  90 + should 'actually invite manually added address with only e-mail' do
89 91 assert_difference InviteFriend, :count, 1 do
90 92 post :invite, :manual_import_addresses => "test@test.com", :import_from => "manual", :message => "click: <url>", :confirmation => 1
91 93 assert_redirected_to :action => 'index'
92 94 end
  95 + end
93 96  
  97 + should 'actually invite manually added addresses with e-mail and other format' do
94 98 assert_difference InviteFriend, :count, 1 do
95 99 post :invite, :manual_import_addresses => "test@test.cz.com", :import_from => "manual", :message => "click: <url>", :confirmation => 1
96 100 assert_redirected_to :action => 'index'
97 101 end
  102 + end
98 103  
  104 + should 'actually invite manually added address with friend object' do
99 105 assert_difference InviteFriend, :count, 1 do
100 106 post :invite, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "manual", :message => "click: <url>", :confirmation => 1
101 107 assert_redirected_to :action => 'index'
102 108 end
103 109 end
  110 +
  111 + should 'actually invite more than one manually added addres' do
  112 + assert_difference InviteFriend, :count, 2 do
  113 + post :invite, :manual_import_addresses => "Some Friend <somefriend@email.com>\r\notherperson@bleble.net\r\n", :import_from => "manual", :message => "click: <url>", :confirmation => 1
  114 + assert_redirected_to :action => 'index'
  115 + end
  116 + end
104 117 end
... ...