Commit Graph

15545 Commits

Author SHA1 Message Date
Javi Martín
95a90b1895 Simplify method to calculate document max size
Since we're only doing the convertion from bytes to megabytes in one
place, IMHO adding an extra method makes the code harder to read.

This way we don't have do include the DocumentsHelper in the specs
anymore, reducing the risk of possible method naming collisions.
2020-04-16 12:08:09 +02:00
Javi Martín
ca2dc10ee9 Simplify method to check an image max size
We were converting megabytes to bytes with the `megabytes` method and
then adding a `bytes_to_megabytes` method to convert it back to bytes,
which is the same as not doing anything at all :).
2020-04-16 12:08:09 +02:00
Javi Martín
2cd4696244 Don't include unneeded helpers in tests
Including them might lead to conflicts since two methods might have the
same name. For example, we're getting some exceptions when taking
screenshots of a failing test, because the method `image_path` from
`ActionView::Helpers::AssetUrlHelper` has the same name as a method used
to save the screenshot.

Besides, we were including all helpers in places were only the `dom_id`
method is used, and in other places where no helper methods were used at
all. So we can just invoke `ActionView::RecordIdentifier.dom_id`
directly.
2020-04-16 12:08:09 +02:00
Javi Martín
7491f44d54 Remove unused shared specs
These tests aren't used since commit 4db54092.
2020-04-16 00:00:38 +02:00
decabeza
a8537f7e19 Replace equalizer to display flex on cards 2020-04-14 17:14:52 +02:00
Paweł Świątkowski
d99875cde2 Get search dictionary based on I18n.default_locale (merge pull request #3856)
Implementation tries to be open for further extensions, such as deciding on
search dictionary based on configuration option or by locale set for
given user.
2020-04-12 14:22:36 +02:00
Javier Martín
426c1c5fd2 Merge pull request #3969 from consul/fix_legislation_tag_order
Order legislation process tags alphabetically
2020-04-10 21:14:29 +02:00
Javi Martín
4b043f2207 Order legislation process tags alphabetically
The method `tag_list_on` doesn't add an `ORDER_BY` clause to the SQL
query it generates, and so results may come in any order.

However, in the tests we were assuming the tags were ordered by ID in
descending order. Since that isn't always the case, the tests were
failing sometimes.

Ordering the tags alphabetically solves the problem. We could also use
the same order admins used when adding the tags:

```
@process.customs.order("taggings.created_at").pluck(:name).join(", ")
```

However, I'm not sure it improves the user experience, and it makes the
code more complicated.
benefit to administratos.
2020-04-10 20:36:17 +02:00
Javier Martín
c9a95c1818 Merge pull request #3968 from consul/fix_flaky_ckeditor_spec
Fix flaky spec: Admin Active polls Add
2020-04-10 17:47:49 +02:00
Javi Martín
2cdc6a1b1b Check CKEditor is filled properly in tests
It looks like sometimes, particularly when the first thing we do after
loading a page is filling the CKEditor fields and submitting the form,
CKEditor doesn't have enough time to format the text, and so it's sent
as plain text instead of HTML. This behaviour can be reproduced on my
local machine after upgrading to Rails 5.1, with the test "Admin Active
polls Add" failing 100% of the time.

Checking CKEditor has been filled in correctly solves the issue.
2020-04-10 17:11:56 +02:00
Javi Martín
a0ea1f6ecb Simplify CKEditor translatable fields in specs
We've simplified the way CKEditor is handled in tests; probably due to
that, we don't need this method anymore.
2020-04-10 15:14:15 +02:00
Javier Martín
06bc72cc66 Merge pull request #3959 from consul/i18n-custom-translations
Fix custom translations with options
2020-04-10 12:51:23 +02:00
decabeza
af1e11838c Fix custom translations with options 2020-04-10 12:17:27 +02:00
Javier Martín
afea0feb96 Merge pull request #3967 from consul/duplicate_by_tag
Fix duplicate records in investments by tag
2020-04-09 21:47:35 +02:00
Javi Martín
958d373247 Fix duplicate records in investments by tag
When an investment had been assigned a user tag and a valuation tag with
the same name, it appeared twice when filtering by tag.

This is because by design, in order to provide compatibility with scopes
using "select" or "distinct", the method `tagged_with` doesn't select
unique records.

Forcing the query to return unique records solves the issue.
2020-04-09 21:09:28 +02:00
Javier Martín
b5682362b7 Merge pull request #3966 from consul/remove_unused_filter
Remove unused tag filter
2020-04-09 21:08:42 +02:00
Javier Martín
54095c4765 Merge pull request #3940 from andrewcameronsims/feature/3557-add_title_to_differentiate_signature_sheets
Add title to differentiate signature sheets
2020-04-09 12:46:33 +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
b483d50d30 Remove unused tag filter
This filter was added in commit 4285ba4b, it was changed in commit
002d8688, and most of the code from the original commit has disappeared
without a trace (maybe due to a merge conflict?).

This filter could actually be useful if we started using it when users
click on a tag. Since we don't, I'm removing it. We might add it back if
we decide to actually use it.
2020-04-08 13:49:48 +02:00
Javier Martín
54c6b413ce Merge pull request #3963 from consul/escape_xss
Apply escape_javascript security patch
2020-04-07 15:08:18 +02:00
Javier Martín
7212f6d701 Merge pull request #3788 from consul/dependabot/bundler/capybara-3.29.0
Bump capybara from 2.17.0 to 3.29.0
2020-04-06 20:34:37 +02:00
Javi Martín
fe20688d47 Update test of text with position:absolute
The following code:

```
<span class="show-for-sr">You're on page</span> 1
```

Will generate an element with `position: absolute`. When reading the
contents, it's not clear whether this element is supposed to be in the
 same paragraph or in a different one. Currently Capybara treats it as
if it were part of a different paragraph.

Since this could be the way screen readers read the text, I'm changing
the test to reflect this fact. We might change our minds in the future.
2020-04-06 20:11:44 +02:00
Javi Martín
971571b54b Simplify testing followables flash messages
Checking the whole text is tricky because the text has a `<br>` tag, and
now Capybara doesn't normalize whitespace by default anymore.

Here are a couple more options we could use:

```
expect(page).to have_content strip_tags(message.gsub(/\s*<br>\s*/,"\n"))

expect(page).to have_content strip_tags(message), normalize_ws: true
```

But then developers would wonder why we're doing all this, and would
need an extra effort to fully understand the test.

Since the tests are only checking the presence of the flash message,
checking a relevant part of the test is enough, works with any version
of Capybara, and makes the test easy to follow.
2020-04-06 20:11:44 +02:00
Javi Martín
3a15bed471 Use JavaScript driver in ballot sheet spec
With the rack driver, the `ballot_sheet.data` text was being converted
from newline characters to whitespace, while with the JavaScript driver
we get newline characters for `<br>` tags, as we expect.
2020-04-06 20:11:44 +02:00
dependabot-preview[bot]
781188758a Bump capybara from 2.17.0 to 3.29.0
Bumps [capybara](https://github.com/teamcapybara/capybara) from 2.17.0 to 3.29.0.
- [Release notes](https://github.com/teamcapybara/capybara/releases)
- [Changelog](https://github.com/teamcapybara/capybara/blob/master/History.md)
- [Commits](https://github.com/teamcapybara/capybara/compare/2.17.0...3.29.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-06 20:11:44 +02:00
Javi Martín
03c135e5fd Apply escape_javascript security patch
This patch was included in the Rails 5.2.x series, but since we haven't
upgraded yet, we need to apply it manually.
2020-04-06 16:19:44 +02:00
Javier Martín
b53d14599e Merge pull request #3951 from consul/dependabot/bundler/json-2.3.0
[Security] Bump json from 2.1.0 to 2.3.0
2020-04-06 16:00:57 +02:00
Javier Martín
0d43d677da Merge pull request #3477 from PierreMesure/upgrade-tag-to-category
Fix a bug where a category can't be created if it already exists as a tag
2020-04-06 15:52:52 +02:00
Andy Sims
74fbde09f1 Support creates follow (Merge pull request #3895)
* Supporting a proposal will create a follow relationship
* Only followers receive notifications
2020-04-06 15:26:47 +02:00
Pierre Mesure
67911b4e35 Simplify the method and fix Rubocop warnings 2020-03-30 21:52:31 +02:00
Pierre Mesure
055ff803c6 Fix a bug where a category can't be created if it already exists as a tag (+ spec) 2020-03-30 21:41:52 +02:00
Srinandan Pai
14106ce800 Issue-1794: Allow to hide proposals created by admin (#3884) 2020-03-26 15:07:55 +01:00
dependabot-preview[bot]
73cdc60ed7 [Security] Bump json from 2.1.0 to 2.3.0
Bumps [json](https://github.com/flori/json) from 2.1.0 to 2.3.0. **This update includes a security fix.**
- [Release notes](https://github.com/flori/json/releases)
- [Changelog](https://github.com/flori/json/blob/master/CHANGES.md)
- [Commits](https://github.com/flori/json/compare/v2.1.0...v2.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-19 16:12:36 +00:00
Javier Martín
a8fe6b8627 Merge pull request #3943 from consul/dependabot/bundler/user_agent_parser-2.6.0
[Security] Bump user_agent_parser from 2.4.1 to 2.6.0
2020-03-10 20:21:33 +01:00
dependabot-preview[bot]
2fccacfb10 [Security] Bump user_agent_parser from 2.4.1 to 2.6.0
Bumps [user_agent_parser](https://github.com/ua-parser/uap-ruby) from 2.4.1 to 2.6.0. **This update includes a security fix.**
- [Release notes](https://github.com/ua-parser/uap-ruby/releases)
- [Commits](https://github.com/ua-parser/uap-ruby/compare/v2.4.1...v2.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-10 19:48:29 +01:00
Javier Martín
448b8ce4c5 Merge pull request #3867 from consul/release_1.1.0
Release version 1.1.0
2020-03-10 19:12:40 +01:00
Javi Martín
90915cc95c Release version 1.1.0 2020-03-10 18:44:40 +01:00
Javier Martín
e68316fc85 Merge pull request #3942 from rockandror/i18n_crowdin
Update translations from Crowdin
2020-03-10 18:44:24 +01:00
Javier Martín
47f20c2dca Merge pull request #3941 from rockandror/fix-wrong-translation
Fix English text written in Spanish
2020-03-10 18:08:16 +01:00
Senén Rodero Rodríguez
37dbe1ca42 Update translations from Crowdin 2020-03-10 16:50:52 +01:00
Senén Rodero Rodríguez
11f778b09f Change translation language 2020-03-10 15:48:45 +01:00
Javier Martín
2580523ec1 Merge pull request #3938 from consul/deploy_branch
Allow deploying a specific branch to production
2020-03-10 12:38:49 +01:00
Julian Herrero
1b683ad0da Allow deploying a specific branch to production
We could also use the deploy-secrets file; here we use `ENV["branch"]`
for consistency with other environments.
2020-03-09 13:16:47 +01:00
Javier Martín
0b33768ed1 Merge pull request #3934 from consul/dependabot/bundler/puma-4.3.3
[Security] Bump puma from 4.3.1 to 4.3.3
2020-03-04 13:55:26 +01:00
dependabot-preview[bot]
41777c93e6 [Security] Bump puma from 4.3.1 to 4.3.3
Bumps [puma](https://github.com/puma/puma) from 4.3.1 to 4.3.3. **This update includes security fixes.**
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v4.3.1...v4.3.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-01 22:55:54 +00:00
Javier Martín
1e94a7c71a Merge pull request #3931 from consul/bundler_version
Specify which bundler version to install
2020-02-27 18:08:10 +01:00
Javi Martín
e1e2329189 Specify which bundler version to install
We're now using the same version we used to generate our Gemfile.lock.

Using the latest bundler we got a deprecation warning, which might turn
into an error in the future:

[DEPRECATED] The `--deployment` flag is deprecated because it relies on
being remembered across bundler invocations, which bundler will no
longer do in future versions.

We could also upgrade to bundler 2.x, but since we're using Ruby 2.4 and
Ruby 2.6 comes with bundler 1.17, we've decided to keep this version.
2020-02-27 17:33:21 +01:00
Javier Martín
1d0cfdde32 Merge pull request #3929 from consul/fix_unselecting_spec
Fix flaky spec when unselecting an investment
2020-02-26 17:57:23 +01:00
Javier Martín
9d750dd399 Merge pull request #3917 from rockandror/improve-remote-translations
Improve remote translations
2020-02-26 17:29:14 +01:00