Commit Graph

361 Commits

Author SHA1 Message Date
Javi Martín
5812779974 Fix typo in budget executions spec
We were expecting the page not to have content which is actually there.
The test passed (most of the time) because before clicking the
"Milestones" link the content was not present, and we checked the page
content before the AJAX request generated by clicking the link had
finished.
2019-05-10 15:17:34 +02:00
Javi Martín
ca40e657fb Check page after an AJAX call removing a ballot
We were sending a new request without checking the previous one had
finished, and if it hadn't finished, the test failed.

This test started to fail after upgrading to Rails 5, since we removed
the change done in commit eda47eff which set `config.allow_concurrency`
to `false` in the test environment.

While we could re-introduce that configuration option, which might have
side effects, an easier solution is to check an AJAX request has been
completed before sending a new request depending on the previous one
seems to be a more solid option.

Note this test failed with two possible errors: "undefined method
`heading' for nil:NilClass" and "stale element reference: element is not
attached to the page document". This change fixes the second error; it
might fix the first error as well, but since I couldn't reproduce it
locally, we'll only be sure when this test stops failing in travis
builds.
2019-04-25 20:57:19 +02:00
Javier Martín
844ab5fb0e Merge pull request #3405 from consul/remove_obsolete_test
Fix investment pagination tests
2019-04-03 21:13:07 +02:00
decabeza
d7bde5818e Update texts on check my ballot links 2019-03-28 17:16:15 +01:00
Javi Martín
f6da20da64 Fix typos in investment order tests
There was a typo: `new_order = eq(all(` instead of `new_order = all(`,
which was causing the tests to pass.

However, the final expectation should test that we keep the same order
in the same session, and we were accidentally testing the opposite.

We're also adding an extra check to verify there are investments on the
page, since in some cases we were accessing pages with no investments,
and so these tests were always passing.
2019-03-28 13:51:51 +01:00
Javi Martín
5a529e5eb7 Use investments per page instead of Kaminari's
This is the actual number of investments per page in the index action.

Also note one test was generating 100 extra records, which made the test
take more than 40 seconds (on my machine).
2019-03-28 01:34:27 +01:00
Javi Martín
2b4e1cf358 Add missing double quotes
We overlooked a few single quotes while we changed thousands of them.
2019-03-25 13:22:35 +01:00
decabeza
55a2bcb559 Show unfeasible budget investment messages only when valuation finished 2019-03-06 10:46:03 +01:00
Javi Martín
6682121069 Reuse code to set and order by a random seed 2019-02-20 12:10:12 +01:00
Javier Martín
70a1b7d1ff Merge pull request #3318 from consul/backport-refactor_investments_index
Show all investments in the map
2019-02-20 11:49:06 +01:00
Javi Martín
facfb807e1 Show all investments in the map
We were showing only the ones being shown in the current page because
we were modifying `@investments` using a method which used
`@investments`, and we were calling that method twice.

There are many possible solutions: using a local variable to store the
result of the `investments` method, modifying `@investments` after
modifying `@investments_map_coordinates`, ... I've used the one which in
my humble opinion is a bit less fragile: not using `@investments` inside
the `investments` method. That way, the `investments` method will always
return the same result.

Note `stub_const("Budgets::InvestmentsController::PER_PAGE", 2)`
wouldn't work because `Budgets::InvestmentsController` isn't loaded when
that line is executed. So we need to load it. Instead of requiring the
file, using `#{Budgets::InvestmentsController}` seems to be an easier
solution.
2019-02-19 13:22:49 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Julian Nicolas Herrero
4a12425987 Merge pull request #3296 from consul/make_budgets_translatable
[Backport] Make budgets translatable
2019-02-13 19:01:13 +01:00
Julian Herrero
a963a99c55 Use correct scope to sort headings by name 2019-02-13 13:35:09 +01:00
Julian Herrero
29a704bd60 Show headings in budgets landing page when translations are missing 2019-02-13 13:35:09 +01:00
Julian Herrero
922600252c Make budget headings translatable 2019-02-13 13:35:07 +01:00
decabeza
3471cbb979 Fix hound warnings 2019-02-12 17:19:26 +01:00
Marko Lovic
3c9953e9e0 Make content assertion order-independent 2019-02-12 17:16:46 +01:00
Marko Lovic
4a2fae5e90 Add headings to "headings limit reached" alert msg 2019-02-12 17:16:40 +01:00
decabeza
2d2633e14b Update related specs 2019-02-08 11:56:49 +01:00
rgarcia
55fb14ac14 do not display alert when supporting for whole city 2019-02-07 16:55:24 +01:00
Julian Nicolas Herrero
9da2783814 Merge pull request #3272 from consul/backport_show_unfeasible_and_unselected_investments
[Backport] Show unfeasible and unselected investments for finished budgets
2019-02-06 14:44:43 +01:00
Julian Herrero
c9522b424b Show unfeasible and unselected investments for finished budgets
We were filtering by winners investments for finished budget without
having in consideration other filters.
We want the default filter to be `winners` for finished budgets.
2019-02-06 13:50:50 +01:00
decabeza
a2161f3ace Hide voted group css class if current filter is unfeasible 2019-02-05 17:16:04 +01:00
decabeza
025bcedce9 Show project winner label only if budget is finished 2019-02-05 17:15:40 +01:00
decabeza
7263401561 Remove duplicated budgets specs 2019-02-05 14:01:30 +01:00
decabeza
5409db6c55 Show only selected investments on map from publishing prices phase
If there are no selected investements show all investments on map.
2019-02-05 14:01:27 +01:00
decabeza
773302f0d7 Show only random order for unfeasible and unselected investments 2019-01-30 14:16:25 +01:00
decabeza
9edabb5bf4 Fix links on budgets index page 2019-01-30 14:15:40 +01:00
Julian Herrero
2081269a67 fix Hound violations 2019-01-02 10:46:31 +01:00
Julian Nicolas Herrero
a421df31db Merge pull request #3115 from consul/backport-1758-flaky_spec_currency_symbol
[Backport] Fix flaky spec checking price without currency symbol
2018-12-19 17:27:54 +01:00
decabeza
7316c16edd Adds price explanation link on budget investments show 2018-12-19 13:52:17 +01:00
Raimond Garcia
ea435ac56c Merge pull request #3112 from consul/rubocop_not_to
Add not_to Rubocop rule
2018-12-19 11:29:44 +01:00
Julian Herrero
7a690acf6c fix flaky spec
bin/rspec --seed 53044

Failures:

  1) Budget Investments Balloting Phase Confirm
     Failure/Error: expect(page).not_to have_content "#{sp3.price}"
       expected not to find text "100" in "Global Group - Global Heading You still have €999,989 to invest. Amount spent €11 Budget Investment 1006 title €10 Budget Investment 1005 title €1"
     # ./spec/features/budgets/investments_spec.rb:1466:in `block (4 levels) in <top (required)>'
     # ./spec/features/budgets/investments_spec.rb:1458:in `block (3 levels) in <top (required)>'
     # -e:1:in `<main>'

Failed examples:

rspec ./spec/features/budgets/investments_spec.rb:1419 # Budget Investments Balloting Phase Confirm
2018-12-18 17:56:32 +01:00
Javier Martín
4782ca37d6 Merge pull request #3111 from consul/backport-customize_toda_la_ciudad
Remove custom "toda la ciudad" code
2018-12-18 13:03:51 +01:00
Julian Nicolas Herrero
2175339609 Merge pull request #3106 from consul/2918-crud_budget_groups_headings
Change CRUD for budget groups and headings
2018-12-18 10:23:24 +01:00
voodoorai2000
7917cea676 Change to_not for not_to
Eventhough some of us sentimentals still like the syntax `to_not` the current trend is to move to the new syntax `not_to`.

In this commit we are updating the references of expectations that used `to_not` to `not_to`.
2018-12-15 12:33:28 +01:00
Javi Martín
91d91f2ebf Remove city heading specific code
This code accidentally made it to consul, and it's specific to Madrid.
2018-12-14 18:15:51 +01:00
Julian Herrero
6439be44f1 change CRUD for budget groups and headings
To make it more consistent with the rest of the Admin panel,
the CRUD for budget groups and headings has been changed
from the old "all-in-one" form to a separate form for each resource.
2018-12-14 16:34:54 +01:00
Julian Herrero
25e1afea48 fix map rendering for budget headings 2018-12-14 15:37:22 +01:00
Javi Martín
df29b49d05 Make milestones view reusable 2018-12-11 19:22:55 +01:00
Julian Nicolas Herrero
9aab3ddd7b Merge pull request #3038 from MatheusMiranda/add_map_to_heading_page
Add map to sidebar on Heading's page
2018-12-11 16:32:35 +01:00
Javi Martín
a6adc0b5ab Reduce I18n.t usage in spec
We also make the line shorter so rubocop doesn't complain.
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
Marko Lovic
81f516efd7 Change BudgetInvestmentStatus to Milestone::Status
Generalize the BudgetInvestmentStatus model to Milestone::Status so it
is not specific to budget investments, but can be used for any entity
which has milestones. This is in preparation to make the Milestone
model polymorphic and usable by entities other than budget investments.
2018-11-30 14:15:21 +01:00
Raimond Garcia
ed9e501ae7 Merge branch 'master' into add_map_to_heading_page 2018-11-27 11:07:16 +01:00
Matheus Miranda
06f07b1139 Add map to sidebar on Heading's page
Signed-off-by: Matheus Miranda <matheusmirandalacerda@gmail.com>
2018-11-16 09:05:23 +01:00
decabeza
9284453e69 Adds spec when no message is displayed 2018-11-14 13:56:22 +01:00
decabeza
dfa7148406 Shows unselected message only on balloting or later phase 2018-11-12 17:23:58 +01:00
decabeza
0c5ac8cba6 Removes custom path on budgets executions specs 2018-11-08 11:59:29 +01:00