gennaro 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gennaro/version.rb +1 -1
- data/templates/authentication/Gemfile +4 -1
- data/templates/authentication/Rakefile +3 -2
- data/templates/authentication/spec/user_spec.rb +29 -36
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c9f06ef5a896669f3c7cb2b7564a972992ba2d1
|
4
|
+
data.tar.gz: aee8c0e6892419d8f8480df22d0c31df8ac370d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33527b44badf300f6c9393ab1544c79954fd1ebb00a50ff39d1cff050ee4c90666dc544cd686cf1281e1fdc3539ceb28138e152be4650329a239e3552fe396f2
|
7
|
+
data.tar.gz: 8f925aeaf71e808232a2b670e247d4e6b05963c1911da42fae8ddb2e70700e8aec19e664c9235679a73284330fadb9a448a188f88a3af2cc68990bcea67543f4
|
data/lib/gennaro/version.rb
CHANGED
@@ -4,12 +4,13 @@ require 'rake'
|
|
4
4
|
task :default => [ :test, :run ]
|
5
5
|
|
6
6
|
task :test do
|
7
|
+
File.delete 'db/spec.db' if File.exists? 'db/spec.db'
|
7
8
|
FileUtils.cd 'spec' do
|
8
9
|
sh 'rspec user_spec.rb --backtrace --color --format doc'
|
9
10
|
end
|
10
11
|
File.delete 'db/spec.db' if File.exists? 'db/spec.db'
|
11
12
|
end
|
12
13
|
|
13
|
-
task :run do
|
14
|
-
sh
|
14
|
+
task :run, :port do |t, args|
|
15
|
+
sh "thin -R config.ru -p #{args[:port] || 4567} start"
|
15
16
|
end
|
@@ -4,70 +4,63 @@ require './spec'
|
|
4
4
|
require 'rspec'
|
5
5
|
require 'rack/test'
|
6
6
|
|
7
|
-
describe '
|
7
|
+
describe 'Pigro' do
|
8
8
|
def app
|
9
9
|
Sinatra::Application
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
username
|
14
|
-
email
|
15
|
-
password
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
user = User.signup username, email, password, level
|
20
|
-
user.errors.should be_empty
|
21
|
-
user.guest?.should be_false
|
22
|
-
user.founder?.should be_true
|
23
|
-
User.exists?(username).should be_true
|
12
|
+
before do
|
13
|
+
@username = 'Gennaro'
|
14
|
+
@email = 'gennaro@bullo.pk'
|
15
|
+
@password = 'sonopropriounbullo!'
|
16
|
+
@new_password = 'sonounnuovobullo'
|
17
|
+
@level = User.empty? ? User.founder : User.user
|
18
|
+
end
|
24
19
|
|
25
|
-
|
20
|
+
it 'creates an user' do
|
21
|
+
User.exists?(@username).should be_false
|
22
|
+
user = User.signup @username, @email, @password, @level
|
23
|
+
user.errors.should be_empty
|
24
|
+
user.guest?.should be_false
|
25
|
+
user.founder?.should be_true
|
26
|
+
User.exists?(@username).should be_true
|
27
|
+
|
28
|
+
user = User.signup @username, @email, @password, @level
|
26
29
|
user.errors.should_not be_empty
|
27
30
|
end
|
28
31
|
|
29
32
|
it 'logs in a user' do
|
30
|
-
username
|
31
|
-
password
|
33
|
+
User.exists?(@username).should be_true
|
34
|
+
User.login(@username, @password).should be_true
|
32
35
|
|
33
|
-
User.
|
34
|
-
User.login(username, password).should be_true
|
35
|
-
user = User.get username
|
36
|
+
user = User.get @username
|
36
37
|
user.session.should have(29).chars
|
37
38
|
end
|
38
39
|
|
39
40
|
it 'logs out a user' do
|
40
|
-
|
41
|
-
|
42
|
-
user = User.get username
|
41
|
+
user = User.get @username
|
43
42
|
user.session.should have(29).chars
|
44
43
|
user.logout
|
45
44
|
user.session.should be_empty
|
46
45
|
end
|
47
46
|
|
48
|
-
it 'recovers lost password' do
|
49
|
-
username
|
50
|
-
new_password = 'sonounnuovobullo!'
|
51
|
-
|
52
|
-
User.login(username, new_password).should be_false
|
47
|
+
it 'recovers lost @password' do
|
48
|
+
User.login(@username, @new_password).should be_false
|
53
49
|
|
54
|
-
passcode = User.lost_password username
|
50
|
+
passcode = User.lost_password @username
|
55
51
|
passcode.should_not be_false
|
56
52
|
passcode.should have(29).chars
|
57
53
|
|
58
|
-
recovery = User.password_recovery username, passcode, new_password
|
54
|
+
recovery = User.password_recovery @username, passcode, @new_password
|
59
55
|
recovery.should be_true
|
60
56
|
|
61
|
-
User.login(username, new_password).should be_true
|
57
|
+
User.login(@username, @new_password).should be_true
|
62
58
|
end
|
63
59
|
|
64
|
-
it 'change the user level' do
|
65
|
-
username
|
66
|
-
password = 'sonounnuovobullo!'
|
67
|
-
|
68
|
-
User.login(username, password).should be_true
|
60
|
+
it 'change the user @level' do
|
61
|
+
User.login(@username, @new_password).should be_true
|
69
62
|
|
70
|
-
user = User.get username
|
63
|
+
user = User.get @username
|
71
64
|
user.founder?
|
72
65
|
|
73
66
|
user.change_level User.banned
|