cop-detective 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac187ef144e420f686140d6b3d31dc6da3b59c19
4
- data.tar.gz: fcd5e4adc6df5242df3567d573fe672ff90f43f2
3
+ metadata.gz: b798995e62622a81120bf2663a5255ed2dc3a2cc
4
+ data.tar.gz: 16b49827e5098b0387f814a104e1a4d96e306b67
5
5
  SHA512:
6
- metadata.gz: 1c0647fa726ad7f1f05a4c29257183efd90939f6640adedc45d3bafa7791c6f419a040ddd226fe83a52d9decbe200771dafa627f42cdd1d20b4b328e85509a01
7
- data.tar.gz: 89519a82e39d0948ec341e66377ba34fb8300820f09ed6d43ed29d31bb4d57e43f0a6aef760cc564e1209834829fd063d538bff4ce489e0f7dca455c61abbf07
6
+ metadata.gz: e24389e4ab559f8c7054256744b73940799b2d22bc64c6f338ddfbaa33f182d8fd4363503739cce12b49a352a6c46b7e2ade19c3d667ddbf130e0b86a18929c4
7
+ data.tar.gz: deb866aaa231b916f4e294be7dc1fa47d871c3fa207d652f9e73d1cb81d9514116c3a95869f36e687276b40c4ead25210f5e2ee3c19fc55b87dd106bf3fa5079
data/lib/cop_detective.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  require 'active_model'
2
2
  require 'active_support'
3
+ require 'active_record'
3
4
  require_relative 'errors'
4
5
  require_relative 'validator'
5
6
 
6
7
  class CopDetective
7
8
  cattr_reader :messages
8
9
  class << self
9
-
10
10
  include ActiveModel::SecurePassword
11
11
  @@messages = CopDetectiveValidator.messages
12
12
 
@@ -28,7 +28,7 @@ class CopDetective
28
28
  user.save
29
29
  @@messages[:notice] = "Account created. You may now log in."
30
30
  else
31
- @@messages[:error] = "Passwords don't match or other params are not valid."
31
+ user.errors.full_messages << "Passwords don't match or other params are not valid."
32
32
  end
33
33
  end
34
34
 
data/lib/validator.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  require 'active_support'
2
+ require 'active_record'
3
+
2
4
  class CopDetectiveValidator
3
5
  include CopDetective::ErrorMessages
4
6
  cattr_accessor :messages
5
7
 
6
8
  class << self
7
- @@messages = {notice: nil, error: nil}
9
+ @@messages = {notice: nil}
8
10
  @@options_errors = {option_nil: "is nil.",
9
11
  empty: "is an empty string."
10
12
  }
@@ -14,7 +16,7 @@ class CopDetectiveValidator
14
16
  user.update_attributes(password: password)
15
17
  @@messages[:notice] = "Password updated"
16
18
  else
17
- @@messages[:error] = CopDetective::ErrorMessages.unsaved_password(CopDetective::ErrorMessages.non_matching)
19
+ user.errors.full_messages << CopDetective::ErrorMessages.unsaved_password(CopDetective::ErrorMessages.non_matching)
18
20
  end
19
21
  end
20
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cop-detective
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Kamin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-02 00:00:00.000000000 Z
11
+ date: 2015-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord