dm-devise 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +67 -64
- data/README.rdoc +5 -5
- data/dm-devise.gemspec +1 -1
- data/lib/devise/orm/data_mapper/compatibility.rb +5 -1
- data/lib/dm-devise/version.rb +1 -1
- data/test/overrides/data_mapper_test.rb +55 -0
- data/test/overrides/dm_validations_test.rb +8 -0
- metadata +7 -8
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dm-devise (1.3.
|
5
|
-
devise (~> 1.3
|
4
|
+
dm-devise (1.3.1)
|
5
|
+
devise (~> 1.3)
|
6
6
|
dm-core (>= 1.0.2, < 1.2)
|
7
7
|
dm-migrations (>= 1.0.2, < 1.2)
|
8
8
|
dm-rails (>= 1.0.3, < 1.2)
|
@@ -14,39 +14,39 @@ GEM
|
|
14
14
|
remote: http://rubygems.org/
|
15
15
|
specs:
|
16
16
|
abstract (1.0.0)
|
17
|
-
actionmailer (3.0.
|
18
|
-
actionpack (= 3.0.
|
19
|
-
mail (~> 2.2.
|
20
|
-
actionpack (3.0.
|
21
|
-
activemodel (= 3.0.
|
22
|
-
activesupport (= 3.0.
|
17
|
+
actionmailer (3.0.9)
|
18
|
+
actionpack (= 3.0.9)
|
19
|
+
mail (~> 2.2.19)
|
20
|
+
actionpack (3.0.9)
|
21
|
+
activemodel (= 3.0.9)
|
22
|
+
activesupport (= 3.0.9)
|
23
23
|
builder (~> 2.1.2)
|
24
24
|
erubis (~> 2.6.6)
|
25
|
-
i18n (~> 0.
|
25
|
+
i18n (~> 0.5.0)
|
26
26
|
rack (~> 1.2.1)
|
27
|
-
rack-mount (~> 0.6.
|
27
|
+
rack-mount (~> 0.6.14)
|
28
28
|
rack-test (~> 0.5.7)
|
29
29
|
tzinfo (~> 0.3.23)
|
30
|
-
activemodel (3.0.
|
31
|
-
activesupport (= 3.0.
|
30
|
+
activemodel (3.0.9)
|
31
|
+
activesupport (= 3.0.9)
|
32
32
|
builder (~> 2.1.2)
|
33
|
-
i18n (~> 0.
|
34
|
-
activerecord (3.0.
|
35
|
-
activemodel (= 3.0.
|
36
|
-
activesupport (= 3.0.
|
37
|
-
arel (~> 2.0.
|
33
|
+
i18n (~> 0.5.0)
|
34
|
+
activerecord (3.0.9)
|
35
|
+
activemodel (= 3.0.9)
|
36
|
+
activesupport (= 3.0.9)
|
37
|
+
arel (~> 2.0.10)
|
38
38
|
tzinfo (~> 0.3.23)
|
39
|
-
activeresource (3.0.
|
40
|
-
activemodel (= 3.0.
|
41
|
-
activesupport (= 3.0.
|
42
|
-
activesupport (3.0.
|
43
|
-
addressable (2.2.
|
44
|
-
arel (2.0.
|
39
|
+
activeresource (3.0.9)
|
40
|
+
activemodel (= 3.0.9)
|
41
|
+
activesupport (= 3.0.9)
|
42
|
+
activesupport (3.0.9)
|
43
|
+
addressable (2.2.6)
|
44
|
+
arel (2.0.10)
|
45
45
|
bcrypt-ruby (2.1.4)
|
46
46
|
builder (2.1.2)
|
47
|
-
data_objects (0.10.
|
47
|
+
data_objects (0.10.6)
|
48
48
|
addressable (~> 2.1)
|
49
|
-
devise (1.
|
49
|
+
devise (1.4.0)
|
50
50
|
bcrypt-ruby (~> 2.1.2)
|
51
51
|
orm_adapter (~> 0.0.3)
|
52
52
|
warden (~> 1.0.3)
|
@@ -76,67 +76,70 @@ GEM
|
|
76
76
|
dm-core (~> 1.1.0)
|
77
77
|
dm-validations (1.1.0)
|
78
78
|
dm-core (~> 1.1.0)
|
79
|
-
do_sqlite3 (0.10.
|
80
|
-
data_objects (= 0.10.
|
79
|
+
do_sqlite3 (0.10.6)
|
80
|
+
data_objects (= 0.10.6)
|
81
81
|
erubis (2.6.6)
|
82
82
|
abstract (>= 1.0.0)
|
83
|
-
faraday (0.
|
83
|
+
faraday (0.6.1)
|
84
84
|
addressable (~> 2.2.4)
|
85
85
|
multipart-post (~> 1.1.0)
|
86
|
-
rack (>= 1.1.0
|
86
|
+
rack (< 2, >= 1.1.0)
|
87
87
|
fastercsv (1.5.4)
|
88
88
|
i18n (0.5.0)
|
89
89
|
json (1.4.6)
|
90
|
-
mail (2.2.
|
90
|
+
mail (2.2.19)
|
91
91
|
activesupport (>= 2.3.6)
|
92
92
|
i18n (>= 0.4.0)
|
93
93
|
mime-types (~> 1.16)
|
94
94
|
treetop (~> 1.4.8)
|
95
95
|
mime-types (1.16)
|
96
96
|
mocha (0.9.12)
|
97
|
-
multi_json (
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
oa-oauth (0.2.
|
103
|
-
|
104
|
-
|
105
|
-
|
97
|
+
multi_json (1.0.3)
|
98
|
+
multi_xml (0.2.2)
|
99
|
+
multipart-post (1.1.2)
|
100
|
+
nokogiri (1.4.6)
|
101
|
+
oa-core (0.2.6)
|
102
|
+
oa-oauth (0.2.6)
|
103
|
+
faraday (~> 0.6.1)
|
104
|
+
multi_json (~> 1.0.0)
|
105
|
+
multi_xml (~> 0.2.2)
|
106
|
+
oa-core (= 0.2.6)
|
106
107
|
oauth (~> 0.4.0)
|
107
|
-
oauth2 (~> 0.
|
108
|
-
oa-openid (0.2.
|
109
|
-
oa-core (= 0.2.
|
110
|
-
rack-openid (~> 1.
|
111
|
-
ruby-openid-apps-discovery
|
108
|
+
oauth2 (~> 0.4.1)
|
109
|
+
oa-openid (0.2.6)
|
110
|
+
oa-core (= 0.2.6)
|
111
|
+
rack-openid (~> 1.3.1)
|
112
|
+
ruby-openid-apps-discovery (~> 1.2.0)
|
112
113
|
oauth (0.4.4)
|
113
|
-
oauth2 (0.
|
114
|
-
faraday (~> 0.
|
115
|
-
multi_json (
|
116
|
-
orm_adapter (0.0.
|
114
|
+
oauth2 (0.4.1)
|
115
|
+
faraday (~> 0.6.1)
|
116
|
+
multi_json (>= 0.0.5)
|
117
|
+
orm_adapter (0.0.5)
|
117
118
|
polyglot (0.3.1)
|
118
|
-
rack (1.2.
|
119
|
+
rack (1.2.3)
|
119
120
|
rack-mount (0.6.14)
|
120
121
|
rack (>= 1.0.0)
|
121
|
-
rack-openid (1.
|
122
|
+
rack-openid (1.3.1)
|
122
123
|
rack (>= 1.1.0)
|
123
124
|
ruby-openid (>= 2.1.8)
|
124
125
|
rack-test (0.5.7)
|
125
126
|
rack (>= 1.0)
|
126
|
-
rails (3.0.
|
127
|
-
actionmailer (= 3.0.
|
128
|
-
actionpack (= 3.0.
|
129
|
-
activerecord (= 3.0.
|
130
|
-
activeresource (= 3.0.
|
131
|
-
activesupport (= 3.0.
|
127
|
+
rails (3.0.9)
|
128
|
+
actionmailer (= 3.0.9)
|
129
|
+
actionpack (= 3.0.9)
|
130
|
+
activerecord (= 3.0.9)
|
131
|
+
activeresource (= 3.0.9)
|
132
|
+
activesupport (= 3.0.9)
|
132
133
|
bundler (~> 1.0)
|
133
|
-
railties (= 3.0.
|
134
|
-
railties (3.0.
|
135
|
-
actionpack (= 3.0.
|
136
|
-
activesupport (= 3.0.
|
134
|
+
railties (= 3.0.9)
|
135
|
+
railties (3.0.9)
|
136
|
+
actionpack (= 3.0.9)
|
137
|
+
activesupport (= 3.0.9)
|
137
138
|
rake (>= 0.8.7)
|
139
|
+
rdoc (~> 3.4)
|
138
140
|
thor (~> 0.14.4)
|
139
|
-
rake (0.
|
141
|
+
rake (0.9.2)
|
142
|
+
rdoc (3.6.1)
|
140
143
|
require_all (1.2.0)
|
141
144
|
ruby-openid (2.1.8)
|
142
145
|
ruby-openid-apps-discovery (1.2.0)
|
@@ -147,9 +150,9 @@ GEM
|
|
147
150
|
thor (0.14.6)
|
148
151
|
treetop (1.4.9)
|
149
152
|
polyglot (>= 0.3.1)
|
150
|
-
tzinfo (0.3.
|
151
|
-
warden (1.0.
|
152
|
-
rack (>= 1.0
|
153
|
+
tzinfo (0.3.28)
|
154
|
+
warden (1.0.4)
|
155
|
+
rack (>= 1.0)
|
153
156
|
webrat (0.7.2)
|
154
157
|
nokogiri (>= 1.2.0)
|
155
158
|
rack (>= 1.0)
|
data/README.rdoc
CHANGED
@@ -13,15 +13,15 @@ library you wish to use for validations:
|
|
13
13
|
The advantage to this is ActiveModel's I18n support for error messages, and
|
14
14
|
it uses the same validations lib as devise does by default.
|
15
15
|
|
16
|
-
dm-devise is intended for use with Rails 3 and devise 1.1. It may work with
|
16
|
+
dm-devise is intended for use with Rails 3 and devise >= 1.1. It may work with
|
17
17
|
earlier versions, but it's not been tested (if you try, please let Jared Morgan
|
18
18
|
(http://github.com/jm81) know how it goes.)
|
19
19
|
|
20
20
|
This README only covers dm-devise specifics. Make sure to read the devise
|
21
21
|
README http://github.com/plataformatec/devise/blob/master/README.rdoc
|
22
22
|
|
23
|
-
Last tested against devise master: 2011-
|
24
|
-
Last tested against devise release 1.
|
23
|
+
Last tested against devise master: 2011-06-23, commit dba8f91f99dce0e102ad2e6aa78b142a92833bc3
|
24
|
+
Last tested against devise release 1.4.0
|
25
25
|
|
26
26
|
== Installation
|
27
27
|
|
@@ -33,7 +33,7 @@ Add dm-devise and dm gems to your Gemfile. The following gems are required:
|
|
33
33
|
gem 'dm-timestamps', '~> 1.1.0'
|
34
34
|
gem 'dm-rails', '~> 1.1.0'
|
35
35
|
gem 'dm-validations', '~> 1.1.0' # Do not include if using data_mapper_active_model
|
36
|
-
gem 'dm-devise', '~> 1.
|
36
|
+
gem 'dm-devise', '~> 1.4.0'
|
37
37
|
|
38
38
|
If you're using data_mapper_active_model do not include dm-validations in your
|
39
39
|
Gemfile.
|
@@ -75,7 +75,7 @@ Tests of the master branch should be run against devise master. Tests of the
|
|
75
75
|
1.1 branch should be run against the devise 1.1 branch (or a 1.1.x gem).
|
76
76
|
|
77
77
|
== Note on Patches/Pull Requests
|
78
|
-
|
78
|
+
|
79
79
|
* Fork the project.
|
80
80
|
* Make your feature addition or bug fix.
|
81
81
|
* Add tests for it. This is important so I don't break it in a
|
data/dm-devise.gemspec
CHANGED
@@ -21,6 +21,6 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_dependency('dm-serializer', '>= 1.0.2', '< 1.2')
|
22
22
|
s.add_dependency('dm-timestamps', '>= 1.0.2', '< 1.2')
|
23
23
|
s.add_dependency('dm-rails', '>= 1.0.3', '< 1.2')
|
24
|
-
s.add_dependency('devise', '~> 1.3
|
24
|
+
s.add_dependency('devise', '~> 1.3')
|
25
25
|
s.add_dependency('sugar-high', '~> 0.2.10')
|
26
26
|
end
|
@@ -52,7 +52,7 @@ module Devise
|
|
52
52
|
def update_attribute(name, value)
|
53
53
|
update(name => value)
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def update_attributes(*args)
|
57
57
|
update(*args)
|
58
58
|
end
|
@@ -60,6 +60,10 @@ module Devise
|
|
60
60
|
def invalid?
|
61
61
|
!valid?
|
62
62
|
end
|
63
|
+
|
64
|
+
def email_changed?
|
65
|
+
attribute_dirty?(:email)
|
66
|
+
end
|
63
67
|
end
|
64
68
|
end
|
65
69
|
end
|
data/lib/dm-devise/version.rb
CHANGED
@@ -64,4 +64,59 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
|
64
64
|
user.save
|
65
65
|
assert_equal email.downcase, user.email
|
66
66
|
end
|
67
|
+
|
68
|
+
undef test_should_remove_whitespace_from_strip_whitespace_keys_when_saving
|
69
|
+
|
70
|
+
test 'should remove whitespace from strip whitespace keys when saving' do
|
71
|
+
# strip_whitespace_keys is set to :email by default.
|
72
|
+
email = ' foo@bar.com '
|
73
|
+
user = new_user(:email => email)
|
74
|
+
|
75
|
+
assert_equal email, user.email
|
76
|
+
user.save
|
77
|
+
assert_equal email.strip, user.email
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class ValidatableTest < ActiveSupport::TestCase
|
82
|
+
# user.save! is failing in these tests, since validation are running anyway.
|
83
|
+
# See https://github.com/datamapper/dm-validations/pull/13.
|
84
|
+
|
85
|
+
undef :"test_should_require_uniqueness_of_email_if_email_has_changed,_allowing_blank"
|
86
|
+
|
87
|
+
test 'should require uniqueness of email if email has changed, allowing blank' do
|
88
|
+
existing_user = create_user
|
89
|
+
|
90
|
+
user = new_user(:email => '')
|
91
|
+
assert user.invalid?
|
92
|
+
assert_no_match(/taken/, user.errors[:email].join)
|
93
|
+
|
94
|
+
user.email = existing_user.email
|
95
|
+
assert user.invalid?
|
96
|
+
assert_match(/taken/, user.errors[:email].join)
|
97
|
+
|
98
|
+
pending do
|
99
|
+
user.save(:validate => false)
|
100
|
+
assert user.valid?
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
undef :"test_should_require_correct_email_format_if_email_has_changed,_allowing_blank"
|
105
|
+
|
106
|
+
test 'should require correct email format if email has changed, allowing blank' do
|
107
|
+
user = new_user(:email => '')
|
108
|
+
assert user.invalid?
|
109
|
+
assert_not_equal 'is invalid', user.errors[:email].join
|
110
|
+
|
111
|
+
%w(invalid_email_format 123 $$$ \(\) ).each do |email|
|
112
|
+
user.email = email
|
113
|
+
assert user.invalid?, 'should be invalid with email ' << email
|
114
|
+
assert_equal 'is invalid', user.errors[:email].join
|
115
|
+
end
|
116
|
+
|
117
|
+
pending do
|
118
|
+
user.save(:validate => false)
|
119
|
+
assert user.valid?
|
120
|
+
end
|
121
|
+
end
|
67
122
|
end
|
@@ -25,5 +25,13 @@ if DEVISE_ORM == :data_mapper
|
|
25
25
|
assert_equal 'must be between 6 and 128 characters long', user.errors[:password].join
|
26
26
|
end
|
27
27
|
|
28
|
+
undef test_should_complain_about_length_even_if_possword_is_not_required
|
29
|
+
|
30
|
+
test 'should complain about length even if possword is not required' do
|
31
|
+
user = new_user(:password => 'x'*129, :password_confirmation => 'x'*129)
|
32
|
+
user.stubs(:password_required?).returns(false)
|
33
|
+
assert user.invalid?
|
34
|
+
assert_equal 'must be between 6 and 128 characters long', user.errors[:password].join
|
35
|
+
end
|
28
36
|
end
|
29
37
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 1.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jared Morgan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-24 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -141,12 +141,11 @@ dependencies:
|
|
141
141
|
requirements:
|
142
142
|
- - ~>
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
hash:
|
144
|
+
hash: 9
|
145
145
|
segments:
|
146
146
|
- 1
|
147
147
|
- 3
|
148
|
-
|
149
|
-
version: 1.3.0
|
148
|
+
version: "1.3"
|
150
149
|
type: :runtime
|
151
150
|
version_requirements: *id006
|
152
151
|
- !ruby/object:Gem::Dependency
|