sequel_secure_password 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dabd3b67a25ab06cb9acd5ffb16b1902a16fbc27
4
+ data.tar.gz: e817b065fa0eb340e85a54531f7c25c919f2fee2
5
+ SHA512:
6
+ metadata.gz: 2c5daf2abeba68cd96b6b2e3adf4de30cc3cb0e89793fb4a43144cab366631eadff4b8ac1326a5267c2704d8b4aad536b8b0874ccae7f8797ccadf02f2752f0f
7
+ data.tar.gz: 11c5027412f8dcc973db49022d04debfbce4d3ab7cdb517d8fe677487ec4e3fd9788ac7ab79c8c54adf0d1c03792289e2a457020786eb4c02f4f6dfe22683ec0
data/.travis.yml CHANGED
@@ -1,8 +1,10 @@
1
1
  language: ruby
2
- script: bundle exec rspec
2
+ script: bundle exec rake spec
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
6
  - 2.1
7
7
  - 2.2
8
+ - 2.3
9
+ - 2.4
8
10
  - jruby-19mode
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
+ require 'bundler/setup'
1
2
  require 'rubygems/tasks'
3
+ require 'rspec/core/rake_task'
2
4
 
3
5
  # building and local installation
4
6
  Gem::Tasks::Install.new
@@ -6,7 +8,7 @@ Gem::Tasks::Build::Gem.new
6
8
 
7
9
  # git-related tasks
8
10
  Gem::Tasks::SCM::Status.new
9
- # Gem::Tasks::SCM::Tag.new(format: '%s', sign: true)
11
+ Gem::Tasks::SCM::Tag.new(format: '%s', sign: true)
10
12
  Gem::Tasks::SCM::Push.new
11
13
 
12
14
  # pushing to gemcutter
@@ -14,4 +16,7 @@ Gem::Tasks::Push.new
14
16
  Gem::Tasks::Release.new
15
17
 
16
18
  # loading gem into the console
17
- Gem::Tasks::Console.new(command: 'pry')
19
+ Gem::Tasks::Console.new
20
+
21
+ # spec tasks
22
+ RSpec::Core::RakeTask.new(:spec)
@@ -1,3 +1,3 @@
1
1
  module SequelSecurePassword
2
- VERSION = "0.2.12"
2
+ VERSION = "0.2.13"
3
3
  end
@@ -24,9 +24,12 @@ module Sequel
24
24
 
25
25
  module ClassMethods
26
26
  attr_reader :cost, :include_validations, :digest_column
27
- Plugins.inherited_instance_variables(self, :@cost => nil,
28
- :@include_validations => true,
29
- :@digest_column => :password_digest)
27
+
28
+ # NOTE: nil as a value means that the value of the instance variable
29
+ # will be assigned as is in the subclass.
30
+ Plugins.inherited_instance_variables(self, '@cost': nil,
31
+ '@include_validations': nil,
32
+ '@digest_column': nil)
30
33
  end
31
34
 
32
35
  module InstanceMethods
@@ -35,7 +38,8 @@ module Sequel
35
38
 
36
39
  def password=(unencrypted)
37
40
  @password = unencrypted
38
- unless SecurePassword.blank_string? unencrypted
41
+
42
+ unless SecurePassword.blank_string?(unencrypted)
39
43
  self.send "#{model.digest_column}=", BCrypt::Password.create(unencrypted, :cost => model.cost)
40
44
  end
41
45
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.name = "sequel_secure_password"
8
8
  gem.version = SequelSecurePassword::VERSION
9
9
  gem.authors = ["Mateusz Lenik"]
10
- gem.email = ["gems@mlen.pl"]
10
+ gem.email = ["mlen@mlen.pl"]
11
11
  gem.description = %q{Plugin adds authentication methods to Sequel models using BCrypt library.}
12
12
  gem.summary = <<EOF
13
13
  Plugin adds BCrypt authentication and password hashing to Sequel models.
@@ -25,13 +25,12 @@ EOF
25
25
  gem.add_dependency 'bcrypt', ['>= 3.1', '< 4.0']
26
26
  gem.add_dependency 'sequel', ['>= 4.1.0', '< 5.0']
27
27
 
28
- gem.add_development_dependency 'rspec', '~> 2.14'
29
- gem.add_development_dependency 'rake', '~> 10'
28
+ gem.add_development_dependency 'rspec', '~> 3.0'
29
+ gem.add_development_dependency 'rake', '~> 12'
30
30
  gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
31
- gem.add_development_dependency 'pry'
32
31
  if RUBY_PLATFORM == "java"
33
- gem.add_development_dependency 'jdbc-sqlite3', '~> 3.7.2'
32
+ gem.add_development_dependency 'jdbc-sqlite3', '~> 3.15', '>= 3.15.0'
34
33
  else
35
- gem.add_development_dependency 'sqlite3', '~> 1.3.0'
34
+ gem.add_development_dependency 'sqlite3', '~> 1.3', '>= 1.3.0'
36
35
  end
