Commit Graph

14280 Commits

Author SHA1 Message Date
Javi Martín
adf59cc963 Move related tests together 2019-09-24 19:50:18 +02:00
Javi Martín
7db32b337b Remove unnecessary author variables in specs
The factories creating proposals and debates automatically create an
author.
2019-09-24 19:50:14 +02:00
Javi Martín
fe5b45ed18 Remove unnecessary poll creating assignments
The factory creating assignments automatically assigns a poll to it, so
we don't use the poll for anything else, there's no need to explicitely
create it.
2019-09-24 19:48:22 +02:00
Javi Martín
9d627f2db9 Remove redundant I18nContent scope
Since two records cannot have the same key, having a scope that will
always return just one record is the same as using `find_by_key`.
2019-09-24 19:29:46 +02:00
Javi Martín
9fcea17849 Remove useless parameter in URL
The proposal parameter was accidentally added in commit 16692c93, but
the proposals index doesn't receive a proposal as parameter.
2019-09-24 19:28:36 +02:00
Javi Martín
da425b9164 Remove commented graphql code
This code was commented in commit ad8aba07.
2019-09-24 19:27:17 +02:00
Javi Martín
82ea866b6d Remove commented graphql tests
These tests use a "proceeding" method in proposals, which does not
exist.
2019-09-24 19:27:08 +02:00
Javi Martín
cb2069858c Remove unnecessary code
It looks like these variables were left by accident. The Ruby
interpreter was giving us warnings about unused variables.
2019-09-24 18:49:40 +02:00
Javi Martín
fcaa30dc57 Remove obsolete URL reference
This URL was accidentally copied from Madrid's repository. However, we
don't use it in CONSUL.
2019-09-24 18:49:40 +02:00
Javi Martín
fb6d12c8ab Remove obsolete data creation
This data is obsolete since commit 9d1ca3bf.

Note we should have probably moved the test to the model, since now the
`to_csv` method isn't tested anywhwere, and we should probably add a
test in the future. The code now uses the new DownloadSetting model,
though, making it hard to test.
2019-09-24 18:49:40 +02:00
Javi Martín
748ee3d804 Remove obsolete confirm messages references
This code is obsolete since commits 122b1703 and bbf3faa7.
2019-09-24 18:33:47 +02:00
Javi Martín
06030933a4 Remove obsolete poll answers variable
This code is obsolete since commit c6e4b248.
2019-09-24 18:29:33 +02:00
Javi Martín
f767f231dc Remove obsolete notices in booth assignments
This code is obsolete since commit 085e6ecb.
2019-09-24 18:26:11 +02:00
Javier Martín
989b2e23f7 Merge pull request #3711 from consul/fix_managers_suggestions
Allow managers to read investment suggestions
2019-09-24 14:32:20 +02:00
Javier Martín
671d49c8df Merge pull request #3713 from consul/reduce_translatable_specs
Make translatable specs faster
2019-09-24 14:30:10 +02:00
Javi Martín
11d16e7aad Simplify translatable tests in the public area 2019-09-23 18:01:44 +02:00
Javi Martín
44d137a4c0 Simplify translatable tests in admin section
These feature tests were taking too long, we can't run them for every
single model.

I'm taking the approach of using one different model for each test, but
in theory only using a few models covering every possible scenario
would be enough.
2019-09-23 18:01:44 +02:00
Javi Martín
ef7606bb45 Move translatable file to features folder
This change breaks the tests, but makes future commits easier to review.
2019-09-23 18:01:44 +02:00
Javi Martín
66334b5757 Add globalizable tests for all translatable models
So now we test in depth at the model level, and can be a bit more
relaxed about integration tests for translations.

