Grosse MàJ
This commit is contained in:
		
							
								
								
									
										17
									
								
								P5B/ruby/3dossmanno_annuaire/test/fixtures/users.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								P5B/ruby/3dossmanno_annuaire/test/fixtures/users.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
quentin:
 | 
			
		||||
  id: 1
 | 
			
		||||
  login: quentin
 | 
			
		||||
  email: quentin@example.com
 | 
			
		||||
  salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
 | 
			
		||||
  crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
 | 
			
		||||
  created_at: <%= 5.days.ago.to_s :db %>
 | 
			
		||||
  activation_code: 8f24789ae988411ccf33ab0c30fe9106fab32e9b 
 | 
			
		||||
  activated_at: <%= 5.days.ago.to_s :db %> 
 | 
			
		||||
aaron:
 | 
			
		||||
  id: 2
 | 
			
		||||
  login: aaron
 | 
			
		||||
  email: aaron@example.com
 | 
			
		||||
  salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
 | 
			
		||||
  crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
 | 
			
		||||
  created_at: <%= 1.days.ago.to_s :db %>
 | 
			
		||||
  activation_code: 8f24789ae988411ccf33ab0c30fe9106fab32e9a 
 | 
			
		||||
							
								
								
									
										25
									
								
								P5B/ruby/3dossmanno_annuaire/test/fixtures/utilisateurs.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								P5B/ruby/3dossmanno_annuaire/test/fixtures/utilisateurs.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 | 
			
		||||
one:
 | 
			
		||||
  id: 1
 | 
			
		||||
  nom: PFALZGRAF
 | 
			
		||||
  prenom: Christian
 | 
			
		||||
  classe: LPCDED
 | 
			
		||||
  email: christian@pfalzy.net
 | 
			
		||||
  age: 24
 | 
			
		||||
  rue: 
 | 
			
		||||
  codePostal: 
 | 
			
		||||
  ville: 
 | 
			
		||||
  photo: 
 | 
			
		||||
  type:
 | 
			
		||||
two:
 | 
			
		||||
  id: 2
 | 
			
		||||
  nom: DOSSMANN
 | 
			
		||||
  prenom: Olivier
 | 
			
		||||
  classe: LPCDED
 | 
			
		||||
  email: f@f.f
 | 
			
		||||
  age: 23
 | 
			
		||||
  rue: 3, rue des platanes
 | 
			
		||||
  codePostal: 67550
 | 
			
		||||
  ville: VENDENHEIM
 | 
			
		||||
  photo:
 | 
			
		||||
  type: 
 | 
			
		||||
@@ -0,0 +1,85 @@
 | 
			
		||||
require File.dirname(__FILE__) + '/../test_helper'
 | 
			
		||||
require 'sessions_controller'
 | 
			
		||||
 | 
			
		||||
# Re-raise errors caught by the controller.
 | 
			
		||||
class SessionsController; def rescue_action(e) raise e end; end
 | 
			
		||||
 | 
			
		||||
