14 Commits

Author SHA1 Message Date
Javi Martín
e0aee199e4 Merge pull request #5259 from consuldemocracy/dependabot/bundler/rubocop-capybara-2.19.0
Bump rubocop-capybara from 2.18.0 to 2.19.0
2023-11-14 14:31:00 +01:00
Sebastia
c816c51787 Merge pull request #5173 from consuldemocracy/budget_results
Replace back link on budget results
2023-11-14 10:08:31 +01:00
Javi Martín
0cec581ec0 Add and apply Capybara/RSpec/HaveSelector rule
This rule was added in rubocop-capybara 2.19.0. We were following it
about 85% of the time.

Now we won't have to check both have_css and have_selector when
searching the code.
2023-11-08 14:18:16 +01:00
Javi Martín
a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00
Alberto
b34cfaac1b Replace back link on budget results 2023-08-10 18:32:54 +02:00
Javi Martín
62b3521a0f Fix flaky budget results test
We were checking that the price of the investment isn't present on the
page. However, the text "200" could be present in either the title of
the budget or the title of the heading ("Heading 200"), for instance. So
now we're making sure we look for the text on the relevant part of the
page.
2022-08-25 15:17:19 +02:00
Javi Martín
dce8400775 Use investment titles in budget results tests
We were getting some failures because sometimes the titles which are
generated automatically (like "Budget Investment 200 title") contained
the price of the investment, and so, when testing the presence of the
price (200, in this case), the test was failing.

So we're adding a custom title to the investments we create during the
tests.
2022-08-25 14:31:51 +02:00
Javi Martín
969e0014e5 Move budget result test to the model
We were testing that the `calculate_winners` method does not take the
price into account; we can do the same in a model test. We already have
a different system test to check that the price isn't displayed in the
view.
2022-08-25 14:31:51 +02:00
Javi Martín
3778b50310 Fix typo in budget results test 2022-08-25 14:31:51 +02:00
Javi Martín
fd147f883a Add extra step in incompatible investments test
The test was always passing because incompatible investments are only
shown after clicking on the "Show all" link. So now we're clicking the
link  before checking the "incompatibles" table isn't shown.

I don't think "incompatibles" is a valid English word; for now, I'm
leaving it like this until a native English speaker reviews it.
2022-08-25 14:31:37 +02:00
decabeza
4c0499d53b Manage the render of the price field on budgets results section 2022-03-29 14:49:28 +02:00
Javi Martín
a8c4676240 Simplify system tests re-fetching records
It's strange to create records without assigning them to a variable and
then query the database to fetch the very same records. Assigning them
to a variable makes the tests easier to understand.

Besides, this way we avoid querying the database after the browser has
started.
2021-04-16 14:33:26 +02:00
Javi Martín
92ddcb7aef Use JavaScript in system tests by default
JavaScript is used by about 98% of web users, so by testing without it
enabled, we're only testing that the application works for a very
reduced number of users.

We proceeded this way in the past because CONSUL started using Rails 4.2
and truncating the database between JavaScript tests with database
cleaner, which made these tests terribly slow.

When we upgraded to Rails 5.1 and introduced system tests, we started
using database transactions in JavaScript tests, making these tests much
faster. So now we can use JavaScript tests everywhere without critically
slowing down our test suite.
2021-04-07 14:41:06 +02:00
Javi Martín
9427f01442 Use system specs instead of feature specs
We get rid of database cleaner, and JavaScript tests are faster because
between tests we now rollback transactions instead of truncating the
database.
2020-04-24 15:43:54 +02:00