Note we're defining some extra factories to make sure all translatable
attributes with presence validation rules are mandatory. This way we can
simplify the way we obtain required fields, using `required_attribute?`.
Otherwise, fields having an `unless` condition in their presence
validation rules would count as mandatory even when they're not.
2019-09-23 18:01:44 +02:00
Javi Martín
5d6038f17f Add model tests for globalizable concern
These tests are much faster than feature tests, so we're going to use
them to test translatable models.
2019-09-23 18:01:44 +02:00
Javi Martín
41c99d9b27 Let Globalize use I18n locale
This is a mistake I made in commit f2ef27d3. Back then I thought we
needed to keep Globalize.locale and I18n.locale in sync, but the truth
is it automatically happens when setting Globalize.locale to nil.

So now we can use I18n.with_locale (at least in the tests) and forget
about Globalize, which will make it easier to switch to Mobility in the
future.
2019-09-23 18:01:44 +02:00
Javi Martín
a0ee0e661f Fix missing sequences in notification factory
If we don't define a sequence, `n` becomes an object instead of a
number.
2019-09-23 18:01:44 +02:00
Javi Martín
2db8c80633 Simplify globalizable specs
We don't need `before` blocks because we've removed the `after` blocks,
and we don't need to define available locales because we already do so
in the test environment file.
2019-09-23 18:01:44 +02:00
Javier Martín
6542c6f0b1 Merge pull request #3714 from consul/simplify_investment_creation
Simplify investments creation in specs
2019-09-23 17:56:43 +02:00
Javier Martín
6eb5ad4fff Merge pull request #3715 from consul/describedclass_rule
Apply explict RSpec/DescribedClass rubocop rule
2019-09-23 17:35:13 +02:00
Javi Martín
c8c8a7bc30 Simplify investment creation in specs
Now factories define default headings for investments, so there's no
need to create a group and a heading to create an investment.

Likewise, in order to create a heading it isn't necessary to specify a
group anymore; specifying the budget is enough.

It's possible that there are more similar cases we haven't simplified
yet; I'm only addressing the obvious ones.
2019-09-23 16:51:30 +02:00
Javi Martín
ffc50246c2 Apply explict RSpec/DescribedClass rubocop rule
We settled on using this style in commit 4cbe81a1, but didn't add the
rule enforcing this style and we didn't apply it to existing code.
2019-09-23 16:51:00 +02:00
Javier Martín
1faa659c89 Merge pull request #3702 from consul/remove_after_blocks
Simplify after blocks in specs
2019-09-23 16:12:03 +02:00
Javi Martín
2ec176a2a8 Remove redundant feature settings enabled in tests
These settings are enabled by default.

It could be argued explicitely enabling the features makes tests more
consistent, because they'll work if we change the default setting. It
could also be argued that it makes tests more expressive because it
makes the reader realize certain things will only work if a setting is
enabled.

However, we were only doing so in a few tests. The truth is, thousands
of our tests depend on certain features being enabled. So IMHO we should
be consistent and either set them on every test, or not at all. I'm
choosing the latter option for simplicity.
2019-09-23 15:15:51 +02:00
Javi Martín
eb7a052207 Simplify tests using delayed_job
Among other advantages, now we can run these tests with
`rspec --tag delayed_jobs`.
2019-09-23 13:47:45 +02:00
Javi Martín
7be72df5bf Remove redundant I18n resets in after blocks
We already configure `I18n.locale` and we reset Globalize's fallbacks
before every test.

