Commit Graph

2271 Commits

Author SHA1 Message Date
iagirre
7e90021cdf Change the method have_css for find
The old method have_css didn't wait, apparently,
the Capybara's max_wait_time.
It has been changed in favor of find,
one that waits the stablished time for
an element to appear in the screen.
2018-03-21 09:58:39 +01:00
decabeza
acebb07ddd Adds link to image and docs on admin budget investment info 2018-03-14 15:14:47 +01:00
decabeza
f05fdb88ea Adds link to username on admin users index view 2018-03-14 15:09:30 +01:00
Raúl Fuentes
cd5923c41d updated test, changed fixed seeds for the new seed function 2018-03-14 11:13:59 +01:00
Bertocq
c0986c7bfb Fix investment creation for single budget usage
Budget Investment factory creates a secondary budget as a collateral
effect because it has a Heading factory that has a Group factory that
creates a Budget.

This was resulting in problems due to having two "active" Budgets created
and `current_budget` method not choosing the one that we expected
2018-03-12 23:06:32 +01:00
Bertocq
8fd6f8f1d6 Valuators access to edit/valute on right phase
When a valuator tries to edit/valuate an investment outside valuating
phase, an explanatory message will be shown along with a redirect to
prevent access.
2018-03-12 20:22:53 +01:00
Alberto García
eba4a3c6cb Merge pull request #2528 from consul/budgets-message
Heading link on budgets message
2018-03-09 13:25:39 +01:00
Alberto García
8c6c567c76 Merge pull request #2525 from consul/social-share
Fixes social share buttons
2018-03-08 17:46:24 +01:00
Bertocq
d3a572e542 Avoid explicity ID values on fixtures if possible
The specs don't care about the actual ID value, only about using the
same value. Fixed ID values cause flaky specs and high maintenance issues
2018-03-08 14:48:07 +01:00
decabeza
0e9190bc43 Adds heading link on different heading message 2018-03-08 11:50:09 +01:00
decabeza
f2e5f6ff76 Adds specs for additional info button 2018-03-07 17:18:55 +01:00
Bertocq
0516bc3e91 Prevent valuators from editing finished valuation
Valuators should not be able to edit a finished valuation (only admins
should).

The valuation form is only shown to the valuator if he has that ability
(we've previously modified app/models/abilities/valuator.rb to be able
to rely on `valuate` over an investment to check that)

If the valuator can't see the form, we present him just the data in
plain text.
2018-03-06 20:18:05 +01:00
Bertocq
a92ef57bf8 Make valuator spec 100 LineLength compliant
Readability of the code is important
2018-03-06 20:17:40 +01:00
Bertocq
7145ce5e5a Refactor Valuator spec Show context with lets
Extract duplicated code used to set the scenario conditions to simple
lets (admin, second valuator and investment)
2018-03-06 20:17:39 +01:00
Bertocq
400b3b1201 Swap @investment instance variable for a let
Why:

Avoid instance variables as we agreed upon with RSpec/InstanceVariable

How:

Using a let(:invsetment) and replacing all `@investment` with
`investment`, as well as adding a let(:admin) for the administrator.
2018-03-06 20:17:39 +01:00
Bertocq
9abf9bd87d Swap @budget instance variable for a let
Why:

Avoid instance variables as we agreed upon with RSpec/InstanceVariable

How:

Using a let(:budget) and replacing all `@budget` with `budget`
2018-03-06 20:17:38 +01:00
Bertocq
0a066f6bb6 Swap @valuator instance variable for a let
Why:

Avoid instance variables as we agreed upon with RSpec/InstanceVariable

How:

Using a let(:valuator) and replacing all `@valuator` with `valuator`
2018-03-06 20:17:37 +01:00
Alberto Calderón Queimadelos
28eab38ea0 Merge pull request #2516 from consul/fix_user_segment_emails
Remove empty emails from user segment usages
2018-03-05 14:08:03 +01:00
iagirre
ffd6bdb3d7 first changed for click_link so that the test can wait the capybara default time. 2018-03-04 22:58:35 +01:00
iagirre
e21588ec16 The function comment_on has been modified to change the functionality. Now, a comment is generated and a email notification send manually, so that JS has been avoided, that was the original problem. 2018-03-02 13:35:50 +01:00
Bertocq
16bec030ad Cleanup spec files from I18n calls 2018-03-02 09:17:29 +01:00
Raúl Fuentes
8f4d48690b Added tests for edit the name of any Budget::Group 2018-03-02 09:17:03 +01:00
Bertocq
6b41b6487b Add UserSegments#user_segment_emails helper method
Why:

Both Newsletters and Email Downloads need the same logic: To extract the
emails from all the users in the segment that have newsletter flag
active, removing all empty email values.

How:

1- UserSegments#user_segment_emails holds that repeated logic and is used
on both Newsletter & EmailDownload.

2- Rename Newsletter#list_of_recipients to list_of_recipient_emails as
it is more descriptive. There is no need to pass entire Users around,
only the emails are needed at Mailer#newsletter method.

