Commit Graph

40 Commits

Author SHA1 Message Date
Javi Martín
bd795be80e Check for attribute values in current budget tests
Assigning a variable to each budget we declare results in useless
assignments. We could just delete the three useless assignments and
leave the fourth one, but I find the code easier to read if we use the
name of the budgets to differenciate between them. This way we also keep
the code vertically aligned.
2019-09-30 14:29:15 +02:00
Javi Martín
aeb1655961 Use budget phase traits
We were already using them in many places, but not everywhere.
2019-09-24 21:34:06 +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
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
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
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
58ba517717 Apply RSpec/ExampleWording rubocop rule 2019-09-10 21:43:39 +02:00
lalo
be8a0dbe8a Add Milestone tag select filter on executions public page 2019-06-07 14:17:32 +02:00
Javi Martín
4f4dc2c2af Add show results and stats form to budgets 2019-05-22 11:50:03 +02:00
Javi Martín
8bb0fa4726 Add Budget#valuating_or_later? method
We're going to use it so we know if a budget has finished its support
phase.
2019-05-21 13:50:18 +02:00
Javi Martín
1f225c59ed Use PHASE_KINDS to calculate "or_later?" methods
This implementation is a bit more robust because we don't have to change
any of the "or_later?" methods if we add or remove a new phase.

We could also use metaprogramming to reduce code duplication in these
methods. So far, I've decided to keep the code simple since the
duplication seems reasonable.
2019-05-21 13:50:18 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Julian Herrero
d76782f150 Make budgets translatable 2019-02-13 11:41:58 +01:00
Antonis Tzorvas
c21d806ecc Refs #2603 Show 'See Results' button in admin panel 2018-05-19 13:38:02 +03:00
Bertocq
f0dc2a02a5 Add Budget#formatted_amount unit test 2018-03-08 11:42:22 +01:00
Bertocq
198ff0cd1f Use updatable slug factory trait to sluggable concern
Slugs should only be updated on certain conditions, we need a trait that
meets that conditions and the name of the trait passed as a mandatory &
named argument on the sluggable concern
2018-02-04 23:04:48 +01:00
Bertocq
093b191f16 Small rubocop autocorrections 2018-01-30 03:07:52 +01:00
iagirre
c37496601c Budget and phases specs updated (model specs) to include the new 'Information' phase 2018-01-23 15:42:01 +01:00
Bertocq
8b469c5d98 Fix conflicts with merged branch, Budget::PHASES have moved, and described_class usage is a must 2018-01-16 18:44:21 +01:00
BertoCQ
d44db9cec4 Merge branch 'master' into feature/budget_phases 2018-01-16 17:47:47 +01:00
Bertocq
59fb0b562c Create all Phases after a Budget creation 2018-01-16 12:18:13 +01:00
Bertocq
66691b644a Refactor Budget::PHASES constant to Budget::Phase::PHASE_KINDS 2018-01-16 12:18:13 +01:00
rgarcia
349780922d Add Budget.open scope
Before Budget.current could return multiple budgets, now there can only
be a single current_budget.

Adding the concept of open, which better reflects what the admin sees
in this page: A tab for open budgets and a tab for finished budgets
2018-01-15 22:01:59 +01:00
rgarcia
9176de949a Refactor concept of current budget
When there was only one budget this implementation worked fine

Nowadays there can be multiple budgets, and therefore the definition of
the current_budget has changed. It is no longer a budget that has not
finished, but rather, the last budget created that is not in the
initial drafting phase.

Budgets in the drafting phase are not considered the current_budget,
but rather a budget that is still being prepared and that soon will
become the current_budget
2018-01-15 19:13:37 +01:00
Bertocq
7179dbbba0 Remove deprecated on hold budget phase group, no longer used in code 2018-01-14 20:41:24 +01:00
Bertocq
cb1151f1d6 Increase Budget model spec for new publishing_prices phase 2018-01-10 01:04:32 +01:00
Bertocq
1f0eb49ddc Increase budget model spec for drafting phase 2018-01-08 22:53:14 +01:00
Bertocq
34bb9d65b1 Enable RSpec/NotToNot cop and fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
2018-01-07 17:39:48 +01:00
Bertocq
fa017b664f Enables RSpec/EmptyLineAfterFinalLet cop & fixes all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
2018-01-07 00:49:37 +01:00
Bertocq
512059e021 Increase Budget, Heading and Group model specs to cover slug uniqueness
Why:

* Slug must be unique among:
 1. Budget slug: among other budgets
 2. Group slug: among other groups from its budget
 3. Heading slug: among other headings from all the groups from its budget

How:

* Adding checks for all possible scenarios on each model specs
2017-07-05 12:33:17 +02:00
Bertocq
73e0a5a88d Add to Budget Budget::Heading Budget::Group specs the sluggable shared example
Why:

* Those classes have a slug attribute that needs to be filled

How:

* Just adding the shared example to Budget model spec, and creating the model spec file for Heading and Group to include it as well
2017-07-04 18:40:54 +02:00
Juanjo Bazán
33e8ebf043 adds balloting_or_later? method to Budget 2017-05-09 17:27:58 +02:00
kikito
248755a801 Modifies the investment orders shown by phase 2017-01-05 17:38:36 +01:00
kikito
ecb3461a97 Renames Budget::VALID_PHASES to just PHASES 2017-01-01 13:16:22 +01:00
kikito
d80dedaad8 Adds sanitized descriptions for all phases to budget model 2017-01-01 12:51:17 +01:00
kikito
fa50e3f215 Adds new phases to budget and fixes specs 2016-12-30 18:43:15 +01:00
Juanjo Bazán
b5a6828e41 adds Budget::Group model to group headings
many refactors through budget related models
2016-06-09 18:00:06 +02:00
kikito
a0b6e99f09 adds specs for budged model 2016-05-27 13:02:48 +02:00
kikito
fdc8636e12 Adds simple Budget specs 2016-05-24 14:33:30 +02:00