dm-devise 1.2.0 → 1.3.0

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.
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dm-devise (1.2.0)
5
- devise (~> 1.2.0)
4
+ dm-devise (1.3.0)
5
+ devise (~> 1.3.0)
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)
@@ -46,7 +46,7 @@ GEM
46
46
  builder (2.1.2)
47
47
  data_objects (0.10.3)
48
48
  addressable (~> 2.1)
49
- devise (1.2.0)
49
+ devise (1.3.0)
50
50
  bcrypt-ruby (~> 2.1.2)
51
51
  orm_adapter (~> 0.0.3)
52
52
  warden (~> 1.0.3)
data/README.rdoc CHANGED
@@ -20,8 +20,8 @@ earlier versions, but it's not been tested (if you try, please let Jared Morgan
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-03-25, commit da510508bb919fdcd2b94a461f3c3c56d127ca5b
24
- Last tested against devise release 1.2.0
23
+ Last tested against devise master: 2011-04-16, commit 460beae671c654bdb83ebbc4c4ebfa613aee8384
24
+ Last tested against devise release 1.3.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.2.0'
36
+ gem 'dm-devise', '~> 1.3.0'
37
37
 
38
38
  If you're using data_mapper_active_model do not include dm-validations in your
39
39
  Gemfile.
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.2.0')
24
+ s.add_dependency('devise', '~> 1.3.0')
25
25
  s.add_dependency('sugar-high', '~> 0.2.10')
26
26
  end
@@ -18,6 +18,10 @@ module Devise
18
18
  wrap_hook(:before, :save, *args)
19
19
  end
20
20
 
21
+ def before_validation(*args)
22
+ wrap_hook(:before, :valid?, *args)
23
+ end
24
+
21
25
  def wrap_hook(action, method, *args)
22
26
  options = args.extract_options!
23
27
 
@@ -53,3 +53,15 @@ DataMapper::Validate::ValidationErrors.default_error_messages = {
53
53
  :already_confirmed => '%s was already confirmed, please try signing in',
54
54
  :not_locked => '%s was not locked'
55
55
  }
56
+
57
+ module DataMapper
58
+ module Validations
59
+ class ValidationErrors
60
+ # Some devise controller actions expect resource#errors to respond to
61
+ # #to_xml. Otherwise, we get a Missing template error
62
+ def to_xml(options = {})
63
+ @errors.to_hash.to_xml(options.merge(:root => 'errors'))
64
+ end
65
+ end
66
+ end
67
+ end
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module Devise
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.3.0'.freeze
4
4
  end
5
5
  end
@@ -65,15 +65,3 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
65
65
  assert_equal email.downcase, user.email
66
66
  end
67
67
  end
68
-
69
- class AuthenticationRedirectTest < ActionController::IntegrationTest
70
- undef test_sign_in_with_xml_format_returns_xml_response
71
-
72
- # It appears DM's to_xml does not add the xml header
73
- test 'sign in with xml format returns xml response' do
74
- create_user
75
- post user_session_path(:format => 'xml', :user => {:email => "user@test.com", :password => '123456'})
76
- assert_response :success
77
- assert_match /\A<user>\s*<id/, response.body
78
- end
79
- end
@@ -12,17 +12,17 @@ if DEVISE_ORM == :data_mapper
12
12
  user = new_user(:password => '12345', :password_confirmation => '12345')
13
13
  assert user.invalid?
14
14
  # assert_equal 'is too short (minimum is 6 characters)', user.errors[:password].join
15
- assert_equal 'must be between 6 and 20 characters long', user.errors[:password].join
15
+ assert_equal 'must be between 6 and 128 characters long', user.errors[:password].join
16
16
  end
17
17
 
18
- undef test_should_require_a_password_with_maximum_of_20_characters_long
18
+ undef test_should_require_a_password_with_maximum_of_128_characters_long
19
19
 
20
20
  # Same issue as previous test
21
- test 'should require a password with maximum of 20 characters long' do
22
- user = new_user(:password => 'x'*21, :password_confirmation => 'x'*21)
21
+ test 'should require a password with maximum of 128 characters long' do
22
+ user = new_user(:password => 'x'*129, :password_confirmation => 'x'*129)
23
23
  assert user.invalid?
24
24
  # assert_equal 'is too long (maximum is 20 characters)', user.errors[:password].join
25
- assert_equal 'must be between 6 and 20 characters long', user.errors[:password].join
25
+ assert_equal 'must be between 6 and 128 characters long', user.errors[:password].join
26
26
  end
27
27
 
28
28
  end
@@ -42,5 +42,4 @@ if DEVISE_ORM == :data_mapper
42
42
  end
43
43
  end
44
44
  end
45
-
46
45
  end
@@ -18,4 +18,8 @@ module Shim
18
18
  all.destroy
19
19
  end
20
20
  end
21
+
22
+ def to_xml(*args)
23
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + super
24
+ end
21
25
  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: 31
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 1.2.0
10
+ version: 1.3.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-03-28 00:00:00 -05:00
18
+ date: 2011-04-16 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -141,12 +141,12 @@ dependencies:
141
141
  requirements:
142
142
  - - ~>
143
143
  - !ruby/object:Gem::Version
144
- hash: 31
144
+ hash: 27
145
145
  segments:
146
146
  - 1
147
- - 2
147
+ - 3
148
148
  - 0
149
- version: 1.2.0
149
+ version: 1.3.0
150
150
  type: :runtime
151
151
  version_requirements: *id006
152
152
  - !ruby/object:Gem::Dependency
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  requirements: []
237
237
 
238
238
  rubyforge_project:
239
- rubygems_version: 1.5.3
239
+ rubygems_version: 1.6.2
240
240
  signing_key:
241
241
  specification_version: 3
242
242
  summary: DataMapper support for devise