Commit Graph

44 Commits

Author SHA1 Message Date
Loïc Guitaut 3eaac56797 DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
Phil Pirozhkov 493d437e79
Add RSpec 4 compatibility (#17652)
* Remove outdated option

04078317ba

* Use the non-globally exposed RSpec syntax

https://github.com/rspec/rspec-core/pull/2803

* Use the non-globally exposed RSpec syntax, cont

https://github.com/rspec/rspec-core/pull/2803

* Comply to strict predicate matchers

See:
 - https://github.com/rspec/rspec-expectations/pull/1195
 - https://github.com/rspec/rspec-expectations/pull/1196
 - https://github.com/rspec/rspec-expectations/pull/1277
2022-07-28 10:27:38 +08:00
David Taylor c9dab6fd08
DEV: Automatically require 'rails_helper' in all specs (#16077)
It's very easy to forget to add `require 'rails_helper'` at the top of every core/plugin spec file, and omissions can cause some very confusing/sporadic errors.

By setting this flag in `.rspec`, we can remove the need for `require 'rails_helper'` entirely.
2022-03-01 17:50:50 +00:00
Gerhard Schlager 92e222d246
FIX: POP3 polling shouldn't stop after exception or old email (#12742) 2021-04-19 10:27:29 +02:00
Martin Brennan 5710d5d771
FIX: Do not process pop3 mails > 1 week old (#11740)
This adds a safe default to not process pop3 emails when the pop3 polling option is set up that are > 1 week old. This is to avoid the situation where an older mailbox is used, which causes us to go and process all emails in that mailbox, sending out error emails to the senders of emails which cannot be parsed successfully.
2021-01-19 09:49:50 +10:00
Joffrey JAFFEUX 0d3d2c43a0
DEV: s/\$redis/Discourse\.redis (#8431)
This commit also adds a rubocop rule to prevent global variables.
2019-12-03 10:05:53 +01:00
Krzysztof Kotlarek 427d54b2b0 DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. 

We no longer need to use Rails "require_dependency" anywhere and instead can just use standard 
Ruby patterns to require files.

This is a far reaching change and we expect some followups here.
2019-10-02 14:01:53 +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
Daniel Waterworth ad44243a57 Removed unused let blocks (#7446)
The bodies of these blocks were never evaluated.
2019-04-29 15:08:56 +08:00
Gerhard Schlager 24e5be3f0c FIX: Relative links in translations should work with subfolder 2018-11-08 23:31:05 +00:00
Gerhard Schlager 50192de046 Fix the specs 2018-06-25 16:18:07 +10:00
Ernesto Serrano 93e60a59f5 Added rspec test 2018-06-25 16:18:07 +10:00
Régis Hanol 214f5bff5c don't send more than 1 reply per day to auto-generated emails 2016-06-28 16:42:05 +02:00
Guo Xiang Tan e3e31441b8
FIX: Random Redis connection timeout failure in Travis. 2016-05-18 10:42:40 +08:00
Guo Xiang Tan 4e59ec5a60
Fix the build. 2016-05-16 18:22:03 +08:00
Régis Hanol aa5ea719ee fix build 2016-05-06 19:50:44 +02:00
Guo Xiang Tan f95cefd09a FEATURE: Add POP3 timeout error only after 3 failures in a row. 2016-04-14 08:55:19 +08:00
Guo Xiang Tan 5734c7f3f3 FIX: Don't send rejection mailer to bounced emails. 2016-04-07 22:21:17 +08:00
Régis Hanol 3083657358 FEATURE: better email in support
FEATURE: new incoming_email model
FEATURE: infinite scrolling in emails admin
FEATURE: new 'emails:import' rake task
2016-01-19 00:57:55 +01:00
Régis Hanol 51b2279af0 fix the build 2015-12-16 01:31:19 +01:00
Andy Waite 3e50313fdc Prepare for separation of RSpec helper files
Since rspec-rails 3, the default installation creates two helper files:
* `spec_helper.rb`
* `rails_helper.rb`

`spec_helper.rb` is intended as a way of running specs that do not
require Rails, whereas `rails_helper.rb` loads Rails (as Discourse's
current `spec_helper.rb` does).

For more information:

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files

In this commit, I've simply replaced all instances of `spec_helper` with
`rails_helper`, and renamed the original `spec_helper.rb`.

This brings the Discourse project closer to the standard usage of RSpec
in a Rails app.

At present, every spec relies on loading Rails, but there are likely
many that don't need to. In a future pull request, I hope to introduce a
separate, minimal `spec_helper.rb` which can be used in tests which
don't rely on Rails.
2015-12-01 20:39:42 +00:00
Arpit Jalan e6df97f01d FIX: add email reply error message for topic not getting created in restricted category 2015-04-10 17:11:52 +05:30
riking 5657006aca Rename handle_exception to handle_job_exception 2015-02-09 12:47:46 -08:00
Luciano Sousa b3d769ff4f Update rspec syntax to v3
update rspec syntax to v3

change syntax to rspec v3

oops. fix typo

mailers classes with rspec3 syntax

helpers with rspec3 syntax

jobs with rspec3 syntax

serializers with rspec3 syntax

views with rspec3 syntax

support to rspec3 syntax

category spec with rspec3 syntax
2015-01-05 11:59:30 -03:00
Arpit Jalan b37d845dd3 FIX: email replies should not be accepted for deleted topics 2014-10-27 13:05:33 +05:30
Arpit Jalan 08dc0e6ee6 FIX: email replies to closed topic should not be accepted 2014-10-25 23:47:13 +05:30
Sam 59d04c0695 Internal renaming of elder,leader,regular,basic to numbers
Changed internals so trust levels are referred to with

TrustLevel[1], TrustLevel[2] etc.

This gives us much better flexibility naming trust levels, these names
are meant to be controlled by various communities.
2014-09-05 15:20:52 +10:00
Sam c07d76677d Merge pull request #2701 from riking/email-pr-ssl
Rename POP3 settings, fix multisite SSL state leak
2014-08-29 10:02:05 +10:00
riking 1c9f6159cd Update the Receiver and PollMailbox specs for the changes
Tests are both added, moved, and deleted.

Add test for topic not being created

Move html_only.eml to parse_body testing section
2014-08-28 14:38:19 -07:00
riking e28ef099a4 Fix pop3 SSL state leaking over multisite 2014-08-26 17:03:58 -07:00
riking 6d357c9c23 Rename pop3s settings to pop3, remove 'insecure' 2014-08-26 17:03:58 -07:00
riking 5ae0b9ba42 Remove debugging prints 2014-08-21 17:29:33 -07:00
riking cce8b4720a Have reciever handle multiple To addresses 2014-08-13 11:43:49 -07:00
riking 63cdde3d96 Add more tests, undo some changes to fixture files
Was causing Email::Reciever tests to fail
2014-08-01 12:40:28 -07:00
riking 0faea8ee0b Attempt at checking throws.... 2014-08-01 11:38:44 -07:00
riking c0b2b9b341 Refactor out handle_failure method in PollMailbox 2014-08-01 11:12:06 -07:00
riking d7df4e5979 Start making better-written tests for the email job 2014-08-01 11:03:16 -07:00
riking c8d322d1be Include the email subject line in rejection messages
This change has a tradeoff.
It increases our backscatter vulnerability - the subject could have spammy content - but it's extremely valuable to the user to know exactly which message was rejected.
If you sent two at the same time, and only one was rejected, you would have no way of knowing which worked and which to resend without going to the website (which is what email-in is trying to avoid, kinda).
2014-07-17 10:25:53 -07:00
riking 07cedb7946 Fix specs, handle_exception calls 2014-06-30 15:16:16 -07:00
riking da9048f3ea Fix email code & tests 2014-06-27 12:04:31 -07:00
Sam 6527862195 Remove fragile spec 2014-06-26 10:21:19 +10:00
riking 7ab5d3c018 Fix specs 2014-06-23 18:12:20 -07:00
Régis Hanol c3a1c867dd REFACTOR: poll mailbox specs 2014-04-09 19:26:19 +02:00
Sam f0a122a66c move job files so they live underneath app/ and not in lib/
introduce new setting email_always, that will force emails to send to users regardless of presence on site
2013-10-01 17:04:02 +10:00