Commit Graph

256 Commits

Author SHA1 Message Date
voodoorai2000
cb9c3696f4 Use budget investments in useful specs 2019-05-31 18:23:03 +02:00
voodoorai2000
2f5d153581 Delete migration to budget investments 2019-05-31 18:23:03 +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
Javi Martín
9ae0cbb254 Add task to migrate enabled poll results and stats 2019-05-22 12:48:11 +02:00
Javier Martín
82e3c41aa9 Merge pull request #3512 from consul/backport-stats
Change stats layout
2019-05-21 17:18:47 +02:00
Javi Martín
383909e16c Extract class to manage GeozoneStats
Even if this class looks very simple now, we're trying a few things
related to these stats. Having a class for it makes future changes
easier and, if there weren't any future changes, at least it makes
current experiments easier.

Note we keep the method `participants_by_geozone` to return a hash
because we're caching the stats and storing GeozoneStats objects would
need a lot more memory and we would get an error.
2019-05-21 13:50:18 +02:00
Alberto
7db1cac3bc Merge pull request #3507 from consul/proposals-user-segment
Proposals authors user segment
2019-05-20 14:00:15 +02:00
decabeza
e6af2f15fb Add new user segment all_proposals_authors 2019-05-17 17:22:29 +02:00
decabeza
4648906591 Remove deprecated task proposals spec
After run the rake to move external_url to description for Proposals and Legislation proposals this spec is failing because external_url field doesn't exists anymore.
2019-04-30 11:39:04 +02:00
decabeza
20f505ab7c Fix specs 2019-04-29 15:44:41 +02:00
decabeza
b79061064b Remove all texts of decide madrid 2019-03-26 18:22:02 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
voodoorai2000
af79330646 Remove unnecessary spec
This spec is giving some problems related to duplicity of records due to the way rake tasks are loaded.

It will soon become part of seeds anyways. Removing for now.
2019-03-26 12:13:56 +01:00
Javi Martín
9d6bd7e788 Remove obsolete rake tasks
These tasks dealt with data migrations or stats generations which were
done only once, so we don't need them anymore.

New CONSUL installations don't need these tasks, and existing CONSUL
installations will execute them when upgrading one release at a time.
2019-03-22 13:07:09 +01:00
decabeza
832f0c40a8 Add rake to move external_url to description
This rake move this field for Proposals and Legislation proposals.
2019-03-21 14:14:50 +01:00
taitus
b115c3af49 Rake task for create basic templates with actions and resources by default. 2019-03-21 12:29:30 +01:00
taitus
5177adb32a New rake task for proposals to send new action email
Execute rake task every day to detect new actions available for not archived proposals. If there are new actions available for today, send email to proposal's author with information text, new actions available and link to proposal dashboard url.
2019-03-21 12:29:28 +01:00
Julian Herrero
e04fd74cf1 Add rake task to rename existing setting keys 2019-03-19 19:45:34 +01:00
Julian Herrero
87be6f302c Add default site customization pages
From now on these static pages:

`/privacy'
`/conditions'
`/accesibility'
`/help/faq'
`/welcome'

have been moved to the DB and can be modified easily by any
administrator in `/admin/site_customization/pages'
2019-03-14 18:35:51 +01:00
decabeza
cfad56b872 Add rake to remove deprecated settings 2019-03-13 15:39:58 +01:00
Julian Herrero
00bd7008bb Show all system emails in Admin section 2019-02-22 16:13:49 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Julian Herrero
fc69c21ebb Send newsletter emails in order
The list of emails for sending newsletters will always be ordered by
user creation date, so it will be easier to debug and to know for
which users the email has been sent.
2019-02-06 15:06:29 +01:00
Javier Martín
4f9ca04a84 Merge pull request #3057 from consul/backport-make-milestones-polymorphic
[Backport] Make milestones polymorphic
2018-12-05 12:12:04 +01:00
decabeza
04e3bf5797 Removes references to deleted general terms page 2018-12-04 17:25:34 +01:00
Javi Martín
85ac4e6c22 Use Date.current instead of Date.today
Using `Date.today` was making the spec fail around midnight.
2018-11-30 16:04:40 +01:00
Javi Martín
d3882df437 Fix milestones migration not updating ID sequence
When we insert a record in PostgreSQL and we specify the ID, the
internal ID sequence for that table isn't updated.

In order to keep the original IDs so we didn't break any foreign keys,
we specified the IDs when copying the table, resulting in a table having
its ID sequence with a value of an existing record. When trying to
insert a new record, we got a `PG::UniqueViolation` exception.

