Commit graph

24 commits

Author SHA1 Message Date
Mantas Masalskis
a1b9ef2bbb Maintenance: Update copyright information. 2026-01-02 15:41:09 +02:00
Mantas Masalskis
10f627cb69 Maintenance: Update copyright information 2025-01-01 17:39:43 +02:00
Mantas Masalskis
9d50a0b5e7 Maintenance: Update to Ruby 3.2.2. 2024-01-03 08:47:59 +01:00
Dominik Klein
e054d6ca79 Maintenance: Update copyright information. 2024-01-02 11:55:19 +01:00
Martin Gruner
fc2491aabf Maintenance: Renamed confusing fields in the tokens table.
The Token model is used to store access tokens and had field names which may have caused confusion for developers using them. Therefore, the field previously called name: now has the correct identifier token: (as it stores the actual token value), and the field previously called label: is now called name: for better consistency with other models.
2023-04-11 12:50:56 +02:00
Martin Gruner
075de49227 Maintenance: Improve test stability by enforcing Faker.unique in factories. 2023-03-20 13:17:34 +01:00
Florian Liebe
9dfc232536 Maintenance: Update copyright information. 2023-01-02 16:19:55 +01:00
Florian Liebe
7be2fb875a Maintenance: Ensure correct functionality of Twitter integration. 2022-11-24 11:26:53 +01:00
Mantas Masalskis
f827174474 Maintenance: Improved handling of long passwords. 2022-04-20 07:28:46 +00:00
Martin Gruner
24c3bdfd87 Maintenance: Update copyright header. 2022-01-01 14:38:12 +01:00
Dominik Klein
467bc03224 Fixes #2389 - Enhance LDAP login to not affect "failed logins". 2021-08-16 08:49:32 +02:00
Rolf Schmidt
55ed75cfd7 Fixes #3113 - Prefer HTTP standard header "From" over custom "X-On-Behalf-Of" for impersonation. 2021-08-10 14:20:20 +00:00
Martin Gruner
0f61a7e6ca Maintenance: Updated all non-pinned gems.
Special thanks to @thorsteneckel for fixing the VCR/Twitter problems!
2021-07-01 11:23:52 +00:00
Martin Gruner
5df98684da Maintenance: Update copyright information and add a new rubocop cop to watch over it. 2021-06-01 12:20:20 +00:00
Thorsten Eckel
a56245defa Fixes #3468: Not authorized error using Im X-On-Behalf-Of. 2021-04-01 15:14:25 +00:00
Thorsten Eckel
83239518d0 Refactoring: Restore consistency by replacing *_user suffix factories with just customer, admin and agent factory name. 2020-06-20 11:15:52 +02:00
Mantas Masalskis
ddfbf6139e Maintenance: Unified :authenticated and :authenticated_as helpers to just :authenticated_as in system and request specs. 2020-06-18 13:51:25 +02:00
Ryan Lue
847cf02b49 Testing: Enhance authenticated_as spec helper
Originally, the `authenticated_as` spec helper
made it impossible to persist session state in request specs.
This made it impossible to test external_credentials#callback
or any other controller actions that rely on session state.

This commit fixes that.

=== How exactly was `authenticated_as` broken?

`authenticated_as` passes user credentials via request headers.
In practice, this auth method is for API requests by machine clients,
since they don't have cookies or store session state.

Because machine clients don't use cookies or session state anyway,
Zammad disables them for this auth method:

    # app/controllers/application_controller/authenticates.rb
     1 module ApplicationController::Authenticates
    42 def authentication_check_only(auth_param = {})
    57     request.session_options[:skip] = true

As a result, in tests using `authenticated_as`,
session data is discarded between every single request.
Some controller actions will not work without session data,
so this limitation made testing these actions impossible.

=== Why couldn't we just set the session values directly in test setup?

This is possible in controller tests,
but the Rails & RSpec team soft-deprecated controller tests
in favor of integration tests (request specs) a long time ago.

For more details, consider the following comments:

> The session is an internal structure for the controller.
> Integration test is more black box than controller tests were.
> I don't think we should be testing internals of the controller like this.
> I would rework the test to test something visible in the UI instead.
>
> --@dhh via https://github.com/rails/rails/issues/23386

> Integration tests doesn't allow you to set session.
>
> --@rafaelfranca via https://github.com/rails/rails/issues/25394

=== Solution

This commit adds a `via: :browser` option to the spec helper
which simply prepends a valid sign-in request to the spec example.
2020-04-28 13:40:15 +02:00
Mantas Masalskis
48766c7db9 Maintenance: Fixed caching issue in authenticate_as spec helper and enhanced capabilities. 2019-05-31 09:54:38 +02:00
Billy Zhou
8f04e32079 Closes #2531 which fixes #2534 - Agents should always be able to re-open closed tickets, regardless of group.follow_up_possible - huge thanks to @martinvonwittich! 2019-04-18 15:01:21 +02:00
Rolf Schmidt
14437f92f9 Migrated remaining Minitest controller tests to RSpec. 2018-12-05 11:43:53 +01:00
Rolf Schmidt
29b616d61d Refactored all controller mini tests and migrated them to rspec request specs 2018-09-19 15:54:49 +02:00
Ryan Lue
97f55bcd83 Add error check if Exchange config gives empty folder list (fixes #1802) 2018-07-11 09:52:38 +08:00
Thorsten Eckel
7750f4cdca Migrated RSpec UserController test to request test because controller tests are soft deprecated. 2018-07-09 13:00:52 +02:00