37
36
  end
@@ -6,64 +6,65 @@ describe "model using Sequel::Plugins::SecurePassword" do
6
6
  context "with empty password" do
7
7
  before { user.password = user.password_confirmation = "" }
8
8
 
9
- it { should_not be_valid }
9
+ it { is_expected.not_to be_valid }
10
10
  end
11
11
 
12
12
  context "with whitespace password" do
13
13
  before { user.password = user.password_confirmation = " "; }
14
14
 
15
- it { should_not be_valid }
15
+ it { is_expected.not_to be_valid }
16
16
  end
17
17
 
18
18
  context "with nil password" do
19
19
  before { user.password = user.password_confirmation = nil }
20
20
 
21
- it { should_not be_valid }
21
+ it { is_expected.not_to be_valid }
22
22
  end
23
23
 
24
24
  context "without setting a password" do
25
- it { should_not be_valid }
25
+ it { is_expected.not_to be_valid }
26
26
  end
27
27
 
28
28
  context "without confirmation" do
29
29
  before { user.password = "foo" }
30
30
 
31
- it { should_not be_valid }
31
+ it { is_expected.not_to be_valid }
32
32
  end
33
33
 
34
34
  context "having cost within password_digest" do
35
35
  before { user.password = "foo" }
36
36
  it {
37
- BCrypt::Password.new(user.password_digest).cost.should be BCrypt::Engine::DEFAULT_COST
37
+ expect(BCrypt::Password.new(user.password_digest).cost).to eq(BCrypt::Engine::DEFAULT_COST)
38
38
  }
39
39
  end
40
40
 
41
41
  context "when password matches confirmation" do
42
42
  before { user.password = user.password_confirmation = "foo" }
43
43
 
44
- it { should be_valid }
44
+ it { is_expected.to be_valid }
45
45
  end
46
46
 
47
47
  it "has an inherited instance variable :@cost" do
48
- expect( User.inherited_instance_variables ).to include(:@cost)
48
+ expect(User.inherited_instance_variables).to include(:@cost)
49
49
  end
50
50
 
51
51
  it "has an inherited instance variable :@include_validations" do
52
- expect( User.inherited_instance_variables ).to include(:@include_validations)
52
+ expect(User.inherited_instance_variables).to include(:@include_validations)
53
53
  end
54
54
 
55
55
  it "has an inherited instance variable :@digest_column" do
56
- expect( User.inherited_instance_variables ).to include(:@digest_column)
56
+ expect(User.inherited_instance_variables).to include(:@digest_column)
57
57
  end
58
58
 
59
59
  context "when validations are disabled" do
60
60
  subject(:user_without_validations) { UserWithoutValidations.new }
61
+
61
62
  before do
62
63
  user_without_validations.password = "foo"
63
64
  user_without_validations.password_confirmation = "bar"
64
65
  end
65
66
 
66
- it { should be_valid }
67
+ it { is_expected.to be_valid }
67
68
  end
68
69
 
69
70
  describe "#authenticate" do
@@ -72,12 +73,12 @@ describe "model using Sequel::Plugins::SecurePassword" do
72
73
 
73
74
  context "when authentication is successful" do
74
75
  it "returns the user" do
75
- user.authenticate(secret).should be user
76
+ expect(user.authenticate(secret)).to eq(user)
76
77
  end
77
78
  end
78
79
 
79
80
  context "when authentication fails" do
80
- it { user.authenticate("").should be nil }
81
+ it { expect(user.authenticate("")).to eq(nil) }
81
82
  end
82
83
  end
83
84
 
@@ -86,7 +87,7 @@ describe "model using Sequel::Plugins::SecurePassword" do
86
87
  context "having cost within password_digest" do
87
88
  before { highcost_user.password = "foo" }
88
89
  it {
89
- BCrypt::Password.new(highcost_user.password_digest).cost.should be 12
90
+ expect(BCrypt::Password.new(highcost_user.password_digest).cost).to eq(12)
90
91
  }
91
92
  end
92
93
  end
@@ -96,8 +97,12 @@ describe "model using Sequel::Plugins::SecurePassword" do
96
97
  context "having an alternate digest column" do
97
98
  before { digestcolumn_user.password = "foo" }
98
99
  it {
99
- BCrypt::Password.new(digestcolumn_user.password_hash).should eq "foo"
100
+ expect(BCrypt::Password.new(digestcolumn_user.password_hash)).to eq("foo")
100
101
  }
101
102
  end
102
103
  end
104
+
105
+ describe "ineritance" do
106
+ it { expect { Class.new(UserWithAlternateDigestColumn) }.not_to raise_error }
107
+ end
103
108
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_secure_password
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
5
- prerelease:
4
+ version: 0.2.13
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mateusz Lenik
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2017-01-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bcrypt
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ">="
20
18
  - !ruby/object:Gem::Version
