55 Commits

Author SHA1 Message Date
Vasiliy Ermolovich
46c2c3913e Fix passing of format option to devise_for call. 2024-11-25 15:40:37 +01:00
Rafael Mendonça França
c8207373ea Drop support to all EOL rails versions 2023-10-12 16:52:01 -03:00
Carlos Antonio da Silva
14aa380d80 Update mocha to fix issue with Minitest compatibility layer
There's a number of deprecation warnings to work through related to
mocha updates in v2+, we'll get through those on a separate change.
https://github.com/freerange/mocha/blob/main/RELEASE.md#200

The main issue is with Minitest, fixed in v2.1:
https://github.com/freerange/mocha/blob/main/RELEASE.md#210

Also run `bundle update` on the main Gemfile to update all dependencies
there to latest.
2023-10-10 10:51:46 -03:00
Carlos Antonio da Silva
a793472a3e Replace XML with JSON serialization across the test suite
This allows us to remove the dependency on the XML serializer provided
by the external `activemodel-serializers-xml` gem, and eliminates the
following deprecation warning:

    DEPRECATION WARNING: ActiveModel::Errors#to_xml is deprecated and
    will be removed in Rails 6.2.

Please note: this does not mean Devise doesn't support XML, it simply
means our test suite will use JSON to test non-navigatable formats
instead of XML, for simplicity. Devise's job is not to test object
serialization, so as long as your objects properly serialize to
XML/JSON/any other format, it should work out of the box.
2021-02-15 14:40:05 -03:00
Leonardo Tegon
c000b58c56 Add Rails 6 to CI (#5009) 2019-01-22 12:43:31 -02:00
Pat Allan
f39c6fd927 Add the frozen_string_literal pragma comment to all Ruby files. (#4725) 2017-12-21 15:36:29 -02:00
Dan Schultzer
be2e17841e Separate Devise test methods from Devise 2017-04-29 10:24:22 -07:00
Ulisses Almeida
1ddca80cee Set the new default of sign_out_via config 2016-05-01 12:44:40 -03:00
Lucas Mazza
ec07bdb315 Do not use the dynamic :action segment on Omniauth routes.
This was deprecated on rails/rails#23980.

We now generate scope and provider specific routes, like `user_facebook_omniauth_callback`
or `user_github_omniauth_callback`.

We could deprecate the `omniauth_authorize_path` in favor of the generated routes, but
the `shared/links.html.erb` depends on it to generate all omniauth links at once.

Closes #3983.
2016-03-07 11:19:27 -03:00
Thomas Walpole
2024fca4df Rails 5 compatability. Remove rails < 4.1 and Ruby < 2.1 2015-12-11 09:47:30 -08:00
Lucas Mazza
3cd6e650ef 'eval_block' shouldn't be used since it is a private API.
This method was made private on Rails master @ d2d3376903
2014-07-29 18:22:42 -03:00
Carlos Antonio da Silva
f1d57d7791 Use a different mapping name for testing the omniauth callback failure
This leaks into Devise mappings overriding the existing :admin one, so
depending on the test seed it fails like this:

    $ TESTOPTS="--seed=9972" rake

    ==> Devise.orm = :active_record
    Run options: --seed=9972

    ...

      1) Failure:
      MappingTest#test_allows_path_to_be_given [./test/mapping_test.rb:31]:
      Expected: "admin_area"
        Actual: "admin"

Using a different name should avoid any test randomization issues.
2014-07-10 08:58:21 -03:00
Carlos Antonio da Silva
da01235a20 Fix test that checks for proper configuration of omniauth callback
Previously the test was raising an ArgumentError by mistake:

    ArgumentError: wrong number of arguments (0 for 1)
        actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:328:in `eval_block'`

The #eval_block method expects a proc/lambda argument that can be
instance_exec'ed, not a real block. In the Rails implementation the block
is passed to #draw, which calls #eval_block internally passing the block
along, but as a Proc argument and not as a block.

Also the error we were raising from #devise_for was a RuntimeError,
changed to the expected ArgumentError. Adding an assertion on top of the
expected message should ensure we won't have this issue again.

This was introduced in 29da146c07, related
to #2802.
2014-07-10 08:53:18 -03:00
Anshul Sharma
dc1b399a8b Updated ruby 1.9 hash syntax 2014-02-25 22:12:55 +05:30
Jeremy Ward
b50fa74596 Edit is now configurable for devise registrations via path_name. 2014-01-02 17:49:37 -08:00
schneems
a00921f417 [close #2755] Raise incompatible route error
Right now if you try to use a route that you have defined in your `omniauth_callbacks` but you have not declared that resource to be `omniauthable` you will get a weird route missing error which causes the user to look in the routes for the fix:

```ruby
devise_for  :users, controllers: {omniauth_callbacks: "users/omniauth_callbacks"}
```

This PR checks to see if the mapping of `:user` has the module `omniauthable` included in it when `omniauth_callbacks` is specified in the route. If it does not, an instructional error is raised:

```
Mapping omniauth_callbacks on a resource that is not omniauthable
Please add `devise :omniauthable` to the `User` model
```
2013-12-18 19:19:25 -06:00
Carlos Antonio da Silva
69f79ad446 Let Devise play with both Rails 3.2 and Rails 4 for now 2013-05-05 19:55:06 -03:00
Vasiliy Ermolovich
ed6e232756 assert_recognizes rises Assertion instead of RoutingError 2013-02-25 22:12:06 -03:00
Michael Reinsch
0315ca2701 fix for :host getting overwritten in scope[:options] and thus not generating URLs with correct hostnames 2012-02-17 19:14:42 +09:00
José Valim
5eebf74f69 Fix a bug where passing :format => false to devise_for was permanent, closes #1504 2011-12-12 09:25:19 +01:00
Brent J. Nordquist
7e711089a8 More transparent implementat'n of :format => false
Per josevalim, by setting {:format => false} in @scope[:options],
Rails will pick it up, without the need to alter each devise_*()
method individually.
2011-06-27 06:51:04 -05:00
Mac Martine
7631456047 Added support for Devise routes to honor constraints. 2011-06-16 21:24:20 -07:00
Sergey Kojin
58f8c7c613 support for named omniauth open_id strategies 2011-05-25 00:15:24 +04:00
Timo Schilling
5adb854aa5 add devise_for :only option
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-15 10:31:01 +02:00
bUg
6b04312be5 get -> match for omniauth callbacks
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-26 17:55:18 -02:00
José Valim
611261c64e More tests for Omniauth. 2010-10-18 15:00:34 +02:00
José Valim
ef3480004c Ensure we are pointing to the proper sessions controller on failure. 2010-09-26 21:12:05 +02:00
Martin Rehfeld
f3385e96ab use :sign_out_via to control the method(s) for the destroy_*_session_path route 2010-08-13 19:16:59 +08:00
José Valim
4ac6b6e407 Unit tests for OAuth. 2010-07-26 20:33:23 +02:00
José Valim
ac8221aca7 Add cancel to registrations controller as a way to delete information from session. 2010-07-26 20:33:22 +02:00
José Valim
ef841ca17d Start to add helpers for OAuth tests. 2010-07-26 20:33:22 +02:00
José Valim
6c5be8dfd5 Initial routes and module setup. 2010-07-26 20:32:04 +02:00
José Valim
7a1adbb61e Improve integration of devise with new router scope. 2010-07-04 11:53:12 +02:00
bodhi
c8ec42a41c Update documentation to track deprecation of :as in #devise_for 2010-05-19 15:50:48 +08:00
José Valim
f1bbce58f3 Add tests to previous commit. 2010-05-16 12:14:02 +02:00
José Valim
1c5d4771ff Initial work on making the authentication stack more flexible. 2010-03-29 16:13:19 +02:00
José Valim
ca4e09390e Compatibility with Ruby 1.9.1 and 1.9.2. 2010-03-26 11:27:19 +01:00
José Valim
3f0bae1968 Allow to give :skip in devise_for to skip routes for an specific controller. 2010-03-12 09:54:57 +01:00
José Valim
f6cc219210 Devise now allows you to have custom controlleers. Check the README for more information. 2010-02-17 13:15:19 +01:00
José Valim
02e8c04cde Update views generator and now have scoped views. 2010-02-17 12:26:54 +01:00
José Valim
e6e66481b8 Got all tests in test/models and failure app ones passing. 369 tests, 805 assertions, 13 failures, 2 errors. 2010-02-16 17:00:36 +01:00
José Valim
2761a75437 Refactor on routes. 2010-02-08 20:25:20 +01:00
Carlos Antonio da Silva
445070f6ec Use sign_up instead of registration in routes. Fix issue with users being signed in while attempting to sign up with info from already existing user. Also fix signed up flash. 2010-02-08 11:03:15 -02:00
Carlos Antonio da Silva
6b837cb285 Introducing Registerable module, allowing users to sign up. 2010-02-04 20:08:38 -02:00
José Valim
efc0ae230a Deprecate :all. 2010-01-13 19:45:24 +01:00
José Valim
0819f87255 Test different ORMs 2009-12-21 15:29:58 +01:00
Carlos Antonio da Silva
836770a9f2 Allow passing options from devise_for to route definitions, useful on subdomain scenarios. 2009-11-13 08:49:22 -02:00
José Valim
4debe4080b Allow :path_prefix to be given to devise_for. 2009-11-06 14:27:27 -02:00
Carlos A. da Silva
9a10709545 Fixing singular options for mappings. 2009-10-18 18:19:04 -02:00
Carlos A. da Silva
d87ff26cbd Allow setup of path_names in devise_for mapping for overwriting sign_in, sign_out, password and confirmation keywords. 2009-10-16 20:46:06 -03:00