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,25 +80,38 @@ class FriendsControllerTest < Test::Unit::TestCase
80 assert_template 'invite' 80 assert_template 'invite'
81 end 81 end
82 82
83 - should 'actualy add invite' do 83 + should 'actualy invite manually added addresses with name and e-mail' do
84 assert_difference InviteFriend, :count, 1 do 84 assert_difference InviteFriend, :count, 1 do
85 post :invite, :manual_import_addresses => "Test Name <test@test.com>", :import_from => "manual", :message => "click: <url>", :confirmation => 1 85 post :invite, :manual_import_addresses => "Test Name <test@test.com>", :import_from => "manual", :message => "click: <url>", :confirmation => 1
86 assert_redirected_to :action => 'index' 86 assert_redirected_to :action => 'index'
87 end 87 end
  88 + end
88 89
  90 + should 'actually invite manually added address with only e-mail' do
89 assert_difference InviteFriend, :count, 1 do 91 assert_difference InviteFriend, :count, 1 do
90 post :invite, :manual_import_addresses => "test@test.com", :import_from => "manual", :message => "click: <url>", :confirmation => 1 92 post :invite, :manual_import_addresses => "test@test.com", :import_from => "manual", :message => "click: <url>", :confirmation => 1
91 assert_redirected_to :action => 'index' 93 assert_redirected_to :action => 'index'
92 end 94 end
  95 + end
93 96
  97 + should 'actually invite manually added addresses with e-mail and other format' do
94 assert_difference InviteFriend, :count, 1 do 98 assert_difference InviteFriend, :count, 1 do
95 post :invite, :manual_import_addresses => "test@test.cz.com", :import_from => "manual", :message => "click: <url>", :confirmation => 1 99 post :invite, :manual_import_addresses => "test@test.cz.com", :import_from => "manual", :message => "click: <url>", :confirmation => 1
96 assert_redirected_to :action => 'index' 100 assert_redirected_to :action => 'index'
97 end 101 end
  102 + end
98 103
  104 + should 'actually invite manually added address with friend object' do
99 assert_difference InviteFriend, :count, 1 do 105 assert_difference InviteFriend, :count, 1 do
100 post :invite, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "manual", :message => "click: <url>", :confirmation => 1 106 post :invite, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "manual", :message => "click: <url>", :confirmation => 1
101 assert_redirected_to :action => 'index' 107 assert_redirected_to :action => 'index'
102 end 108 end
103 end 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 end 117 end