3- Cleanup Newsletter#list_of_recipient_emails model spec scenario
2018-03-01 20:59:20 +01:00
Bertocq
99851e9588 Remove empty emails from users segments recipients
Why:

User with an empty email value (nil) should not appear in the recipient
list for a given UserSegment at Newsletters or Email Downloads.

How:

Using Enumerable#compact and Enumerable#select to filter out empty emails

Increasing Email Download feature spec and Newsletter model spec to cover
all possible scenarios including the nil email one.
2018-03-01 20:09:32 +01:00
María Checa
3867c6b716 Fixed newsletter tests 2018-02-28 17:02:39 +01:00
Bertocq
dbe723079e Disable guide page when Budget is not accepting
Why:

When there is not Budget accepting (Investment creation) the guide page
doesn't have much sense as it will give the user an option that can't be
used (creating an Investment).

How:

Using `Budget.current&.accepting?` conditional at GuidesHelper to link
to new proposal link instead of guide page, and adding an scenario to
guides feature spec for it.
2018-02-26 10:01:30 +01:00
Bertocq
7dfa056fe0 Add invalid newsletter scenarios to feature spec
Newsletters with an invalid user segment should display a warning on
show and index. Also those newsletters should not be sent.
2018-02-21 11:46:23 +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
752ffd678f Added download emails spec and renamed newsletters spec 2018-02-20 22:33:01 +01:00
María Checa
017c242085 Merge pull request #2462 from consul/admin-newsletter-emails
Admin newsletter emails
2018-02-20 16:17:37 +01:00
decabeza
1cc799ef11 Adds links to milestone description 2018-02-14 18:13:46 +01:00
decabeza
990dc072be Refactors custom page view and include specs 2018-02-14 17:52:10 +01:00
María Checa
24bca36639 Merge branch 'master' into admin-newsletter-emails 2018-02-14 16:07:13 +01:00
María Checa
e8c797766a Added newsletter specs 2018-02-14 16:06:33 +01:00
Raimond Garcia
8bec36500a Merge pull request #2385 from wairbut-m2c/2363-alert-delete-investment-project
Add alert message when a user deletes an investment project from "My activity"
2018-02-13 14:06:08 +01:00
Bertocq
9aa6d646d4 Remove usage of instance variables at specs 2018-02-10 19:34:54 +01:00
Raúl Fuentes
ecdbc4a3f7 added balloting to the list of phases allowed to see all the links 2018-02-10 15:27:40 +01:00
Raúl Fuentes
6871193cbc Added test to bugets/index to ensure the correcto showing of the investment links over ths changes of the buget's phase 2018-02-10 15:27:40 +01:00
BertoCQ
6ba8b68fe8 Merge pull request #2458 from wairbut-m2c/BP_flaky_residence_assigned_officers_error
Fix flaky spec: Residence Assigned officers Error
2018-02-09 13:52:39 +01:00
BertoCQ
8ca61e4e3e Merge pull request #2455 from wairbut-m2c/backport_1180_flaky_commenting_legislation_questions
Fixed flaky spec: missing comment on legislation annotation
2018-02-09 13:44:18 +01:00
Vicente Mendoza
910d49d18c Focus the search of the button 2018-02-09 12:51:15 +01:00
BertoCQ
37f0a412d9 Merge pull request #2454 from wairbut-m2c/backport_1191_flaky_budget_investments_orders_random
Fix flaky spec: random investments order scenario
2018-02-09 12:11:18 +01:00
Raúl Fuentes
dbf4ec9716 changed test, fixed variable instead os us the let option 2018-02-08 16:36:35 +01:00
Raúl Fuentes
ebebbdf078 Added bigger pool for random seeds, now with a 9 * 10e-07 % of chance of appearing, also added test to cover edge cases (case in fact, the coincidence of the seeds it's correct)
Conflicts:
	app/controllers/budgets/investments_controller.rb
2018-02-08 16:33:15 +01:00
Raúl Fuentes
ae25fdfc15 fix for the flaky 2018-02-08 16:29:21 +01:00
iagirre
80f97b3ca6 The flaky test has been modified completely to test the functionality described. JS has been avoided because it was one of the problems involved and it wasn't completely necessary. 2018-02-08 14:47:10 +01:00
Raimond Garcia
f5c5293321 Merge pull request #2444 from consul/specs
Improve spec boot time and clean up logs
2018-02-06 17:15:03 +01:00
rgarcia
6f4d23fdef Remove circular argument reference warning
We were seeing this warning when running specs
`spec/features/admin/budgets_spec.rb:322: warning: circular argument
reference - phase_kind`

This commit should fix the warning
2018-02-06 12:22:34 +01:00
BertoCQ
087c8b0a99 Merge pull request #2395 from consul/hidden-comments
Hidden comments
2018-02-05 20:27:05 +01:00
Bertocq
67663804c5 Improve investments milestone scenario for ordering
Milestones should be listed ordered by publication date instead of
creation date. The spec was creating only one milestone and not even
expecting the descriptions to be present in the page.
2018-02-03 18:46:43 +01:00