@@ -25,7 +23,6 @@ dependencies:
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
@@ -36,7 +33,6 @@ dependencies:
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: sequel
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
37
  - - ">="
42
38
  - !ruby/object:Gem::Version
@@ -47,7 +43,6 @@ dependencies:
47
43
  type: :runtime
48
44
  prerelease: false
49
45
  version_requirements: !ruby/object:Gem::Requirement
50
- none: false
51
46
  requirements:
52
47
  - - ">="
53
48
  - !ruby/object:Gem::Version
@@ -58,39 +53,34 @@ dependencies:
58
53
  - !ruby/object:Gem::Dependency
59
54
  name: rspec
60
55
  requirement: !ruby/object:Gem::Requirement
61
- none: false
62
56
  requirements:
63
57
  - - "~>"
64
58
  - !ruby/object:Gem::Version
65
- version: '2.14'
59
+ version: '3.0'
66
60
  type: :development
67
61
  prerelease: false
68
62
  version_requirements: !ruby/object:Gem::Requirement
69
- none: false
70
63
  requirements:
71
64
  - - "~>"
72
65
  - !ruby/object:Gem::Version
73
- version: '2.14'
66
+ version: '3.0'
74
67
  - !ruby/object:Gem::Dependency
75
68
  name: rake
76
69
  requirement: !ruby/object:Gem::Requirement
77
- none: false
78
70
  requirements:
79
71
  - - "~>"
80
72
  - !ruby/object:Gem::Version
81
- version: '10'
73
+ version: '12'
82
74
  type: :development
83
75
  prerelease: false
84
76
  version_requirements: !ruby/object:Gem::Requirement
85
- none: false
86
77
  requirements:
87
78
  - - "~>"
88
79
  - !ruby/object:Gem::Version
89
- version: '10'
80
+ version: '12'
90
81
  - !ruby/object:Gem::Dependency
91
82
  name: rubygems-tasks
92
83
  requirement: !ruby/object:Gem::Requirement
93
- none: false
94
84
  requirements:
95
85
  - - "~>"
96
86
  - !ruby/object:Gem::Version
@@ -98,46 +88,33 @@ dependencies:
98
88
  type: :development
99
89
  prerelease: false
100
90
  version_requirements: !ruby/object:Gem::Requirement
101
- none: false
102
91
  requirements:
103
92
  - - "~>"
104
93
  - !ruby/object:Gem::Version
105
94
  version: '0.2'
106
- - !ruby/object:Gem::Dependency
107
- name: pry
108
- requirement: !ruby/object:Gem::Requirement
109
- none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- version: '0'
114
- type: :development
115
- prerelease: false
116
- version_requirements: !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- version: '0'
122
95
  - !ruby/object:Gem::Dependency
123
96
  name: sqlite3
124
97
  requirement: !ruby/object:Gem::Requirement
125
- none: false
126
98
  requirements:
127
99
  - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '1.3'
102
+ - - ">="
128
103
  - !ruby/object:Gem::Version
129
104
  version: 1.3.0
130
105
  type: :development
131
106
  prerelease: false
132
107
  version_requirements: !ruby/object:Gem::Requirement
133
- none: false
134
108
  requirements:
135
109
  - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.3'
112
+ - - ">="
136
113
  - !ruby/object:Gem::Version
137
114
  version: 1.3.0
138
115
  description: Plugin adds authentication methods to Sequel models using BCrypt library.
139
116
  email:
140
- - gems@mlen.pl
117
+ - mlen@mlen.pl
141
118
  executables: []
142
119
  extensions: []
143
120
  extra_rdoc_files: []
@@ -157,33 +134,26 @@ files:
157
134
  homepage: http://github.com/mlen/sequel_secure_password
158
135
  licenses:
159
136
  - MIT
137
+ metadata: {}
160
138
  post_install_message:
161
139
  rdoc_options: []
162
140
  require_paths:
163
141
  - lib
164
142
  required_ruby_version: !ruby/object:Gem::Requirement
165
- none: false
166
143
  requirements:
167
144
  - - ">="
168
145
  - !ruby/object:Gem::Version
169
146
  version: '0'
170
- segments:
171
- - 0
172
- hash: -900067175093670881
173
147
  required_rubygems_version: !ruby/object:Gem::Requirement
174
- none: false
175
148
  requirements:
176
149
  - - ">="
177
150
  - !ruby/object:Gem::Version
178
151
  version: '0'
179
- segments:
180
- - 0
181
- hash: -900067175093670881
182
152
  requirements: []
183
153
  rubyforge_project:
184
- rubygems_version: 1.8.30
154
+ rubygems_version: 2.6.9
185
155
  signing_key:
186
- specification_version: 3
156
+ specification_version: 4
187
157
  summary: Plugin adds BCrypt authentication and password hashing to Sequel models.
188
158
  Model using this plugin should have 'password_digest' field. This plugin was created
189
159
  by extracting has_secure_password strategy from rails.