mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Merge pull request #2822 from plataformatec/rails-4.1
Fix specs on Rails 4.1
This commit is contained in:
commit
72a0d9e350
6 changed files with 33 additions and 16 deletions
|
@ -11,7 +11,7 @@ group :test do
|
||||||
gem "omniauth-facebook"
|
gem "omniauth-facebook"
|
||||||
gem "omniauth-openid", "~> 1.0.1"
|
gem "omniauth-openid", "~> 1.0.1"
|
||||||
gem "webrat", "0.7.3", :require => false
|
gem "webrat", "0.7.3", :require => false
|
||||||
gem "mocha", "~> 0.13.1", :require => false
|
gem "mocha", "~> 0.14", :require => false
|
||||||
end
|
end
|
||||||
|
|
||||||
platforms :jruby do
|
platforms :jruby do
|
||||||
|
|
|
@ -113,8 +113,11 @@ class HelpersTest < ActionController::TestCase
|
||||||
|
|
||||||
test 'navigational_formats not returning a wild card' do
|
test 'navigational_formats not returning a wild card' do
|
||||||
MyController.send(:public, :navigational_formats)
|
MyController.send(:public, :navigational_formats)
|
||||||
Devise.navigational_formats = [:"*/*", :html]
|
|
||||||
assert_not @controller.navigational_formats.include?(:"*/*")
|
swap Devise, :navigational_formats => ['*/*', :html] do
|
||||||
|
assert_not @controller.navigational_formats.include?("*/*")
|
||||||
|
end
|
||||||
|
|
||||||
MyController.send(:protected, :navigational_formats)
|
MyController.send(:protected, :navigational_formats)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,17 +5,21 @@ class SessionsControllerTest < ActionController::TestCase
|
||||||
include Devise::TestHelpers
|
include Devise::TestHelpers
|
||||||
|
|
||||||
test "#create doesn't raise unpermitted params when sign in fails" do
|
test "#create doesn't raise unpermitted params when sign in fails" do
|
||||||
ActiveSupport::Notifications.subscribe /unpermitted_parameters/ do |name, start, finish, id, payload|
|
begin
|
||||||
flunk "Unpermitted params: #{payload}"
|
subscriber = ActiveSupport::Notifications.subscribe /unpermitted_parameters/ do |name, start, finish, id, payload|
|
||||||
|
flunk "Unpermitted params: #{payload}"
|
||||||
|
end
|
||||||
|
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
|
request.session["user_return_to"] = 'foo.bar'
|
||||||
|
create_user
|
||||||
|
post :create, :user => {
|
||||||
|
:email => "wrong@email.com",
|
||||||
|
:password => "wrongpassword"
|
||||||
|
}
|
||||||
|
assert_equal 200, @response.status
|
||||||
|
ensure
|
||||||
|
ActiveSupport::Notifications.unsubscribe(subscriber)
|
||||||
end
|
end
|
||||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
|
||||||
request.session["user_return_to"] = 'foo.bar'
|
|
||||||
create_user
|
|
||||||
post :create, :user => {
|
|
||||||
:email => "wrong@email.com",
|
|
||||||
:password => "wrongpassword"
|
|
||||||
}
|
|
||||||
assert_equal 200, @response.status
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "#create works even with scoped views" do
|
test "#create works even with scoped views" do
|
||||||
|
|
|
@ -63,7 +63,7 @@ class TrackableHooksTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not update anything if user has signed out along the way" do
|
test "does not update anything if user has signed out along the way" do
|
||||||
swap Devise, :allow_unconfirmed_access_for => 0 do
|
swap Devise, :allow_unconfirmed_access_for => 0.days do
|
||||||
user = create_user(:confirm => false)
|
user = create_user(:confirm => false)
|
||||||
sign_in_as_user
|
sign_in_as_user
|
||||||
|
|
||||||
|
|
10
test/support/action_controller/record_identifier.rb
Normal file
10
test/support/action_controller/record_identifier.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Since webrat uses ActionController::RecordIdentifier class that was moved to
|
||||||
|
# ActionView namespace in Rails 4.1+
|
||||||
|
|
||||||
|
unless defined?(ActionController::RecordIdentifier)
|
||||||
|
require 'action_view/record_identifier'
|
||||||
|
|
||||||
|
module ActionController
|
||||||
|
RecordIdentifier = ActionView::RecordIdentifier
|
||||||
|
end
|
||||||
|
end
|
|
@ -17,7 +17,7 @@ class TestHelpersTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test "redirects if attempting to access a page with an unconfirmed account" do
|
test "redirects if attempting to access a page with an unconfirmed account" do
|
||||||
swap Devise, :allow_unconfirmed_access_for => 0 do
|
swap Devise, :allow_unconfirmed_access_for => 0.days do
|
||||||
user = create_user
|
user = create_user
|
||||||
assert !user.active_for_authentication?
|
assert !user.active_for_authentication?
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class TestHelpersTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns nil if accessing current_user with an unconfirmed account" do
|
test "returns nil if accessing current_user with an unconfirmed account" do
|
||||||
swap Devise, :allow_unconfirmed_access_for => 0 do
|
swap Devise, :allow_unconfirmed_access_for => 0.days do
|
||||||
user = create_user
|
user = create_user
|
||||||
assert !user.active_for_authentication?
|
assert !user.active_for_authentication?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue