Commit Graph

17 Commits

Author SHA1 Message Date
Javi Martín
58c9e8462d Only seed tenants when necessary in tests
On my machine, seeding a tenant takes about one second, so skipping this
action when it isn't necessary makes tests creating tenants faster
(although creating a tenant still takes about 3-4 seconds on my
machine).
2022-11-11 01:40:02 +01:00
Javi Martín
d904fe8b4f Move subdomain logic to tenant model
We had some of the logic in the ApplicationMailer. Since we're going to
use this logic in more places, we're moving it to the Tenant model,
which is the model handling everything related to hosts.
2022-11-09 18:19:20 +01:00
Javi Martín
5100884110 Generate one sitemap per tenant
Note that the `sitemap:refresh` task only pings search engines at the
end, so it only does so for the `Sitemap.default_host` defined last. So
we're using the `sitemap:refresh:no_ping` task instead and pinging
search engines after creating each sitemap.

Note we're pinging search engines in staging and preproduction
environments. I'm leaving it that way because that's what we've done
until now, but I wonder whether we should only do so on production.

Since we're creating a new method to get the current url_options, we're
also using it in the dev_seeds.
2022-11-09 18:19:20 +01:00
Javi Martín
cc87bca500 Use have_content in sitemap tests
That's what we're using in most of our tests, and we were using it in
some expectations in these tests as well.
2022-11-09 18:19:20 +01:00
Javi Martín
22ffbd4d2b Remove redundant tests in sitemap specs
Testing that the sitemap is valid (which we test in the following test)
also checks that the sitemap has been generated. The test will also fail
with different errors depending on whether no file was generated or the
generated file is invalid.
2022-11-09 18:19:20 +01:00
Javi Martín
0d4a032f52 Add and apply Lint/NonAtomicFileOperation rule
This rule was added in Rubocop 1.31.0; it follows the principles
mentioned in the Ruby Style Guide [1].

https://rubystyle.guide/#atomic-file-operations
2022-10-19 14:26:49 +02:00
Javi Martín
9427f01442 Use system specs instead of feature specs
We get rid of database cleaner, and JavaScript tests are faster because
between tests we now rollback transactions instead of truncating the
database.
2020-04-24 15:43:54 +02:00
Julian Herrero
6e00842b0e Don't include disabled processes in sitemap 2019-12-19 13:26:29 +07:00
Javi Martín
91c21b0982 Remove instance variables in RSpec
Instance variables might lead to hard-to-detect issues, since using a
nonexistent instance variable will return `nil` instead of raising an
error.
2019-09-30 16:43:10 +02:00
Javi Martín
307cf24846 Use describe on feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
2019-05-28 16:36:54 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Javier Martín
4f9ca04a84 Merge pull request #3057 from consul/backport-make-milestones-polymorphic
[Backport] Make milestones polymorphic
2018-12-05 12:12:04 +01:00
decabeza
04e3bf5797 Removes references to deleted general terms page 2018-12-04 17:25:34 +01:00
Javi Martín
1a5b73a0bd Don't load tasks several times in specs
Calling `load_tasks` in several files made rails load the tasks several
times, and so they were executed several times when called.

Since the milestone migration can't be executed twice in a row (it would
fail with duplicated ID records), loading the tasks several times made
the milestone migrations task specs fail.
2018-11-30 14:15:21 +01:00
decabeza
286371c9d9 Changes more_info folder and path to help 2018-01-30 18:26:30 +01:00
Bertocq
3509bfe3e4 Remove spending proposals from sitemap and its test, deprecated model 2018-01-07 15:38:44 +01:00
Angel Perez
6107f51b19 Add specs for valid sitemap generation (#2219) 2018-01-05 15:16:41 -04:00