Commit Graph

303 Commits

Author SHA1 Message Date
iagirre
b8cc10d218 Fix conflics after rebase 2018-04-09 15:02:35 +02:00
Bertocq
48286f7de9 Validate ValuatorGroup#name presence & uniqueness
Why:

ValuatorGroup name should be unique and present to be able to identify
correctly each of them.

How:
  - Adding a presence & uniqueness validation at the model
  - Adding a sequenced value for name attribute at its factory
  - Adding missing model spec that covers validations
2018-04-05 22:12:06 +02:00
Raimond Garcia
787657e07e Merge pull request #2510 from consul/valuator-groups
Add valuator groups
2018-04-05 00:21:04 +02:00
Alberto Calderón Queimadelos
288ec75fcd Merge pull request #2524 from consul/rubocop_update
Rubocop & rubocop-rspec gem & config updates
2018-04-04 20:10:39 +02:00
Bertocq
e2c42a3c63 Enable StaticAttributeDefinedDynamically cop & fix
rubocop-rspec gem includes cops for FactoryBot like the new
 FactoryBot/StaticAttributeDefinedDynamically to enforce declaring
 static attribute values without a block.

* http://www.rubydoc.info/gems/rubocop-rspec/1.24.0/RuboCop/Cop/RSpec/FactoryBot/StaticAttributeDefinedDynamically
2018-04-04 19:28:15 +02:00
Bertocq
633cc1283b Fix Date & DateTime parsings to use default timezone
Date.new(...) does not take into account the current timezone, while other
parts of the application do. By default always parsing any date with the
default timezone and converting the resulting Time to Date would prevent
this kind of issues

DateTime.parse(...).in_time_zone gives an unexpected result, as the
DateTime.parse(...) will create a DateTime with +0000 time zone and the
`in_time_zone` will modify the DateTime to adjust to the default zone.

Maybe its better explained with an example, using 'Lima' as timezone:

DateTime.parse("2015-01-01")
> Thu, 01 Jan 2015 00:00:00 +0000

DateTime.parse("2015-01-01").in_time_zone
> Wed, 31 Dec 2014 19:00:00 -05 -05:00

And that's not the desired date but the previous day!
2018-04-04 14:21:39 +02:00
rgarcia
cddfdf4b84 Add valuator groups 2018-04-03 20:55:44 +02:00
rgarcia
09c44ee583 Extend notifications to be marked as read and unread 2018-03-23 11:47:06 +01:00
Bertocq
4becd0eb35 Change Newsletter's segment_recipient to string
Why:

Newsletter attribute `segment_recipient` is an integer to be used as
enum. There's no advantage to store a number instead of an string if the
ammount of elements in the table is not going to be huge, or we can take
advantage of using an enum.

Also maintaining both Newsletters enum paired with UserSegments::SEGMENTS
would be a maintenance burden.

How:

* Migration to change segment_recipient column from integer to string
* Removing enumeration from Newsletter model class
* Using UserSegments::SEGMENTS instead of Newsletter.segment_recipients
or integer values
2018-02-21 11:46:11 +01:00
María Checa
e8c797766a Added newsletter specs 2018-02-14 16:06:33 +01:00
Bertocq
8e6e360fc8 Create traits for budget group & heading with drafting budget 2018-02-04 23:04:48 +01:00
Bertocq
8f72972344 Change budget factory name to avoid collisions 2018-02-04 23:04:47 +01:00
Bertocq
26cf91c61a Create valuation comments creation ability
Why:

