Sha256: 8e2ff39a76db7214502e42acc265c2fa9651cb19566de0c0022b86e08a757d91

Contents?: true

Size: 1.39 KB

Versions: 11

Compression:

Stored size: 1.39 KB

Contents

require 'test_helper'

class CustomRegistrationsControllerTest < ActionController::TestCase
  tests Custom::RegistrationsController

  include Devise::TestHelpers

  setup do
    request.env["devise.mapping"] = Devise.mappings[:user]
    @password = 'password'
    @user = create_user(password: @password, password_confirmation: @password).tap(&:confirm)
  end

  test "yield resource to block on create success" do
    post :create, { user: { email: "user@example.org", password: "password", password_confirmation: "password" } }
    assert @controller.create_block_called?, "create failed to yield resource to provided block"
  end

  test "yield resource to block on create failure" do
    post :create, { user: { } }
    assert @controller.create_block_called?, "create failed to yield resource to provided block"
  end

  test "yield resource to block on update success" do
    sign_in @user
    put :update, { user: { current_password: @password } }
    assert @controller.update_block_called?, "update failed to yield resource to provided block"
  end

  test "yield resource to block on update failure" do
    sign_in @user
    put :update, { user: { } }
    assert @controller.update_block_called?, "update failed to yield resource to provided block"
  end

  test "yield resource to block on new" do
    get :new
    assert @controller.new_block_called?, "new failed to yield resource to provided block"
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
devise-3.5.10 test/controllers/custom_registrations_controller_test.rb
devise-3.5.9 test/controllers/custom_registrations_controller_test.rb
devise-3.5.8 test/controllers/custom_registrations_controller_test.rb
devise-3.5.7 test/controllers/custom_registrations_controller_test.rb
devise-3.5.6 test/controllers/custom_registrations_controller_test.rb
devise-3.5.5 test/controllers/custom_registrations_controller_test.rb
devise-3.5.4 test/controllers/custom_registrations_controller_test.rb
devise-3.5.3 test/controllers/custom_registrations_controller_test.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/devise-3.5.2/test/controllers/custom_registrations_controller_test.rb
devise-3.5.2 test/controllers/custom_registrations_controller_test.rb
devise-3.5.1 test/controllers/custom_registrations_controller_test.rb