Sha256: 1304040293ff27da436757ee83c5ea1cf39accfec168159e1eec16232ebdb8aa
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
ENV['RACK_ENV'] = 'test' require './spec' require 'rspec' require 'rack/test' describe '${ClassName}' do def app Sinatra::Application end before do @username = 'Gennaro' @email = 'gennaro@bullo.pk' @password = 'sonopropriounbullo!' @new_password = 'sonounnuovobullo' @level = User.empty? ? User.founder : User.user end it 'creates an user' do User.exists?(@username).should be_false user = User.signup @username, @email, @password, @level user.errors.should be_empty user.guest?.should be_false user.founder?.should be_true User.exists?(@username).should be_true User.signup(@username, @email, @password, @level) { |errors| errors.should_not be_empty } end it 'logs in a user' do User.exists?(@username).should be_true User.login(@username, @password).should be_true user = User.get @username user.session.should have(29).chars end it 'logs out a user' do user = User.get @username user.session.should have(29).chars user.logout user.session.should be_empty end it 'recovers lost @password' do User.login(@username, @new_password).should be_false passcode = User.lost_password @username passcode.should_not be_false passcode.should have(29).chars recovery = User.password_recovery @username, passcode, @new_password recovery.should be_true User.login(@username, @new_password).should be_true end it 'change the user @level' do User.login(@username, @new_password).should be_true user = User.get @username user.founder? user.change_level User.banned user.banned? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gennaro-0.3.6.5 | templates/authentication/spec/user_spec.rb |