Only admins or valuators (for those investments they've assigned) can
create internal valuation comments on them.

How:

* Creating a new `comment_valuation` ability for admins and valuators in
the same manner the `valuate` ability works.

* Adding a validation at Comment model for those with `valuation` flag
active that checks if the author can make a valuation comment on the
commentable, as well as the respective active record error messages.
This will prevent comments from being created at a controller level as
well.

* Improving comment factory trait `valuation` to have an associated
investment, author that is a valuator and setting the valuator on the
valuators list of the investment
2018-01-31 02:03:03 +01:00
Bertocq
56fc5c9583 Filter internal valuation comments from public api
Why:

Internal valuation comments are only for admins and valuators,
not for the public view.

How:

Adding a `not_valuations` scope and use it at the `public_for_api` one
2018-01-30 19:22:27 +01:00
iagirre
846898f3ec New phase "Information" added and UI modified to not show the links.
Specs to test the functionality added.
2018-01-23 15:42:01 +01:00
Bertocq
2fb1112066 Replace existing Time.zone.today.to_date for just Date.current 2018-01-17 00:45:30 +01:00
Bertocq
36e74d0ef2 Add Budget::Phase model, spec and factory
Create a new Budget::Phase model that:
* Stablishes a relation with its budget
* Stablishes relation with two other Budget::Phases (previous and next)
* Validates basic dates range, kind and description rules.
* Adds scopes to get the ones enabled as well as each individual phase

Create a factory that generates a basic and valid Budget::Phase

Create a model spec that checks kind, date range and budget validations.
2018-01-16 12:18:13 +01:00
Bertocq
3bc683edce Increase budget factory with publishing_price trait & description value 2018-01-10 01:12:11 +01:00
Bertocq
1d6c3034cb Add test scenarios to check investment price showing rules 2018-01-10 01:04:31 +01:00
María Checa
96859190be Merge pull request #2280 from consul/2277-budgets_new_form
Budgets new form
2018-01-09 11:55:10 +01:00
María Checa
d8a6bb0f91 Changed tests 2018-01-09 00:09:50 +01:00
Bertocq
d0937d7022 Add description_drafting column to budgets table 2018-01-08 22:55:37 +01:00
Bertocq
9739576e4e Add drafting phase trait to budget factory 2018-01-08 22:54:10 +01:00
Bertocq
581a6eb3ef Upgrade from factory_girl_rails to factory_bot_rails
Guide at https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md
2018-01-07 23:32:37 +01:00
rgarcia
0152b6301c adds specs 2017-12-19 20:36:10 +01:00
Angel Perez
1e1028dcb4 Adapt existing milestone-related specs to fit the new requirement 2017-12-13 20:17:54 -04:00
Raimond Garcia
819afa1d64 Merge pull request #2182 from consul/legislation-proposals-specs
Adds model validations for legislation proposals
2017-12-13 19:42:29 +01:00
rgarcia
abaf6ab785 adds model validations for legislation proposals 2017-12-13 12:52:25 +01:00
rgarcia
f4e4121780 updates factories to have the legislation's debate phase open by default 2017-12-13 12:39:00 +01:00
rgarcia
d9e5873795 add residence_veried_at to the user's verified trait 2017-12-13 12:38:05 +01:00
Bertocq
a138cda364 Create RelatedContent model 2017-11-29 19:00:54 +01:00
Bertocq
c044fb293c Create poll_question trait with answers 2017-10-18 01:59:30 +02:00
Bertocq
9e22a1812f Remove no longer needed valid_answers attribute from poll_question factory 2017-10-18 01:22:15 +02:00
Bertocq
f05e5291b2 Replace valid_answers usage for question_answers on factories 2017-10-18 01:21:40 +02:00
BertoCQ
d1c67212b0 Merge pull request #1964 from consul/chore/remove_results
Remove deprecated Poll results models
2017-10-17 14:39:42 +02:00
BertoCQ
a476019c49 Merge pull request #2020 from consul/poll-videos
Poll answer videos
2017-10-16 20:03:34 +02:00
Bertocq
64db7e1dec Merge branch 'master' into fix/shift_date_range_expired 2017-10-16 19:43:00 +02:00
decabeza
1812c0330e replaces video url on poll answer factories 2017-10-16 18:37:00 +02:00
rgarcia
c2dcad79b3 adds video spec 2017-10-16 17:14:40 +02:00
María Checa
7d22b386b9 Added tests 2017-10-16 16:08:15 +02:00
Bertocq
ca2d9a1d68 Add recounting Poll scope with trait and spec 2017-10-13 16:51:58 +02:00
iagirre
644d09ebd2 PR comments applied and poll_question_answer default name changed in factory. 2017-10-11 09:42:52 +02:00
rgarcia
007bcb7ec7 fixes specs 2017-10-04 17:46:25 +02:00
rgarcia
1f2aa301d4 adds specs for answer's index and create 2017-10-04 16:33:52 +02:00
María Checa
2020990b05 Merge pull request #1972 from consul/1954-remove_question_show_and_description
Removed poll question show view and description attribute
2017-10-04 12:52:46 +02:00
Bertocq
e928eb38ac Add Officer relationship to Poll Voter 2017-10-04 00:39:31 +02:00
María Checa
81e9682aa3 Fixed tests 2017-10-03 22:30:15 +02:00
BertoCQ
19e8ec265f Merge branch 'master' into chore/remove_results 2017-10-02 23:54:13 +02:00
Raimond Garcia
a743b6b823 Merge branch 'master' into polls-voting 2017-10-02 17:11:21 +02:00
Bertocq
58069b35a3 Remove Poll White/Null/Total Results models, tables, specs and references 2017-10-02 16:24:57 +02:00