Updating the sequence after the data migration might not be the most
elegant solution, but it's easy to do and it's already been tested on a
production environment.
2018-11-30 14:15:21 +01:00
Javi Martín
87b073cbca Migrate milestones images and documents 2018-11-30 14:15:21 +01:00
Javi Martín
1a5b73a0bd Don't load tasks several times in specs
Calling `load_tasks` in several files made rails load the tasks several
times, and so they were executed several times when called.

Since the milestone migration can't be executed twice in a row (it would
fail with duplicated ID records), loading the tasks several times made
the milestone migrations task specs fail.
2018-11-30 14:15:21 +01:00
Marko Lovic
4c3dadf1fb Add Rake task to migrate milestone data to new tables 2018-11-30 14:15:21 +01:00
Marko Lovic
c0f6fa182f Make Milestones general, and not specific to Budget Investments
Generalize the Budget::Investment::Milestone model to a
polymorphic Milestone model so it can be used for entities
other than Budget::Investment.
2018-11-30 14:15:21 +01:00
Javi Martín
9404cb8b3a Fix bug with non-underscored locales
Ruby can't have hyphens in method names, so sending something like
`record.title_pt-BR` would raise an exception.

Using globalize's `localized_attr_name_for` method fixes the bug.

Thanks Marko for the tip.
2018-10-23 16:29:14 +02:00
Javi Martín
934bce5932 Don't abort the migration if the simulation fails
We think aborting the migration will generate more headaches to system
administrators, who will have to manually check and fix every invalid
record before anything can be migrated.
2018-10-23 16:29:14 +02:00
Javi Martín
7fff57a25f Add task to simulate data migration
This way we can check everything is OK before actually migrating the
data to the translations tables.
2018-10-23 16:29:14 +02:00
Javi Martín
a84a0f2b7d Migrate custom pages data to their locale 2018-10-23 16:29:13 +02:00
Javi Martín
ef7be4fc55 Add task to migrate data to translation tables
We forgot to do it when we created the translation tables, and so now we
need to make sure we don't overwrite existing translations.
2018-10-23 16:29:13 +02:00
Raimond Garcia
ea72cd058b Merge pull request #2876 from javierm/ckeditor4_update
Ckeditor4 update
2018-09-17 23:02:50 +02:00
Javi Martín
f917f5eed9 Filter image tags everywhere except in custom pages
Allowing image tags everywhere makes us vulnerable to CSRF attacks.
2018-09-12 12:35:28 +02:00
Angel Perez
bdda397bf1 Use new RSpec stub syntax to fix deprecation warnings 2018-09-10 11:41:20 -04:00
María Checa
7bddd97ed3 Adds validation of email present in valid_email? method 2018-07-26 17:55:06 +02:00
María Checa
b7a1599fdf Adds logic to send proposal notifications in batches
WIP batches tests
2018-07-26 17:55:06 +02:00
Bertocq
fcdc24a78c Avoid db:dev_seed log print when run from its test
The db:dev_seed rake logs info as it progresses as information for the
developer. But that's not needed when ran from its tests file, and it
bloats the travis/rspec output with unnecessary information.

Now the task will always log info unless the rake task receives an
optional argument.
2018-04-14 20:28:43 +02:00
Angel Perez
b3ce674ffc Enable previously disabled test scenarios 2018-03-27 14:47:50 -04:00
Raimond Garcia
0b4b896a6a Merge pull request #2522 from wairbut-m2c/fix/dev_seed_flaky_spec_backport
Fix `rake db:dev_seed` task flaky spec
2018-03-27 20:22:28 +02:00
Bertocq
2ecbfc76e0 Add Segment for users without supports on Budget
Created not_supported_on_current_budget at UserSegment along with model
spec scenario and translation strings.
2018-03-15 16:48:54 +01:00
Angel Perez
80b77e873e Add missing require for dev_seeds rake task spec 2018-03-06 18:47:57 -04:00
María Checa
7913128520 Changed tests for UserSegments#feasible_and_undecided_investment_authors 2018-02-28 16:54:28 +01:00
Bertocq
61f015e2c2 Add administrators UserSegment
We need a user segment to have only administrators as recipients of both
newsletters and notifications
2018-02-21 23:34:20 +01:00
Bertocq
bdbb32e824 Move newsletter User scope outside UserSegments
Why:

UserSegments are not only used for Newsletters or Email downloads, but
also for internal Global Notifications. We don't want to have that scope
hardcoded inside UserSegments as users that have opted-out from the
newsletter should still be recipients of global notifications.

How:

Removing the scope from the UserSegments `all_users` method that acts as
base for all the other segments. Including that `newsletter` scope only
on the places that is relevant:
* When listing recipients for a newsletter
* When downloading a listing emails that can be newsletter recipients

Also updated relevant tests
2018-02-21 11:45:38 +01:00
María Checa
e8c797766a Added newsletter specs 2018-02-14 16:06:33 +01:00