class SessionsControllerTest < Test::Unit::TestCase
 | 
			
		||||
  # Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead
 | 
			
		||||
  # Then, you can remove it from this and the units test.
 | 
			
		||||
  include AuthenticatedTestHelper
 | 
			
		||||
 | 
			
		||||
  fixtures :users
 | 
			
		||||
 | 
			
		||||
  def setup
 | 
			
		||||
    @controller = SessionsController.new
 | 
			
		||||
    @request    = ActionController::TestRequest.new
 | 
			
		||||
    @response   = ActionController::TestResponse.new
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_login_and_redirect
 | 
			
		||||
    post :create, :login => 'quentin', :password => 'test'
 | 
			
		||||
    assert session[:user]
 | 
			
		||||
    assert_response :redirect
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_fail_login_and_not_redirect
 | 
			
		||||
    post :create, :login => 'quentin', :password => 'bad password'
 | 
			
		||||
    assert_nil session[:user]
 | 
			
		||||
    assert_response :success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_logout
 | 
			
		||||
    login_as :quentin
 | 
			
		||||
    get :destroy
 | 
			
		||||
    assert_nil session[:user]
 | 
			
		||||
    assert_response :redirect
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_remember_me
 | 
			
		||||
    post :create, :login => 'quentin', :password => 'test', :remember_me => "1"
 | 
			
		||||
    assert_not_nil @response.cookies["auth_token"]
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_not_remember_me
 | 
			
		||||
    post :create, :login => 'quentin', :password => 'test', :remember_me => "0"
 | 
			
		||||
    assert_nil @response.cookies["auth_token"]
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  def test_should_delete_token_on_logout
 | 
			
		||||
    login_as :quentin
 | 
			
		||||
    get :destroy
 | 
			
		||||
    assert_equal @response.cookies["auth_token"], []
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_login_with_cookie
 | 
			
		||||
    users(:quentin).remember_me
 | 
			
		||||
    @request.cookies["auth_token"] = cookie_for(:quentin)
 | 
			
		||||
    get :new
 | 
			
		||||
    assert @controller.send(:logged_in?)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_fail_expired_cookie_login
 | 
			
		||||
    users(:quentin).remember_me
 | 
			
		||||
    users(:quentin).update_attribute :remember_token_expires_at, 5.minutes.ago
 | 
			
		||||
    @request.cookies["auth_token"] = cookie_for(:quentin)
 | 
			
		||||
    get :new
 | 
			
		||||
    assert !@controller.send(:logged_in?)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_fail_cookie_login
 | 
			
		||||
    users(:quentin).remember_me
 | 
			
		||||
    @request.cookies["auth_token"] = auth_token('invalid_auth_token')
 | 
			
		||||
    get :new
 | 
			
		||||
    assert !@controller.send(:logged_in?)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  protected
 | 
			
		||||
    def auth_token(token)
 | 
			
		||||
      CGI::Cookie.new('name' => 'auth_token', 'value' => token)
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    def cookie_for(user)
 | 
			
		||||
      auth_token users(user).remember_token
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
@@ -0,0 +1,86 @@
 | 
			
		||||
require File.dirname(__FILE__) + '/../test_helper'
 | 
			
		||||
require 'users_controller'
 | 
			
		||||
 | 
			
		||||
# Re-raise errors caught by the controller.
 | 
			
		||||
class UsersController; def rescue_action(e) raise e end; end
 | 
			
		||||
 | 
			
		||||
