aboutsummaryrefslogtreecommitdiffstats
path: root/spec
AgeCommit message (Collapse)Author
2017-11-17Merge branch '4516_cleanup_rule_parameter_set'Xinhui
2017-11-17Merge pull request #116 from ↵Luc Donnet
af83/4962-when-WorkbenchImport-is-deleted-also-delete-associated-Referential-if-ready-false 4962 when workbench import is deleted also delete associated referential if ready false
2017-11-16Add Cédric new objectid concernscedricnjanga
objectid_support handles reading and writing object_ids objectid_formater_support gets the right formater class include these concerns in chouette models Remove StifNetexAttributSupport modules because these are handled by the new objectid concerns Add a objectid and formater classes for each format type Add objectid formats to the factories Modify somes specs for object_ids but there are still a number of failling tests
2017-11-15schema_spec: Make regex more readable with whitespace4951-spec-to-validate-that-primary-and-foreign-keys-in-the-database-are-type-bigintTeddy Wing
Thanks again to Robert. Today I learned what the `x` flag is. It ignores whitespace inside the regex pattern. This way we can add spaces to make the pattern more readable and still match what we were matching before when the code was more condensed. Nice! Refs #4951
2017-11-15schema_spec: Remove unnecessary captureTeddy Wing
Thanks to Robert for suggesting `(?:...)`. I didn't know that syntax, happy I learned something new. Here, I had used parentheses for the "or" (`|`), but didn't need the captured value. To do the "or" without capturing, you can use the `?:` inside the start of the parentheses. Refs #4951
2017-11-15schema_spec: Change spaces to `\s`Teddy Wing
Robert wisely recommended using `\s` just in case somehow tabs end up in the `schema.rb` file. Refs #4951
2017-11-14schema_spec: Use Ruby 2.2-compatible heredocTeddy Wing
Apparently the Jenkins server runs Ruby 2.2.0. Sample log output: /usr/bin/ruby2.2 -I/var/lib/jenkins/workspace/stif-boiv-branches/vendor/bundle-201746/ruby/2.2.0/gems/rspec-core-3.5.4/lib:/var/lib/jenkins/workspace/stif-boiv-branches/vendor/bundle-201746/ruby/2.2.0/gems/rspec-support-3.5.0/lib /var/lib/jenkins/workspace/stif-boiv-branches/vendor/bundle-201746/ruby/2.2.0/gems/rspec-core-3.5.4/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb WTF? I thought we were all using Ruby 2.3. Here's the error: /var/lib/jenkins/workspace/stif-boiv-branches/spec/db/schema_spec.rb:38: syntax error, unexpected << (SyntaxError) <<~EOS ^ /var/lib/jenkins/workspace/stif-boiv-branches/spec/db/schema_spec.rb:40: syntax error, unexpected ':', expecting keyword_end Diff: #{diff} ^ Convert the tilde-heredoc to a dash-heredoc to make Jenkins happy. Refs #4951
2017-11-14schema_spec: Show helpful diffTeddy Wing
Change the matching logic to support better diff output. Here, we construct two in-memory string versions of the `schema.rb` file, one with the original content, and another with the pseudo-expected values. Of course, the expected values are generated, not real, but this at least gives devs and idea of what the problem is. Additionally, it also gives the line numbers where the expectation fails from RSpec's default multi-line string differ. This version looks at the file line-by-line instead of streaming it and feeding it through `#grep` and `#grep_v`, so I imagine performance is worse (assuming Ruby uses C-implementations for those functions), but as far as I know there's no way to get line numbers using `#grep`. Since the `schema.rb` file is generally small relatively speaking, this should be fine. Refs #4951
2017-11-14schema_spec: Don't fail for tables without IDsTeddy Wing
Some of our tables don't have IDs. These shouldn't fail on type `bigint` because they don't exist in the first place. Refs #4951
2017-11-14schema_spec: Move spec to a custom RSpec matcherTeddy Wing
This enables us to add custom formatting to the failure message. For now, the logic works the same way as before. The offending lines are compared to an empty array and appear in the output. We're missing line numbers. I think we'll want to actually compare to an entirely new in-memory version of the schema ideally so that it can output the right line numbers and corrections. The differ is based on Alexey Shin's: https://stackoverflow.com/questions/32477104/rspec-custom-diffable-matcher#32479025 Refs #4951
2017-11-14schema_spec: Remove commented `grep` linesTeddy Wing
These were my initial tests for how to do the verification of `bigint` types. Now that the code has been ported to Ruby, we can get rid of these lines. Refs #4951
2017-11-14Add spec to ensure `schema.rb` keys are `bigint`sTeddy Wing
We use `bigint`s by default for all primary and foreign keys in the application. Using `bigint`s provides two advantages: * Matching the Java application, which expects `bigint`s * Providing support for large integer identifiers Here, we add a spec that checks the `schema.rb` file with line-by-line string matching to validate that no primary or foreign keys use non-`bigint` types. The test is a bit rough at the moment, but it works against the temporary migration included in this commit. It should be reworked, though, to include line numbers of the problem fields. Refs #4951
2017-11-14Remove rule parameter set controller, views, helperXinhui
Refs #4516
2017-11-14Remove model rule_parameter_setXinhui
Refs #4516
2017-11-13NetexImport: Destroy referential on destroy if ready:falseTeddy Wing
If the `NetexImport`'s associated `Referential` has `ready: false`, when the `NetexImport` is destroyed, also destroy the `Referential`. This prevents a case where users get an invalid `Referential` as a result of an import, but because of the `ready: false`, it doesn't display on the website, so they can't see what the problem is. Refs #4962
2017-11-13Merge branch 'master' into stagingcedricnjanga
2017-11-13ComplianceCheckSet#update_status: Return `true` if no update happenedTeddy Wing
Return `true` from this method by default. If the `#update` call fails, then it will return `false`, but in all other cases, we should return `true`. That way, when the `Api::V1::ComplianceCheckSetsController#validated` endpoint is called, it will respond with the `ComplianceCheckSet` object instead of: {"status":"error","messages":[]} with no error messages. Refs #4757
2017-11-13ComplianceCheckSet#update_status: Handle resources with "IGNORED" statusTeddy Wing
If any associated resources have the "IGNORED" status, this shouldn't affect the outcome of a "successful" status. Allow the `ComplianceCheckSet` to be "successful" even if some `Resource`s are "IGNORED". Refs #4757
2017-11-13ComplianceCheckSet#update_status: Return result of `#update`Teddy Wing
We should return the result of the `ActiveRecord` `#update` call, so that we can determine if there was an error saving the `ComplianceCheckSet` record. Refs #4757
2017-11-13Revert "ComplianceCheckSet#update_status: Should return a boolean"Teddy Wing
This reverts commit b7477e28f90c961079c7b12c4992071cbc11b2d6. This logic isn't right. We should return true/false based on the result of `update`, as in, whether the value was able to be updated, instead of on the contents of the status.
2017-11-13ComplianceCheckSet#update_status: Should return a booleanTeddy Wing
Ensure that `#update_status` always returns a boolean value. We'll be using this to determine whether the updated status was 'successful' or not. Hmmm. Wait. That's not right. We want to return true from the update, we don't care about the status. The error case should be when the `update` fails. Darn. Refs #4757
2017-11-13ComplianceCheckSet#update_status: Reverse test data orderTeddy Wing
Move the successful `ComplianceCheckResource`s to the end so that these tests fail if we don't wait until the end of a loop through the resoures before updating the status to 'successful'. Refs #4757
2017-11-13ComplianceCheckSet#update_status spec: Add failure status casesTeddy Wing
Add test cases for status update when `ComplianceCheckResource` are "ERROR" and "WARNING". If a single Resource is "ERROR" or "WARNING", then the `ComplianceCheckSet` becomes "failed" or "warning". Refs #4757
2017-11-13ComplianceCheckSet#update_status: Add spec for successful childrenTeddy Wing
Initial spec that checks the correct status field change when all `ComplianceCheckResource`s are successful. Refs #4757
2017-11-13ComplianceCheckSets#validated: Add response bodyTeddy Wing
On successful status update, respond with the `ComplianceCheckSet` object attributes. Otherwise, respond with an error JSON. Refs #4757
2017-11-13ComplianceCheckSetsController: Get ComplianceCheckSet and update statusTeddy Wing
Get the `ComplianceCheckSet` from the URL and call its `#update_status` method. This doesn't currently work all the way. We need to send a real response. Refs #4757
2017-11-13Add route stub for validation finalisationTeddy Wing
This route will be called by the Java application when ComplianceCheck validation is completed. It will perform post-validation work, primarily updating statuses. Refs #4757
2017-11-13Import: Destroy associated `Referential` on destroy if ready:falseTeddy Wing
If the `Import`'s associated `Referential` has `ready: false`, destroy that `Referential` when the import is destroyed. Aaand looking back at the task it turns out that's not what I was supposed to do. Right, it does seem a little weird in retrospect. Instead we want to delete the `Referential`s of child imports. Refs #4962
2017-11-13Change permission list for specscedricnjanga
2017-11-13Refs #4952 Fix bug related to compliance control set action links displaycedricnjanga
2017-11-10Add validation and specs to models on objectid_format presencecedricnjanga
2017-11-09Merge branch '4944_remove_route_section_code'Xinhui
2017-11-09Merge branch 'master' into stagingcedricnjanga
2017-11-09Refs #4932 Change route duplication to redrect to routes#indexcedricnjanga
2017-11-09Refs #4776 Add policies to ComplianceControl and ComplianceControlSetcedricnjanga
2017-11-09Remove model route_sectionsXinhui
2017-11-08Merge pull request #110 from af83/4755-page_for_validate_referentialteddywing
4755 page for validate referential
2017-11-08fix bad indentationGuillaume
2017-11-08filter compliance_control_set by organisation on valisate referential and ↵Guillaume
add specs
2017-11-06fix specsGuillaume
2017-11-06Merge pull request #109 from af83/4802-referential-model-normalisationteddywing
4802 referential model normalisation
2017-11-06Refs #4849 change compliance control clone speccedricnjanga
2017-11-03 Fixes: #4802@1h;Robert
CR 3rd (and hopefully last) part - more typo corrections - reactivating deactivated specs - fixed reactivated specs
2017-11-03Merge pull request #106 from ↵Robert Dober
af83/4782-create-worker-for-compliance-check-copy--rb201710301748 4782 create worker for compliance check copy rb201710301748
2017-11-03Refs: #4802@0.15h;Robert
CR 2nd part - typos - unnecessary `class: Referential` removed from referentials_factory - regrouping of referential_suite related model specs
2017-11-03 Refs:#4802@0.5h;Robert
CodeReview: - Exchange fr and en translation files for referential_suites - Consistent usage of `jeu de donées` and `espace de travail` dans les *fr.yml Fixes: #4802@0.2h; Replaying former work. To identify spec regression Step 3: Added validation of reference_suite#new/current Made all specs pass
2017-11-02ComplianceControlSetCopier spec: Test that `#copy` returns CCkSetTeddy Wing
The `ComplianceControlSetCopyWorker` depends on `ComplianceControlSetCopier#copy` to return the `ComplianceCheckSet` that it creates. Refs #4782
2017-11-02 Refs: #4802@2h; Replaying former work. To identify spec regressionRobert
Step 2: Added validation of reference->workbench->organisation consistency Made all specs pass Chased bug #4826
2017-10-31Fixes: #4774@1h;Robert
Filter Feature Spex of ComplianceControlSet#show implemented
2017-10-31Refs: #4774@2h; Debugging feature specs, added ↵Robert
ComplianceControl.subclass_patterns [amend me] [skip-ci]