Commit Graph

357 Commits

Author SHA1 Message Date
Javi Martín
eb7a052207 Simplify tests using delayed_job
Among other advantages, now we can run these tests with
`rspec --tag delayed_jobs`.
2019-09-23 13:47:45 +02:00
Javi Martín
da121ebc53 Remove redundant setting resets in after blocks
Settings are stored in the database, and so any changes to the settings
done during the tests are automatically rolled back between one test and
the next one.

There were also a few places where we weren't using an `after` block but
changing the setting at the end of the test.
2019-09-23 13:47:45 +02:00
Javi Martín
59e107e565 Apply RSpec/HookArgument rubocop rule 2019-09-10 21:43:39 +02:00
Javi Martín
58ba517717 Apply RSpec/ExampleWording rubocop rule 2019-09-10 21:43:39 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
e252d82cdb Apply IndentationWidth rubocop rule 2019-09-10 20:02:15 +02:00
Javi Martín
9cff2ac56b Improve expectations in notifiable specs
Sometimes during this test some comments are not created (so far we
don't know why), but since all comments had the same text, we didn't
notice when checking the text of the comment was on the page.
2019-08-07 14:19:14 +02:00
Senén Rodero Rodríguez
d3422acbb7 Add validation to check translations amount on updates
In order to not allow users to remove all persited
translations from any resource. A few exceptions were
added:

* Does not apply to globalizable models without
   translatable attributes required
* Make a copy of main model error on current translations to be more realistic
2019-07-02 17:15:16 +02:00
Senén Rodero Rodríguez
0bbc6be141 Add specs to check how visibility of translations interface behaves
Co-Authored-By: Sebastia <sebastia.roig@gmail.com>
2019-07-01 14:49:44 +02:00
Senén Rodero Rodríguez
c0b4bb67eb Adapt shared specs to new translations interface 2019-07-01 14:49:44 +02:00
Senén Rodero Rodríguez
faed5857c3 Adapt specs to new translation interface
As translatable translations already exists in these specs it has more
sense to me to use select_language intead of adding an already existing
language. Anyway both versions behaves the same and specs pass.
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
9fd77d4042 Add languages in use description
New interface now shows a description to ensure the user
knows how many languages are currently in use.
2019-07-01 14:49:43 +02:00
voodoorai2000
83b43c6bc6 Fix milestone translatable specs
Milestones do not have an author so we can not update that attribute.

Adding this conditional fixes this spec: ./spec/features/admin/budget_investment_milestones_spec.rb[1:1:1:10]
2019-06-27 10:07:38 +02:00
taitus
3a154a57cb Fix houncibot offenses: Style/StringLiterals 2019-06-27 09:21:19 +02:00
taitus
b6642f826e Shared example remotely translatable
We have 2 contexts that we want check:
  - Status from button to request translation
  - Status after click remote translations button
2019-06-27 09:21:19 +02:00
Senén Rodero Rodríguez
264b3f0f82 Simpler calls to *_translatable shared specs
Enable translations interface setting inside shared specs when needed.

Co-Authored-By: javierm <javim@elretirao.net>
2019-06-27 09:20:25 +02:00
Senén Rodero Rodríguez
3176be43d9 Rename "translatable" shared example to "edit_translatable"
Also rename all specs calls
2019-06-27 09:20:25 +02:00
Senén Rodero Rodríguez
64bfab9c9c Extract spec methods to commons module to avoid code duplication
Because "translatable" and "new_translatable" shared examples needs same methods to manipulate translations.
2019-06-27 09:20:25 +02:00
Senén Rodero Rodríguez
673fecf92a Add "new_translatable" shared example to check creation of translatable records
The existing shared example 'translatable' only works for edit actions.
This shared example allow us to check how translations behaves at new
resource pages.

Now this shared specs only works with Proposals, Budget::Investments and
Debates.
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
661ca5a568 Add budget investments translation interface
* Adapt translatable spec helper method to work with budget investments
* Remove old attributes from strong parameters
* Add missing locales to admin.yml and budgets.yml
* Change SpendingProposal.title_max_length and
  SpendingProposal.description_max_lenght to Budget::Investment methods
* Add budget investment translatable attribute translations
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
5eb5f02cbe Fix budget investment specs
After adding investment translatable fields to forms, they will be
generated with nested translations names and ids so we can no longer
use standard id locator.

Using input label text to fill in fields works with both types of forms.
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
78c2f54c5d Fix proposal specs
After adding proposal translatable fields to forms, they will be generated with nested translations names and ids so we can no longer
use standard id locator.

Using input label text to fill in fields works with both types of forms.
2019-06-27 09:19:36 +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
taitus
98074a9a73 Refactor specs from shared translatable 2019-06-27 09:19:36 +02:00
taitus
1687fb3a7b Fix specs budget_phases_spec.rb:13 2019-06-27 09:19:36 +02:00
taitus
2964d91303 Fix specs active_polls_spec.rb:10 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
ba9e9887ed Set globalize fallbacks for requests
New version of globalize uses RequestStore gem to store I18n.locale and
Globalize.fallbacks in a per request basis to avoid collissions between
different requests. This gem update broke Globalize.fallback results
because it tries to fetch fallbacks from RequestStore, where there is no
locale fallbacks definition.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
3d04b388ad Adapt translatable shared specs
Adapt translatable shared specs to define an owner when running at
frontend feature specs.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
5881f8241e Sanitization shared spec
Create sanitization shared spec to check sanitizable concern features
in all translatable models.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
db38a87205 Add specs to check how paranoia and globalize work together
Create shared model spec to test paranoia and globalize behavior on
globalizable and paranoid models.
2019-06-27 09:19:35 +02:00
German Galia
9ce524e1f3 Create tracker rol 2019-06-12 16:23:40 +02:00
Julian Herrero
8e0bbf54f6 Replace harcoded images and documents settings 2019-06-04 11:50:09 +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
decabeza
0c704c2f06 Replace i18n destroy to delete 2019-05-17 17:41:38 +02:00
decabeza
f40787561d Remove all references to question and external_url fields 2019-04-30 16:42:07 +02:00
decabeza
07fd5084f7 Show request to admins and short description only for resources 2019-04-24 14:01:04 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
rgarcia
f23fd6f3bb Remove parameterise deprecation warning
DEPRECATION WARNING: Passing the separator argument as a positional
parameter is deprecated and will soon be removed. Use `separator: '_'`
instead.
2019-04-17 17:40:55 +02:00
decabeza
2af154d539 Merge branch 'master' into proposal-dashboard 2019-03-28 01:26:04 +01:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
decabeza
f47ec9d7dc Fix hound warnings 2019-03-26 18:21:19 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Javi Martín
2b4e1cf358 Add missing double quotes
We overlooked a few single quotes while we changed thousands of them.
2019-03-25 13:22:35 +01:00
Julian Herrero
884274c4ad Add a description for open polls 2019-02-18 13:34:07 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Julian Herrero
922600252c Make budget headings translatable 2019-02-13 13:35:07 +01:00
Julian Herrero
1c35ec99c1 Make budget groups translatable 2019-02-13 12:30:37 +01:00
Julian Herrero
90d0a6e416 Make budget phases translatable 2019-02-13 11:44:56 +01:00
Julian Herrero
60ce72f3a0 Make possible to check for more than one ckeditor in the same form.
When more than one ckeditor field this line was raising the error:
"Ambiguous match, found 2 elements matching visible css"
2019-02-13 11:42:27 +01:00
Julian Herrero
dbdbcd662a Remove extra check
Sometimes when updating a resource you are not redirected to the same
resource, you are maybe redirected to the parent resource and the
translations can be different. This condition will be checked after
visiting the edit_path again.
2019-02-13 11:42:18 +01:00