class UsersControllerTest < Test::Unit::TestCase
 | 
			
		||||
  # Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead
 | 
			
		||||
  # Then, you can remove it from this and the units test.
 | 
			
		||||
  include AuthenticatedTestHelper
 | 
			
		||||
 | 
			
		||||
  fixtures :users
 | 
			
		||||
 | 
			
		||||
  def setup
 | 
			
		||||
    @controller = UsersController.new
 | 
			
		||||
    @request    = ActionController::TestRequest.new
 | 
			
		||||
    @response   = ActionController::TestResponse.new
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_allow_signup
 | 
			
		||||
    assert_difference 'User.count' do
 | 
			
		||||
      create_user
 | 
			
		||||
      assert_response :redirect
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_require_login_on_signup
 | 
			
		||||
    assert_no_difference 'User.count' do
 | 
			
		||||
      create_user(:login => nil)
 | 
			
		||||
      assert assigns(:user).errors.on(:login)
 | 
			
		||||
      assert_response :success
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_require_password_on_signup
 | 
			
		||||
    assert_no_difference 'User.count' do
 | 
			
		||||
      create_user(:password => nil)
 | 
			
		||||
      assert assigns(:user).errors.on(:password)
 | 
			
		||||
      assert_response :success
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_require_password_confirmation_on_signup
 | 
			
		||||
    assert_no_difference 'User.count' do
 | 
			
		||||
      create_user(:password_confirmation => nil)
 | 
			
		||||
      assert assigns(:user).errors.on(:password_confirmation)
 | 
			
		||||
      assert_response :success
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_require_email_on_signup
 | 
			
		||||
    assert_no_difference 'User.count' do
 | 
			
		||||
      create_user(:email => nil)
 | 
			
		||||
      assert assigns(:user).errors.on(:email)
 | 
			
		||||
      assert_response :success
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  def test_should_activate_user
 | 
			
		||||
    assert_nil User.authenticate('aaron', 'test')
 | 
			
		||||
    get :activate, :activation_code => users(:aaron).activation_code
 | 
			
		||||
    assert_redirected_to '/'
 | 
			
		||||
    assert_not_nil flash[:notice]
 | 
			
		||||
    assert_equal users(:aaron), User.authenticate('aaron', 'test')
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  def test_should_not_activate_user_without_key
 | 
			
		||||
    get :activate
 | 
			
		||||
    assert_nil flash[:notice]
 | 
			
		||||
  rescue ActionController::RoutingError
 | 
			
		||||
    # in the event your routes deny this, we'll just bow out gracefully.
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_not_activate_user_with_blank_key
 | 
			
		||||
    get :activate, :activation_code => ''
 | 
			
		||||
    assert_nil flash[:notice]
 | 
			
		||||
  rescue ActionController::RoutingError
 | 
			
		||||
    # well played, sir
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  protected
 | 
			
		||||
    def create_user(options = {})
 | 
			
		||||
      post :create, :user => { :login => 'quire', :email => 'quire@example.com',
 | 
			
		||||
        :password => 'quire', :password_confirmation => 'quire' }.merge(options)
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
@@ -0,0 +1,57 @@
 | 
			
		||||
require File.dirname(__FILE__) + '/../test_helper'
 | 
			
		||||
require 'utilisateurs_controller'
 | 
			
		||||
 | 
			
		||||
# Re-raise errors caught by the controller.
 | 
			
		||||
class UtilisateursController; def rescue_action(e) raise e end; end
 | 
			
		||||
 | 
			
		||||
class UtilisateursControllerTest < Test::Unit::TestCase
 | 
			
		||||
  fixtures :utilisateurs
 | 
			
		||||
 | 
			
		||||
  def setup
 | 
			
		||||
    @controller = UtilisateursController.new
 | 
			
		||||
    @request    = ActionController::TestRequest.new
 | 
			
		||||
    @response   = ActionController::TestResponse.new
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_get_index
 | 
			
		||||
    get :index
 | 
			
		||||
    assert_response :success
 | 
			
		||||
    assert assigns(:utilisateurs)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_get_new
 | 
			
		||||
    get :new
 | 
			
		||||
    assert_response :success
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  def test_should_create_utilisateur
 | 
			
		||||
    old_count = Utilisateur.count
 | 
			
		||||
    post :create, :utilisateur => { }
 | 
			
		||||
    assert_equal old_count+1, Utilisateur.count
 | 
			
		||||
    
 | 
			
		||||
    assert_redirected_to utilisateur_path(assigns(:utilisateur))
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_show_utilisateur
 | 
			
		||||
    get :show, :id => 1
 | 
			
		||||
    assert_response :success
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_get_edit
 | 
			
		||||
    get :edit, :id => 1
 | 
			
		||||
    assert_response :success
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  def test_should_update_utilisateur
 | 
			
		||||
    put :update, :id => 1, :utilisateur => { }
 | 
			
		||||
    assert_redirected_to utilisateur_path(assigns(:utilisateur))
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  def test_should_destroy_utilisateur
 | 
			
		||||
    old_count = Utilisateur.count
 | 
			
		||||
    delete :destroy, :id => 1
 | 
			
		||||
    assert_equal old_count-1, Utilisateur.count
 | 
			
		||||
    
 | 
			
		||||
    assert_redirected_to utilisateurs_path
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										28
									
								
								P5B/ruby/3dossmanno_annuaire/test/test_helper.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								P5B/ruby/3dossmanno_annuaire/test/test_helper.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
