sequel_secure_password 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +1 -1
- data/lib/sequel_secure_password/version.rb +1 -1
- data/sequel_secure_password.gemspec +3 -3
- data/spec/sequel_secure_password_spec.rb +49 -0
- data/spec/spec_helper.rb +1 -0
- metadata +44 -56
- data/spec/secure_password_spec.rb +0 -44
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d7f4496f6499db7e5f86f3747a7546ab522c41ca
|
4
|
+
data.tar.gz: 00c5b1e811a29d28a299424c91cf121b52303dad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a4d385bb5365719cd1f7cf0f061b2b18a17d7e5667b68a40b992b8eb0b02cb8edbfc15f0204c31a759a96012f7d7fece175ef9c30a89f53ac9c296f273e8e013
|
7
|
+
data.tar.gz: 6ac63e86c4268ac588367cafa79ac8460110f0a42aca182807e1a478639da0c7f198a5f5db9af1ff2a35df46866b3c1f31428978e647e3f409196673e89e93fa
|
data/.travis.yml
CHANGED
@@ -22,10 +22,10 @@ EOF
|
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
24
24
|
gem.add_dependency 'bcrypt-ruby', '~> 3.0.0'
|
25
|
-
gem.add_dependency 'sequel', '~> 3.
|
25
|
+
gem.add_dependency 'sequel', '~> 3.48.0'
|
26
26
|
|
27
|
-
gem.add_development_dependency 'rspec',
|
28
|
-
gem.add_development_dependency 'rake',
|
27
|
+
gem.add_development_dependency 'rspec', '~> 2.13.0'
|
28
|
+
gem.add_development_dependency 'rake', '~> 10.0.0'
|
29
29
|
if RUBY_PLATFORM == "java"
|
30
30
|
gem.add_development_dependency 'jdbc-sqlite3', '~> 3.7.2'
|
31
31
|
else
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "model using Sequel::Plugins::SecurePassword" do
|
4
|
+
subject(:user) { User.new }
|
5
|
+
|
6
|
+
context "with blank password" do
|
7
|
+
before { user.password = "" }
|
8
|
+
|
9
|
+
it { should_not be_valid }
|
10
|
+
end
|
11
|
+
|
12
|
+
context "with nil password" do
|
13
|
+
before { user.password = nil }
|
14
|
+
|
15
|
+
it { should_not be_valid }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "without setting a password" do
|
19
|
+
it { should_not be_valid }
|
20
|
+
end
|
21
|
+
|
22
|
+
context "without confirmation" do
|
23
|
+
before { user.password = "foo" }
|
24
|
+
|
25
|
+
it { should_not be_valid }
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when password matches confirmation" do
|
29
|
+
before { user.password = user.password_confirmation = "foo" }
|
30
|
+
|
31
|
+
it { should be_valid }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#authenticate" do
|
35
|
+
let(:secret) { "foo" }
|
36
|
+
before { user.password = secret }
|
37
|
+
|
38
|
+
context "when authentication is successful" do
|
39
|
+
it "returns the user" do
|
40
|
+
user.authenticate(secret).should be user
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when authentication fails" do
|
45
|
+
it { user.authenticate("").should be nil }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,96 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel_secure_password
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.1.0
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mateusz Lenik
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-06-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bcrypt-ruby
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ~>
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 3.0.0
|
21
|
-
none: false
|
22
15
|
requirement: !ruby/object:Gem::Requirement
|
23
16
|
requirements:
|
24
17
|
- - ~>
|
25
18
|
- !ruby/object:Gem::Version
|
26
19
|
version: 3.0.0
|
27
|
-
none: false
|
28
|
-
prerelease: false
|
29
20
|
type: :runtime
|
30
|
-
|
31
|
-
name: sequel
|
21
|
+
prerelease: false
|
32
22
|
version_requirements: !ruby/object:Gem::Requirement
|
33
23
|
requirements:
|
34
24
|
- - ~>
|
35
25
|
- !ruby/object:Gem::Version
|
36
|
-
version: 3.
|
37
|
-
|
26
|
+
version: 3.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sequel
|
38
29
|
requirement: !ruby/object:Gem::Requirement
|
39
30
|
requirements:
|
40
31
|
- - ~>
|
41
32
|
- !ruby/object:Gem::Version
|
42
|
-
version: 3.
|
43
|
-
none: false
|
44
|
-
prerelease: false
|
33
|
+
version: 3.48.0
|
45
34
|
type: :runtime
|
46
|
-
|
47
|
-
name: rspec
|
35
|
+
prerelease: false
|
48
36
|
version_requirements: !ruby/object:Gem::Requirement
|
49
37
|
requirements:
|
50
38
|
- - ~>
|
51
39
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
53
|
-
|
40
|
+
version: 3.48.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
54
43
|
requirement: !ruby/object:Gem::Requirement
|
55
44
|
requirements:
|
56
45
|
- - ~>
|
57
46
|
- !ruby/object:Gem::Version
|
58
|
-
version: 2.
|
59
|
-
none: false
|
60
|
-
prerelease: false
|
47
|
+
version: 2.13.0
|
61
48
|
type: :development
|
62
|
-
|
63
|
-
name: rake
|
49
|
+
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - ~>
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
-
|
54
|
+
version: 2.13.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
70
57
|
requirement: !ruby/object:Gem::Requirement
|
71
58
|
requirements:
|
72
59
|
- - ~>
|
73
60
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
75
|
-
none: false
|
76
|
-
prerelease: false
|
61
|
+
version: 10.0.0
|
77
62
|
type: :development
|
78
|
-
|
79
|
-
name: jdbc-sqlite3
|
63
|
+
prerelease: false
|
80
64
|
version_requirements: !ruby/object:Gem::Requirement
|
81
65
|
requirements:
|
82
66
|
- - ~>
|
83
67
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
85
|
-
|
68
|
+
version: 10.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
86
71
|
requirement: !ruby/object:Gem::Requirement
|
87
72
|
requirements:
|
88
73
|
- - ~>
|
89
74
|
- !ruby/object:Gem::Version
|
90
|
-
version: 3.
|
91
|
-
none: false
|
92
|
-
prerelease: false
|
75
|
+
version: 1.3.0
|
93
76
|
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.0
|
94
83
|
description: Plugin adds authentication methods to Sequel models using BCrypt library.
|
95
84
|
email:
|
96
85
|
- mt.lenik@gmail.com
|
@@ -108,34 +97,33 @@ files:
|
|
108
97
|
- lib/sequel_secure_password.rb
|
109
98
|
- lib/sequel_secure_password/version.rb
|
110
99
|
- sequel_secure_password.gemspec
|
111
|
-
- spec/
|
100
|
+
- spec/sequel_secure_password_spec.rb
|
112
101
|
- spec/spec_helper.rb
|
113
102
|
homepage: http://github.com/mlen/sequel_secure_password
|
114
103
|
licenses: []
|
115
|
-
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
116
106
|
rdoc_options: []
|
117
107
|
require_paths:
|
118
108
|
- lib
|
119
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
110
|
requirements:
|
121
|
-
- -
|
111
|
+
- - '>='
|
122
112
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
124
|
-
MA==
|
125
|
-
none: false
|
113
|
+
version: '0'
|
126
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
115
|
requirements:
|
128
|
-
- -
|
116
|
+
- - '>='
|
129
117
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
131
|
-
MA==
|
132
|
-
none: false
|
118
|
+
version: '0'
|
133
119
|
requirements: []
|
134
|
-
rubyforge_project:
|
135
|
-
rubygems_version:
|
136
|
-
signing_key:
|
137
|
-
specification_version:
|
138
|
-
summary: Plugin adds BCrypt authentication and password hashing to Sequel models.
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.0.2
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Plugin adds BCrypt authentication and password hashing to Sequel models.
|
125
|
+
Model using this plugin should have 'password_digest' field. This plugin was created
|
126
|
+
by extracting has_secure_password strategy from rails.
|
139
127
|
test_files:
|
140
|
-
- spec/
|
128
|
+
- spec/sequel_secure_password_spec.rb
|
141
129
|
- spec/spec_helper.rb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "model with Sequel::Plugins::SecurePassword" do
|
4
|
-
subject { User.new }
|
5
|
-
|
6
|
-
it "is invalid with blank password" do
|
7
|
-
subject.password = ""
|
8
|
-
subject.should_not be_valid
|
9
|
-
end
|
10
|
-
|
11
|
-
it "is invalid with nil password" do
|
12
|
-
subject.password = nil
|
13
|
-
subject.should_not be_valid
|
14
|
-
end
|
15
|
-
|
16
|
-
it "is invalid without a password" do
|
17
|
-
subject.should_not be_valid
|
18
|
-
end
|
19
|
-
|
20
|
-
it "is valid with password matching confirmation" do
|
21
|
-
subject.password = "foo"
|
22
|
-
subject.password_confirmation = "foo"
|
23
|
-
|
24
|
-
subject.should be_valid
|
25
|
-
end
|
26
|
-
|
27
|
-
it "is invalid without password matching confirmation" do
|
28
|
-
subject.password = "foo"
|
29
|
-
subject.password_confirmation = "bar"
|
30
|
-
|
31
|
-
subject.should_not be_valid
|
32
|
-
end
|
33
|
-
|
34
|
-
it "returns user when authentication is successful" do
|
35
|
-
subject.password = "foo"
|
36
|
-
subject.authenticate("foo").should be subject
|
37
|
-
end
|
38
|
-
|
39
|
-
it "returns nil when authentication fails" do
|
40
|
-
subject.password = "foo"
|
41
|
-
subject.authenticate("bar").should be nil
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|