Commit Graph

76 Commits

Author SHA1 Message Date
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
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
a04a289850 Simplify testing arrays exact contents
Instead of testing the contents of each element, we can test the whole
array at once.
2019-09-29 23:24:53 +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
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
488461b8ac Remove consecutive blank lines 2019-09-10 20:02:15 +02:00
Javi Martín
71d9ddd849 Apply rule to end files with a newline character 2019-09-10 20:02:15 +02:00
taitus
5953e87c71 Update help text and add dynamic example text
- Display help text and example text according to
  remote census configuration:

  Examples with expecte results:
  * With remote census without :date_of_birth and :postal_code:
    -> "To verify a user, your application needs: Document number"
    -> "Required fields for each user must be separated by commas and
        each user must be separated by semicolons."
    -> "Example: 12345678Z; 87654321Y"

  * With remote census with :date_of_birth required:
    -> "To verify a user, your application needs: Document number,
        Day of birth (dd/mm/yyyy)"
    -> "Required fields for each user must be separated by commas and
        each user must be separated by semicolons."
    -> "Example: 12345678Z, 01/01/1980; 87654321Y, 01/02/1990"

  * With remote census with :date_of_birth and :postal_code required:
    -> "To verify a user, your application needs: Document number,
        Day of birth (dd/mm/yyyy) and Postal Code"
    -> "Required fields for each user must be separated by commas and
        each user must be separated by semicolons."
    -> "Example: 12345678Z, 01/01/1980, 28001; 87654321Y, 01/02/1990, 28002"
2019-07-29 13:10:09 +02:00
taitus
12b6b1df05 Add new param to partial '_setting_table'
When we reuse the partial '_setting_table' to render the 3 types
of remote census settings, we need customize setting_name key by
default to clarify the information to render.

- Add new param 'setting_name' to partial '_setting_table'
- Create new setting helper method to use new setting_name param
  to display a more clarify setting name on table.
2019-07-29 13:10:09 +02:00
voodoorai2000
cb9c3696f4 Use budget investments in useful specs 2019-05-31 18:23:03 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
Javi Martín
31515ddd45 Include blank and null ballots in booth totals
Just the same way it's done for all polls.
2019-05-30 17:22:41 +02: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
decabeza
26741d9560 Fix hound warnings 2019-02-20 13:56:58 +01:00
Julian Nicolas Herrero
53530ba99b Merge pull request #3287 from consul/use_double_quotes_in_specs
Change single quotes to double quotes in folder /spec
2019-02-18 13:26:49 +01:00
Javier Martín
b330de01f6 Merge pull request #3148 from matisnape/budget_investments_sorting_columns
Add sort links to admin tables
2019-02-15 19:19:11 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
decabeza
2695e19e2f Fix hound warnings 2019-01-29 17:54:02 +01:00
Manu
14d64e94d0 rspec tests were added for the process banner 2019-01-21 12:02:27 -05:00
Anna Anks Nowak
3fd7b3d216 Extract setting icon and direction to methods 2019-01-10 16:11:51 +01:00
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
voodoorai2000
ccd342bb51 Fix flaky spec for translations
This spec was causing a side effect on another spec[2], making it fail 😌

I think it was because no translation had been called yet, in the failing spec, and so the the i18n backend translations had not been initialized, and was always returning empty translations for any locale. This might have been due to tampering with translations in the this newly introduced spec.

By forcing translations to load after this new spec, the other spec passes again

[2] https://github.com/AyuntamientoMadrid/consul/blob/master/spec/features/localization_spec.rb#L20
2018-10-10 12:47:40 +02:00
voodoorai2000
0a0261900c Display language name or language key
There where two issues with the current implementation:

- There was a possible duplication between looking up the language name in key "locale" and in key "i18n.language.name"

- The "default" option was not being picked up, as the fallback always returned the default locale's translation, "English"

With this implementation there is only a single place to put the language name: i18n.language.name. I think this place is easier to find and understand for Crowdin translators than a "locale" key hidden in general.yml

If the translation is not found we display the language key, instead of English, which makes more sense to me too 😌

Solution based on recent comments[1] on a related I18n issue