ENV["RAILS_ENV"] = "test"
 | 
			
		||||
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
 | 
			
		||||
require 'test_help'
 | 
			
		||||
 | 
			
		||||
class Test::Unit::TestCase
 | 
			
		||||
  # Transactional fixtures accelerate your tests by wrapping each test method
 | 
			
		||||
  # in a transaction that's rolled back on completion.  This ensures that the
 | 
			
		||||
  # test database remains unchanged so your fixtures don't have to be reloaded
 | 
			
		||||
  # between every test method.  Fewer database queries means faster tests.
 | 
			
		||||
  #
 | 
			
		||||
  # Read Mike Clark's excellent walkthrough at
 | 
			
		||||
  #   http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
 | 
			
		||||
  #
 | 
			
		||||
  # Every Active Record database supports transactions except MyISAM tables
 | 
			
		||||
  # in MySQL.  Turn off transactional fixtures in this case; however, if you
 | 
			
		||||
  # don't care one way or the other, switching from MyISAM to InnoDB tables
 | 
			
		||||
  # is recommended.
 | 
			
		||||
  self.use_transactional_fixtures = true
 | 
			
		||||
 | 
			
		||||
  # Instantiated fixtures are slow, but give you @david where otherwise you
 | 
			
		||||
  # would need people(:david).  If you don't want to migrate your existing
 | 
			
		||||
  # test cases which use the @david style and don't mind the speed hit (each
 | 
			
		||||
  # instantiated fixtures translates to a database query per test method),
 | 
			
		||||
  # then set this back to true.
 | 
			
		||||
  self.use_instantiated_fixtures  = false
 | 
			
		||||
 | 
			
		||||
  # Add more helper methods to be used by all tests here...
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										31
									
								
								P5B/ruby/3dossmanno_annuaire/test/unit/user_mailer_test.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								P5B/ruby/3dossmanno_annuaire/test/unit/user_mailer_test.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
require File.dirname(__FILE__) + '/../test_helper'
 | 
			
		||||
require 'user_mailer'
 | 
			
		||||
 | 
			
		||||
class UserMailerTest < Test::Unit::TestCase
 | 
			
		||||
  FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
 | 
			
		||||
  CHARSET = "utf-8"
 | 
			
		||||
 | 
			
		||||
  include ActionMailer::Quoting
 | 
			
		||||
 | 
			
		||||
  def setup
 | 
			
		||||
    ActionMailer::Base.delivery_method = :test
 | 
			
		||||
    ActionMailer::Base.perform_deliveries = true
 | 
			
		||||
    ActionMailer::Base.deliveries = []
 | 
			
		||||
 | 
			
		||||
    @expected = TMail::Mail.new
 | 
			
		||||
    @expected.set_content_type "text", "plain", { "charset" => CHARSET }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_dummy_test
 | 
			
		||||
    #do nothing
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  private
 | 
			
		||||
    def read_fixture(action)
 | 
			
		||||
      IO.readlines("#{FIXTURES_PATH}/user_mailer/#{action}")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def encode(subject)
 | 
			
		||||
      quoted_printable(subject, CHARSET)
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										101
									
								
								P5B/ruby/3dossmanno_annuaire/test/unit/user_test.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								P5B/ruby/3dossmanno_annuaire/test/unit/user_test.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,101 @@
 | 
			
		||||
require File.dirname(__FILE__) + '/../test_helper'
 | 
			
		||||
 | 
			
		||||