On the other hand, RSpec automatically resets anything which is stub
with `allow`, so there's no need to use `and_call_original` in an
`after` block.
2019-09-23 13:47:45 +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
Javier Martín
9182c833c0 Merge pull request #3717 from rockandror/file-uploads-label-errors
Remove attachment useless code to show errors
2019-09-23 12:53:10 +02:00
Senén Rodero Rodríguez
d1af36d1be Remove uneeded lines
Rails form already add an error class when image or document attachments
has validations errors.
2019-09-23 10:51:25 +02:00
Javier Martín
608e113d03 Merge pull request #3698 from consul/share_message_interpolation
Fix share message interpolation variable
2019-09-22 03:37:30 +02:00
Javier Martín
eaa87513c9 Merge pull request #3693 from DenisNikolski/booths-search
Add search form on admin booths
2019-09-22 03:09:50 +02:00
DenisNikolski
5627c8ccf4 add test for booths search 2019-09-21 16:25:20 +03:00
Javi Martín
53670602e0 Allow managers to read investment suggestions
When creating a budget investment with an unverified manager (for
example, a manager who isn't part of the local census), there's a
request to `Budgets::InvestmentsController#suggest`. Since the manager
isn't verified, suggestions can't be obtained.

There are serveral ways to fix this problem:

* Add a `suggest` action to Management::Budgets::InvestmentsController,
doing the same thing the main `suggest` action does.
* Give unverified users permission to access investment suggestions
* Give managers permission to access investment suggestions

I've chosen the last one because I thought it was simple and only
changed existing behaviour for managers, but any other solution would be
as valid. I haven't added the `phase: "accepting"` condition to keep it
simple, since a read-only action like this one in the management portal
isn't gonna create security risks.
2019-09-20 12:51:26 +02:00
dependabot-preview[bot]
dde9caf7fd Merge pull request #3706 from consul/dependabot/bundler/rubocop-rspec-1.35.0 2019-09-19 15:03:06 +00:00
Javier Martín
27702e89a0 Merge pull request #3705 from consul/dependabot/bundler/puma-4.1.1
Bump puma from 3.12.1 to 4.1.1
2019-09-19 16:37:02 +02:00
Javi Martín
766f82a576 Apply RSpec/ExampleWording rubocop rule
This rule was improved in rubocop-rspec 1.35.0 and now it detects a case
it didn't detect in the past.
2019-09-19 16:31:23 +02:00
dependabot-preview[bot]
21634cf4fe Bump rubocop-rspec from 1.33.0 to 1.35.0
Bumps [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec) from 1.33.0 to 1.35.0.
- [Release notes](https://github.com/rubocop-hq/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop-hq/rubocop-rspec/compare/v1.33.0...v1.35.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-16 16:47:42 +00:00
dependabot-preview[bot]
3786adc8ad Bump puma from 3.12.1 to 4.1.1
Bumps [puma](https://github.com/puma/puma) from 3.12.1 to 4.1.1.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v3.12.1...v4.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-16 16:46:40 +00:00
Javier Martín
3c49ae3386 Merge pull request #3496 from LextrendIT/feature/refactor_embedded_video
Refactor embed video helper to disconnect from @proposal
2019-09-14 00:02:41 +02:00
DenisNikolski
54c4a8d34b fix shifts_spec 2019-09-13 22:51:07 +03:00
Javier Martín
61b28224ae Merge pull request #3667 from consul/dependabot/bundler/paranoia-2.4.2
Bump paranoia from 2.4.1 to 2.4.2
2019-09-13 20:44:47 +02:00
dependabot-preview[bot]
32df471946 Bump paranoia from 2.4.1 to 2.4.2
Bumps [paranoia](https://github.com/rubysherpas/paranoia) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/rubysherpas/paranoia/releases)
- [Changelog](https://github.com/rubysherpas/paranoia/blob/core/CHANGELOG.md)
- [Commits](https://github.com/rubysherpas/paranoia/compare/v2.4.1...v2.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-13 17:37:28 +00:00
Javier Martín
edb51c09c2 Merge pull request #3442 from consul/dependabot/bundler/i18n-tasks-0.9.29
Bump i18n-tasks from 0.9.25 to 0.9.29
2019-09-13 19:35:37 +02:00
Javier Martín
17c91d529f Merge pull request #3001 from consul/dependabot/bundler/email_spec-2.2.0
Bump email_spec from 2.1.1 to 2.2.0
2019-09-13 19:30:43 +02:00
dependabot-preview[bot]
f0d4565815 Bump email_spec from 2.1.1 to 2.2.0
Bumps [email_spec](https://github.com/email-spec/email-spec) from 2.1.1 to 2.2.0.
- [Release notes](https://github.com/email-spec/email-spec/releases)
- [Changelog](https://github.com/email-spec/email-spec/blob/master/Changelog.md)
- [Commits](https://github.com/email-spec/email-spec/compare/v2.1.1...v2.2.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-09-12 21:18:16 +00:00