[1] https://github.com/svenfuchs/i18n/issues/365#issuecomment-419263847
2018-10-05 18:08:41 +02:00
Juan Salvador Pérez García
e5f9cf6710 Fixed #239
Proposals dashboard refactored to dashboard.
Added missing specs for the dashboard.
2018-07-24 15:52:43 +02:00
Juan Salvador Pérez García
8bb3d5b3ab frozen_string_literal removed
frozen_string_literal magic comment has been removed until a decission
is taken regarding to its convenience.
2018-07-17 17:53:18 +02:00
Juan Salvador Pérez García
1464bddfa8 Fixes #134
Adds an administration interface for the proposal dashboard actions.
2018-07-17 17:48:46 +02:00
Bertocq
830bb37189 Enable RSpec/VerifiedDoubles cop, fix issues & stash one
Can't figureout solution for offense at spec/models/verification/management/email_spec.rb
 so its stashed at .rubocop_todo.yml

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
2018-01-07 18:47:19 +01:00
Bertocq
ed16a78f42 Enables RSpec/ExampleWording and fixes all issues
Both avoiding 'should' and repiting 'it' on the tests description
improves reading them and also makes all descriptions consistent.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
2018-01-07 01:03:45 +01:00
Bertocq
dc116cc3fe Fix line lenght above 140 2017-11-13 02:31:55 +01:00
Bertocq
f20db4e3e4 Fix user helper expectation 2017-10-19 13:32:48 +02:00
Bertocq
71b57ffc67 Always use parentheses on method definition 2017-09-25 22:50:24 +02:00
Bertocq
ca35c8b85c Fix Style/NestedParenthesizedCalls rubocop issues 2017-09-25 22:47:59 +02:00
decabeza
b9eb6867d7 updates tags on specs 2017-08-03 10:14:45 +02:00
Bertocq
f6fe9cc7d2 Fix all Layout/SpaceAroundOperators rubocop issues and remove file list from rubocop_todo list 2017-06-26 18:04:20 +02:00
decabeza
5e0d5fc8c3 Merge branch 'legislation-module-stable' of https://github.com/medialab-prado/consul into medialab-legislation 2017-05-22 18:43:49 +02:00
Juanjo Bazán
113f9b32d7 Merge branch 'master' into polls 2017-01-19 16:51:19 +01:00
Amaia Castro
a2a61341fe Merge branch 'master' into legislation-module-stable 2017-01-11 22:54:41 +01:00
Juanjo Bazán
7a448b6890 adds BudgetInvestment case to users_helpers 2017-01-10 20:58:01 +01:00
Fernando Blat
fba4c79d2a Show the first paragraph of the description 2017-01-05 09:43:40 +01:00
Juanjo Bazán
08ea4b35eb Merge branch 'master' into polls 2017-01-02 12:14:40 +01:00
kikito
68d598a43d Merge branch 'master' into budgets 2017-01-02 12:10:23 +01:00
rgarcia
13d9f6c294 removes obsolete spec 2016-12-30 11:55:44 +01:00
rgarcia
365faeff31 removes physical votes from proposals 2016-12-29 12:05:29 +01:00
kikito
03ef20bfde Merges orders_helper functionality inside has_orders concern
Both these objects where using/setting a variable called valid_orders.
As a results, some specs where becoming flacky
(features/budgets/investments_spec.rb, balloting phase). By putting
them together, there is no `valid_orders` variable any more (everything
is @valid_orders) and the flackyness is gone.
2016-12-24 14:42:46 +01:00
rgarcia
fda2f3c89e adds admin submit button helper 2016-11-14 13:56:49 +01:00
Juanjo Bazán
64a614c67f adds geozone helper to map ids and names 2016-08-03 20:20:52 +02:00
Juanjo Bazán
06596ac4d8 adds author_of? helper method 2016-06-15 17:01:50 +02:00
rgarcia
e2689d640c refactors notification helpers 2016-06-15 12:12:56 +02:00
Juanjo Bazán
5aa9cf9c50 changes links in 'My activity' to point to comment
(instead of to commentable)
Closes #947
2016-03-14 13:17:29 +01:00