Commit Graph

32 Commits

Author SHA1 Message Date
Javi Martín
e2d9d0f2b4 Fix default dashboard actions factories
We had a trait called `:admin_request` for actions that are requests to
administrators, but the default factories were also requests to
administrators.

The tests checking that the "Request" button is not present, which
shouldn't pass with the wrong default factories, were passing by
coincidence. The issue was that we weren't checking whether that the
request had finished before checking that the "Request" button wasn't
present. That meant that we were checking that the "Request" button
wasn't there right at the moment we pressed the link, before the request
was finished.

So we're now checking that the request is finished before checking that
the button isn't there.

On the other hand, the tests checking for the "Request resource" link
being present were checking a behavior that's no longer there since
commit 9d85b3935, when we changed the conditions affecting that link.
2024-10-11 15:05:24 +02:00
Javi Martín
af0911a8d2 Fix warning in hidden proposals spec
We were checking the proposal video URL, but its value was `nil` since
commit bedcb5bca2. This resulted in a warning:

```
Checking for expected text of nil is confusing and/or pointless since it
will always match. Please specify a string or regexp instead.
spec/system/admin/hidden_proposals_spec.rb:14
```
2024-10-07 16:37:13 +02:00
Javi Martín
bedcb5bca2 Don't include videos in proposal factories
Since August 29, probably due to a change in the browser used by GitHub
Actions (since branches whose code we didn't change were suddenly
affected that day), many tests related to proposals are failing on
GitHub Actions. Although every time the test suite is run different
tests fail, on each run at least half a dozen tests fail.

Most tests have one thing in common: they click on an element on the
`proposals#show` page, and the click isn't done correctly.

One possible explanation is that the video included on the page causes
the page to scroll at the exact same time that Capybara is clicking on a
link, which results in a misclick.