class UserTest < Test::Unit::TestCase
 | 
			
		||||
  # Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead.
 | 
			
		||||
  # Then, you can remove it from this and the functional test.
 | 
			
		||||
  include AuthenticatedTestHelper
 | 
			
		||||
  fixtures :users
 | 
			
		||||
 | 
			
		||||
  def test_should_create_user
 | 
			
		||||
    assert_difference 'User.count' do
 | 
			
		||||
      user = create_user
 | 
			
		||||
      assert !user.new_record?, "#{user.errors.full_messages.to_sentence}"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_require_login
 | 
			
		||||
    assert_no_difference 'User.count' do
 | 
			
		||||
      u = create_user(:login => nil)
 | 
			
		||||
      assert u.errors.on(:login)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_require_password
 | 
			
		||||
    assert_no_difference 'User.count' do
 | 
			
		||||
      u = create_user(:password => nil)
 | 
			
		||||
      assert u.errors.on(:password)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_require_password_confirmation
 | 
			
		||||
    assert_no_difference 'User.count' do
 | 
			
		||||
      u = create_user(:password_confirmation => nil)
 | 
			
		||||
      assert u.errors.on(:password_confirmation)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_require_email
 | 
			
		||||
    assert_no_difference 'User.count' do
 | 
			
		||||
      u = create_user(:email => nil)
 | 
			
		||||
      assert u.errors.on(:email)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_reset_password
 | 
			
		||||
    users(:quentin).update_attributes(:password => 'new password', :password_confirmation => 'new password')
 | 
			
		||||
    assert_equal users(:quentin), User.authenticate('quentin', 'new password')
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_not_rehash_password
 | 
			
		||||
    users(:quentin).update_attributes(:login => 'quentin2')
 | 
			
		||||
    assert_equal users(:quentin), User.authenticate('quentin2', 'test')
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_authenticate_user
 | 
			
		||||
    assert_equal users(:quentin), User.authenticate('quentin', 'test')
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_set_remember_token
 | 
			
		||||
    users(:quentin).remember_me
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token_expires_at
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_unset_remember_token
 | 
			
		||||
    users(:quentin).remember_me
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token
 | 
			
		||||
    users(:quentin).forget_me
 | 
			
		||||
    assert_nil users(:quentin).remember_token
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_remember_me_for_one_week
 | 
			
		||||
    before = 1.week.from_now.utc
 | 
			
		||||
    users(:quentin).remember_me_for 1.week
 | 
			
		||||
    after = 1.week.from_now.utc
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token_expires_at
 | 
			
		||||
    assert users(:quentin).remember_token_expires_at.between?(before, after)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_remember_me_until_one_week
 | 
			
		||||
    time = 1.week.from_now.utc
 | 
			
		||||
    users(:quentin).remember_me_until time
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token_expires_at
 | 
			
		||||
    assert_equal users(:quentin).remember_token_expires_at, time
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_should_remember_me_default_two_weeks
 | 
			
		||||
    before = 2.weeks.from_now.utc
 | 
			
		||||
    users(:quentin).remember_me
 | 
			
		||||
    after = 2.weeks.from_now.utc
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token
 | 
			
		||||
    assert_not_nil users(:quentin).remember_token_expires_at
 | 
			
		||||
    assert users(:quentin).remember_token_expires_at.between?(before, after)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  protected
 | 
			
		||||
    def create_user(options = {})
 | 
			
		||||
      User.create({ :login => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire' }.merge(options))
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										10
									
								
								P5B/ruby/3dossmanno_annuaire/test/unit/utilisateur_test.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								P5B/ruby/3dossmanno_annuaire/test/unit/utilisateur_test.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
require File.dirname(__FILE__) + '/../test_helper'
 | 
			
		||||
 | 
			
		||||
class UtilisateurTest < Test::Unit::TestCase
 | 
			
		||||
  fixtures :utilisateurs
 | 
			
		||||
 | 
			
		||||
  # Replace this with your real tests.
 | 
			
		||||
  def test_truth
 | 
			
		||||
    assert true
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user