Commit Graph

318 Commits

Author SHA1 Message Date
Juan Salvador Pérez García
47a055ea48 Use time.current instead of Time.now
Use time.current instead of Time.now in order to avoid flakies.
2018-07-17 17:53:18 +02:00
Juan Salvador Pérez García
33b3431c70 Implements #150
Adds an entry inside moderation section that allows moderators to check
pending tasks and mark them as solved.
2018-07-17 17:52:47 +02:00
Juan Salvador Pérez García
83f78b1940 Fixes #135
Adds a table with proposed actions in the dashboard. The user can mark
an action as executed.
2018-07-17 17:51:13 +02:00
Juan Salvador Pérez García
e4e0cb65de Implements #142
Dashboard actions can be proposed actions or resources
2018-07-17 17:50:05 +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
Juan Salvador Pérez García
77dd60427d Implements story #136
Adds draft state for proposals
2018-07-17 17:46:54 +02:00
iagirre
0d9da5398b Fix banners in user pages
Banners were not been shown in certain pages; now
they are.

Spec to check if the banner is been shown correctly
added. Before it was in admins specs, now it has it's
own spec out of admins folder.
2018-07-12 10:17:25 -04:00
iagirre
82cb8d4c52 Changes suggested in PR:
* Delete all things related to banner images and styles (in code)
* Add a new test to check that the banner is showing correctly
* Update the specs accordingly to match the changes

Update dev_seed to set a random background_color and a font_color for banners (and remove everything about image and style)
Add a rake task to migrate the banner style to backgroun_color and font_color (so that the banners have the same colors than before)
2018-07-12 10:17:24 -04:00
Javier Martín
0cf799add6 Use dynamic times and dates in factories.
The tests depending on the date changing were still failing because
Date.current was being stubbed after loading the factories. The
following lines affected these specific tests:

factory :poll_officer_assignment, class: 'Poll::OfficerAssignment' do
(...)
  date Date.current
end

So if the tests were executed right before midnight, the sequence was:

1. The factories file was loaded, assigning Date.current to the date of
every Poll::OfficerAssignment to be created.
2. Time passed, so now it was after midnight.
3. The `travel_to` method freezed time, after midnight.
4. A Poll::OfficerAssignment factory was created, using the date it was
before midnight.

Using dynamic fixtures solves the problem:

factory :poll_officer_assignment, class: 'Poll::OfficerAssignment' do
(...)
  date { Date.current }
end

Now the sequence is:

1. The factories file is loaded, and since it finds a block, doesn't
assign a static value to every Poll::OfficerAssignment to be created.
2. Time passes, so now it's after midnight.
3. The `travel_to` method freezes time, after midnight.
4. A Poll::OfficerAssignment factory was created, and in executes the
block, using the current date, that is, after midnight.
2018-07-09 00:06:55 +02:00
iagirre
8dadb228f1 Add specs to test the prop. notifications hide action
Specs that test if the proposal notifications hide action works.
It also tests if the admin part works (mark as reviewed, ignore them, etc.)
2018-07-02 18:18:05 +02:00
María Checa
fb5b993920 Add Budget::Investment::Statuses tests 2018-06-27 18:34:02 +02:00
María Checa
e8e9fcd0da Add Budget::Investment::Statuses tests 2018-06-27 16:45:58 +02:00
rgarcia
8986cf4727 Display only published processes in homepage 2018-05-30 13:32:20 +02:00
rgarcia
0e097973cc Add widget feeds to homepage
Note there is some funkiness going on with class loadings
Had to create a `feed` and `widget_feed` table even though in this
first version the Widget::Feed includes only uses ActiveModel instead
of ActiveRecord, otherwise some specs failed

We’ll figure it out and clean up 😌
2018-05-28 18:17:26 +02:00
rgarcia
664e77305c Add widget cards to homepage 2018-05-28 18:17:26 +02:00
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