Commit Graph

11 Commits

Author SHA1 Message Date
Andrei Prigorshnev
c5c043d9e2
DEV: support nil values in the eq_time matcher (#22116)
We use it like this:

    expect(message.created_at).to eq_time(created_at)

The problem is that if one of the values or both of them are `nil` the matcher fails 
with this error:

    NoMethodError: undefined method `-' for nil:NilClass

This commit adds support for `nil` values. If both time values are `nil` they are equal, 
if only one value is `nil` they aren't.
2023-06-20 19:06:40 +04:00
David Taylor
cb932d6ee1
DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
Joffrey JAFFEUX
8f5233a7bf
DEV: adds within_one_minute time matcher (#12109) 2021-02-17 10:52:49 +01:00
Joffrey JAFFEUX
7cad5dfa83
DEV: prevents time difference causing flaky spec (#12108) 2021-02-17 10:04:25 +01:00
Martin Brennan
efd5fb665b
DEV: Fix flaky time sensitive uploads.rake specs (#9283)
Also fix issues in spec where certain uploads were not considered secure
2020-03-26 13:31:39 +10:00
Sam Saffron
4ea21fa2d0 DEV: use #frozen_string_literal: true on all spec
This change both speeds up specs (less strings to allocate) and helps catch
cases where methods in Discourse are mutating inputs.

Overall we will be migrating everything to use #frozen_string_literal: true
it will take a while, but this is the first and safest move in this direction
2019-04-30 10:27:42 +10:00
Sam Saffron
9ebabc1de8 FEATURE: unconditionally update Topic updated_at when posts change in topic
Previously we would bypass touching `Topic.updated_at` for whispers and post
recovery / deletions.

This meant that certain types of caching can not be done where we rely on
this information for cache accuracy.

For example if we know we have zero unread topics as of yesterday and whisper
is made I need to bump this date so the cache remains accurate

This is only half of a larger change but provides the groundwork.

Confirmed none of our serializers leak out Topic.updated_at so this is safe
spot for this info

At the moment edits still do not change this but it is not relevant for the
unread cache.

This commit also cleans up some specs to use the new `eq_time` matcher for
millisecond fidelity comparison of times

Previously `freeze_time` would fudge this which is not that clean.
2019-03-28 17:28:01 +11:00
Arthur Neves
8f0fb511c3
Fix warnings for rspec 3 2015-04-25 21:02:06 -04:00
Luciano Sousa
b52f12948a models with rspec3 syntax 2015-01-05 13:04:23 -03:00
Akshay
7ef61144e7 Avoid using to_s when performing String Interpolation 2014-08-14 23:55:27 +05:30
Neil Lalonde
8e50b49cf1 Try to fix specs that are failing in jenkins 2013-06-27 17:23:06 -04:00