require 'test_helper'

class UsersControllerTest < ActionController::TestCase
  def test_should_redirect_on_creation
    post :create, :user => {
      :name => 'Root',
      :email => 'root@rails'
    }
    assert_response :redirect
  end

  def test_should_show_all_ads
    get :show, :id => users(:one)
    assert_response :success
    assert_template 'show'
    assert_select 'p', :count => 3
  end

  def test_should_get_show
    get :show, :id => users(:one).id
    assert_response :success
    get :show, :id => users(:one).to_param
    assert_response :success
    assert_not_equal users(:one).id, users(:one).to_param
  end

  def test_should_show_all_users
    get :index
    assert_response :success
    assert_template 'index'
    assert_select 'p', :count => 2
  end
end