I haven't been able to reproduce the issue on my machine, so I'm not
sure whether giving the video element a fixed height using CSS (so the
page doesn't scroll when the iframe is loaded) could solve the issue.
But, after using proposals without videos in the tests (except the tests
testing the videos themselves), all these tests are passing in the test
suite.

So, for now, we're simply removing the videos in the proposal factories.

Note this issue wasn't caused by the "no cookie" changes done in commit
ee64efe659, since running the tests in Cosul Democracy 2.1.1 (which
didn't contain those changes) also fails on GitHub Actions.
2024-09-17 15:09:17 +02:00
Javi Martín
614b4fbe4c Add and apply FactoryBot/AssociationStyle rule
This rule was added in rubocop-factory_bot 2.23.0. We were following it
sometimes, and sometimes we were not.
2023-09-08 13:52:54 +02:00
Javi Martín
65ed778226 Avoid removing other proposals map locations
It was possible to remove a map location from a different proposal (even
one created by a different author) by modifying the hidden `id`
parameter in the form.

So we're making sure the map location we destroy is the one associated
to the proposal we're updating.

Since we're now using the `@proposal` instance variable in the
`destroy_map_location_association` method, we're calling that method
after loading the resource with cancancan.
2023-04-28 17:11:59 +02:00
Senén Rodero Rodríguez
30afb64bac Do not consider attributes using the :unless option as required
Remove some of the factories introduced in commit 66334b5 as now we do
not need them anymore.

Co-Authored-By: Javi Martín <35156+javierm@users.noreply.github.com>
2021-11-05 16:40:36 +01:00
Javi Martín
480bb8cd55 Remove link column in dashboard actions
This column wasn't used in any released Consul version since it was only
used during development. For the same reason, the task to migrate the
information in the `link` column to the `links` table isn't needed
either.
2021-10-06 14:13:44 +02:00
Melvin Lammerts
c34aa54122 Remove skip map checkbox 2021-06-03 11:13:52 +02:00
Carlos Iniesta
67d61699b6 Restore all related content when a user is restored 2021-04-09 17:54:56 +02:00
Andrew Sims
95c82d8777 Changes following PR review
* Internationalisation for admin fields
* Correct typos
* Additional tests
* Replace ternary with if-then statement
2020-04-09 07:11:53 +10:00
Cassiano Sampaio
1e4f539104 Add title to differentiate signature sheets 2020-04-09 07:11:52 +10:00
Javi Martín
8f021cbfce Fix random title with trailing spaces
When the generated title for a dashboard action ended with a space, the
action `click_link(feature.title)` failed because the link shown in the
HTML ignores the trailing spaces.

Using `strip` solves the problem. Not the most elegant solution, though;
ideally we'd generate a better title.
2019-11-08 17:58:56 +01:00
Javi Martín
a727dcc031 Apply Style/SymbolProc rubocop rule
This style is much more concise.
2019-10-26 20:10:32 +02:00
Javi Martín
5ff1162038 Simplify creating follows in specs
While in theory we wouldn't need to use the `transient` nor the
`after(:create)` because there's already a `has_many :through`
association with followers, Factory Bot / ActiveRecord don't
automatically associate the followable, resulting in an invalid record
exception.
2019-09-30 13:34:31 +02:00
Javi Martín
818b442d52 Simplify creating voters in specs 2019-09-30 00:36:40 +02:00
Javi Martín
086e960d09 Add trait to simplify image creation in specs 2019-09-24 21:34:06 +02:00
Javi Martín
66334b5757 Add globalizable tests for all translatable models
So now we test in depth at the model level, and can be a bit more
relaxed about integration tests for translations.

Note we're defining some extra factories to make sure all translatable
attributes with presence validation rules are mandatory. This way we can
simplify the way we obtain required fields, using `required_attribute?`.
Otherwise, fields having an `unless` condition in their presence
validation rules would count as mandatory even when they're not.
2019-09-23 18:01:44 +02:00
Javi Martín
fc1a89e966 Use dynamic attributes in factories
Static attributes are deprecated since factory bot 4.11; we haven't
upgraded yet but now we're ready to do so:

https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11
2019-08-07 19:43:57 +02:00
taitus
837c45599d Rename SignatureSheet column
This new functionality will allow to retrieve in the signature sheet
the document number, the date of birth and the postal code.

So we renamed :document_numbers to :required_fields_to_veriry to
clarify and adjust the name to its use.
2019-07-29 13:10:09 +02:00
Senén Rodero Rodríguez
02be0c61f9 Add proposal translations
Adapt retire form to include needed translations and move validations
from controller to model.

Also change sanitizable concern to sanitize not marked for destruction
translations.
2019-06-27 09:19:36 +02:00
lalo
be8a0dbe8a Add Milestone tag select filter on executions public page 2019-06-07 14:17:32 +02:00
lalo
3282606be2 Add act_as_taggable_on milestoneable concern 2019-06-07 14:07:43 +02:00
Julian Herrero
9948804e21 Add selected attribute to proposals 2019-05-29 16:51:27 +02:00
decabeza
0995480b73 Remove question and external_url fields from proposals 2019-04-30 11:35:47 +02:00
decabeza
2cff3767c1 Remove open in new tab option for links 2019-04-24 13:58:13 +02:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
decabeza
747aec3506 Improves some code format details 2018-10-31 14:22:10 +01:00
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
Javi Martín
d7b9ed1bc4 Use dynamic times and dates in factories (part 2)
Most factories were using dynamic times and dates since commit 0cf799a.
However:

* At the time, commits AyuntamientoMadrid/consul@71f5351 and
AyuntamientoMadrid/consul@a476a30 (which introduced static times/dates
in factories) hadn't been backported.
* The changes in commit 0cf799a overlooked the factory
`proposal_notification`.
2018-09-19 14:21:21 +02:00
Pierre Mesure
cba6cc029e Split factories 2018-08-08 07:20:47 +02:00