Sha256: e0b118a686d8a5e773536d89c2dad788a3969d69116e1b789d74e2df100f5e84

Contents?: true

Size: 1.24 KB

Versions: 12

Compression:

Stored size: 1.24 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
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
deviseOne-1.0.0 test/controllers/custom_registrations_controller_test.rb
devise-3.4.1 test/controllers/custom_registrations_controller_test.rb
devise-3.4.0 test/controllers/custom_registrations_controller_test.rb
brainsome_devise-3.3.0 test/controllers/custom_registrations_controller_test.rb
devise-3.3.0 test/controllers/custom_registrations_controller_test.rb
devbootsrap-0.0.7 test/controllers/custom_registrations_controller_test.rb
devbootsrap-0.0.6 test/controllers/custom_registrations_controller_test.rb
devbootsrap-0.0.5 test/controllers/custom_registrations_controller_test.rb
devbootsrap-0.0.4 test/controllers/custom_registrations_controller_test.rb
devbootsrap-0.0.3 test/controllers/custom_registrations_controller_test.rb
devbootsrap-0.0.2 test/controllers/custom_registrations_controller_test.rb
devbootsrap-0.0.1 test/controllers/custom_registrations_controller_test.rb