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.
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.
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.
We were getting an exception when quering[1] for milestones which were not present, due to for example having a publication date later than today
Adding a `try` statement and spec to avoid this situation
[1] 82efc3dd66/app/controllers/budgets/executions_controller.rb (L16)
The page should not show any headings which don't have any
winning investments. The "no content" message should only be
shown when there are no headings with investments to avoid an
otherwise blank page.
__Note:__ in the main @headings query, _both_ #includes and #joins
are needed to:
1. eager load all necessary data (#includes)
and
2. to perform an INNER JOIN on milestones to filter out investments
with no milestones (#joins).