class EmailControllerTest < Test::Unit::TestCase
  include ProfileHelper
  fixtures :users, :specs
  
  def setup
    .
    .
    .
    @user = users(:valid_user)
    @friend = users(:friend)
    # Dopilnuj, aby e-maile nie byy faktycznie wysyane!
    ActionMailer::Base.delivery_method = :test
  end
  .
  .
  .  
  def test_correspond
    authorize @user
    post :correspond, :id => @friend.screen_name,
                      :message => { :subject => "Test message",
                                    :body => "Dude, this is totally rad!" }
    assert_response :redirect
    assert_redirected_to profile_for(@friend)
    assert_equal "E-mail zosta wysany.", flash[:notice]
    assert_equal 1, @emails.length
  end  
end

