Commit Graph

1204 Commits

Author SHA1 Message Date
Bertocq
ca3d759d9f Refactor Budget publishing prices phases constant to Budget::Phase model 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
Bertocq
36e74d0ef2 Add Budget::Phase model, spec and factory
Create a new Budget::Phase model that:
* Stablishes a relation with its budget
* Stablishes relation with two other Budget::Phases (previous and next)
* Validates basic dates range, kind and description rules.
* Adds scopes to get the ones enabled as well as each individual phase

Create a factory that generates a basic and valid Budget::Phase

Create a model spec that checks kind, date range and budget validations.
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
Raimond Garcia
b0bd7792be Merge pull request #1917 from wairbut-m2c/iagirre-admin-budget-heading-action
Actions for budgets' headings added. Edit headings, delete headings i…
2018-01-11 13:47:27 +01:00
iagirre
0e11e21b2a Merged with master and solved conflicts 2018-01-10 13:23:39 +01:00
iagirre
f0724ce13a Changes suggested in the PR made 2018-01-10 13:13:05 +01:00
Bertocq
3563b87399 Increase Budget Investment model spec for should_show_price & explantion methods 2018-01-10 01:14:23 +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
830bb37189 Enable RSpec/VerifiedDoubles cop, fix issues & stash one
Can't figureout solution for offense at spec/models/verification/management/email_spec.rb
 so its stashed at .rubocop_todo.yml

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
2018-01-07 18:47:19 +01:00
Bertocq
3762fd347e Enable RSpec/ScatteredSetup & fix issue
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
2018-01-07 18:46:58 +01:00
Bertocq
f8fb32db76 Enable RSpec/ScatteredLet cop & fix issue
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
2018-01-07 18:46:58 +01:00
Bertocq
16eae689f9 Enable RSpec/RepeatedExample cop & fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
2018-01-07 18:46:32 +01:00
Bertocq
4f6597b200 Enable RSpec/RepeatedDescription cop & fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
2018-01-07 17:45:34 +01:00
Bertocq
e89d081a47 Enable RSpec/PredicateMatcher cop & fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
2018-01-07 17:42:59 +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
c4aa2d7093 Enable RSpec/MessageExpectation cop & fix issues
There was 34 `allow` occurences and 17 `expect` occurences, so to be consistent `allow` form was chosen.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
2018-01-07 16:36:18 +01:00
Bertocq
3e5b13ae4d Enable RSpec/LetBeforeExamples cop & fix issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
2018-01-07 02:28:06 +01:00
Bertocq
1441de5107 Enable RSpec/HookArgument cop and fix issues
To be consistent about before/after arguments, as `:each` or `:example`
 are same and default scopes, best not to send an argument in those
 scenarios.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
2018-01-07 02:07:19 +01:00
Bertocq
95733f52f2 Enable RSpec/FilePath cop and fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
2018-01-07 02:05:10 +01:00
Bertocq
0698043340 Fix indentations 2018-01-07 01:06:07 +01:00
Bertocq
ed16a78f42 Enables RSpec/ExampleWording and fixes all issues
Both avoiding 'should' and repiting 'it' on the tests description
improves reading them and also makes all descriptions consistent.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
2018-01-07 01:03:45 +01:00
Bertocq
2253155a51 Enables RSpec/EmptyLineAfterSubject & fixes all issues
Read more about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
2018-01-07 00:50:50 +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
265d4d0967 Enables RSpec/DescribedClass cop & fixes all issues
Autocorrection for existing issues, and stashing at .rubocop_todo.yml
the false positives

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
2018-01-07 00:38:19 +01:00
Bertocq
6ec6f64675 Enable RSpec/DescribeClass rubocop rspec cop & fix issues
Manually fixes all issues & "stashed" false positives at .rubocop_todo.yml

Read about the cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
2018-01-07 00:20:55 +01:00
Bertocq
de2816a6a5 Enable RSpec/BeforeAfterAll rule and fix all issues
This cop tries to avoid state leaking between examples. The fixes done on the code don't follow the suggested path, since the usage of `before(:all)` was not really useful. By using RSpec's `let` method we achieve same goals but with much better and readable tests.

Check Cop description at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
2018-01-06 21:16:00 +01:00
BertoCQ
d534b02b3c Merge pull request #2206 from consul/related-contents-score
Related contents score
2017-12-20 15:13:12 +01:00
María Checa
1e23281c28 Fixed related content tests 2017-12-20 13:43:56 +01:00
rgarcia
0152b6301c adds specs 2017-12-19 20:36:10 +01:00
María Checa
44f8494079 Fixed tests 2017-12-19 19:40:09 +01:00
María Checa
4192860a73 Added and improved related content tests 2017-12-18 23:56:44 +01:00
María Checa
97f74ac531 Renamed related content times_reported column to flags_count 2017-12-18 18:21:46 +01:00
BertoCQ
0bd025962b Merge pull request #2200 from wairbut-m2c/aperez-proposal-recommendations
New scopes for proposal recommendations
2017-12-16 19:58:46 +01:00
Bertocq
70f2ee0cf5 Fix Time.now usage to Time.current to include zone 2017-12-16 17:59:16 +01:00
Bertocq
c2b5083d4f Fix missing and extra spacing 2017-12-16 17:59:16 +01:00
Angel Perez
63317714c3 Proposal recommendations won't include archived or already supported proposals 2017-12-15 22:40:24 -04:00
Bertocq
900d8a00b1 Make milestone's description a required attribute 2017-12-15 16:38:21 +01:00
rgarcia
2b52d26d82 refactors notifications into concerns and shared examples 2017-12-14 16:15:30 +01:00
rgarcia
abaf6ab785 adds model validations for legislation proposals 2017-12-13 12:52:25 +01:00
rgarcia
8c85611ec9 Adds missing specs for notification titles 2017-12-11 13:23:30 +01:00
Bertocq
cd021aee4b Add relationed_contents helper function on Relationable concern with spec 2017-11-29 19:02:25 +01:00
Bertocq
0482eb4098 Add report_related_content helper funcion on Relationable concern with spec 2017-11-29 19:02:25 +01:00
Bertocq
04dfc98c3f Create RelatedContent model spec to check relationable destroy 2017-11-29 19:01:50 +01:00
Bertocq
03f0534b2f Add scenario to RelatedContent model spec to check opposite related content creation 2017-11-29 19:01:12 +01:00
Bertocq
f0dca7147b Add basic RelatedContent model spec to check multiple models can be related 2017-11-29 19:01:04 +01:00
María Checa
3984d6a947 Merge pull request #2115 from wairbut-m2c/iagirre-heading-population-restriction-validation
Iagirre heading population restriction validation
2017-11-28 20:06:53 +01:00