Sha256: 6bfabfa5679d1e113e95ca34941b1ee3165835dac828520529cd822c5c82877d

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

require "test_helper"

class Sessions::SudosControllerTest < ActionDispatch::IntegrationTest
  setup do
    @<%= singular_table_name %>, @token = sign_in_as(<%= table_name %>(:lazaro_nixon))
    @<%= singular_table_name %>.sessions.last.update! sudo_at: 1.day.ago
  end

  test "should sudo" do
    post sessions_sudo_url, params: { password: "Secret1*3*5*" }, headers: { "Authorization" => "Bearer #{@token}" }
    assert_response :no_content
  end

  test "should not sudo with wrong password" do
    post sessions_sudo_url, params: { password: "SecretWrong1*3" }, headers: { "Authorization" => "Bearer #{@token}" }

    assert_response :bad_request
    assert_equal "The password you entered is incorrect", response.parsed_body["error"]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authentication-zero-2.10.0 lib/generators/authentication/templates/test_unit/controllers/api/sessions/sudos_controller_test.rb.tt
authentication-zero-2.9.3 lib/generators/authentication/templates/test_unit/controllers/api/sessions/sudos_controller_test.rb.tt