aboutsummaryrefslogtreecommitdiffstats
path: root/spec
AgeCommit message (Collapse)Author
2017-12-13spec/support/referential: Restore old exclusions for truncationTeddy Wing
Since the tests I was trying to use `truncation` for are now skipped, remove these exceptions and revert this line back to what it was before all this mess. Refs #5024
2017-12-13referential_lock_during_creation_spec: Skip truncation testsTeddy Wing
Just discussed this with Alban. The truncation tests are breaking the test suite, and I've spent way too long on this already. Take the specs out of the suite for now until we can come up with a different way to run these or test this behaviour without breaking everything. The new task to fix this is #5295. Refs #5024
2017-12-13referential_lock_during_creation_spec: Make truncation strategy stickTeddy Wing
The `truncation: true` strategy wasn't sticking. The config `before` block only ran once for this test file. Instead of attaching the filter to the `it` blocks, put it on the `context`. This correctly gets each test to run in a transaction. Remove the `truncation: false` filter I had added previously as this didn't do what I wanted it to: it prevented the `before` block from running instead of filtering out tests with `truncation: true`. Refs #5024
2017-12-13spec/support/referential: Eliminate data errors in truncation testsTeddy Wing
After the first `truncation: true` test ran, all tables would be cleared. This caused errors as our tests rely on a referential like this existing: Referential.create(name: 'first') It also caused problems with `LineReferential` as the `:chouette_line` factory depends on an existing `LineReferential` associated to the `first` Referential. Add the `referentials` and `line_referentials` tables to the exclusion list when truncating so these tables don't get cleared and the 'first' records persist across test runs like before. To prevent errors trying to unnecessarily switch to the 'first' referential in `truncation: true` tests, disable that functionality by adding a filter to exclude these tests from the normal transactional `before(:each)` config block. Refs #5024
2017-12-13referential_lock_during_creation_spec: Extract method for threadsJohan Van Ryseghem
Refactor these tests to abstract the thread & transaction creation & handling. Thread creation and joining can now live in one place apart from the tests, and the tests have an interface to set up concurrent referential saving. Thanks to Johan for this refactor. Refs #5024
2017-12-13Fix VJ speccedricnjanga
2017-12-13Merge branch 'master' into stagingLuc Donnet
2017-12-12Move logic to ReferentialCloning. Improve specs. Refs #5283Alban Peignier
2017-12-12referential_lock_during_creation_spec: Don't create unnecessary RefTeddy Wing
The `referential_metadata` factory will create an associated referential by default. This causes errors in our tests because we haven't cleaned up the trailing referential. Refs #5024
2017-12-12Referential: Lock table on :updateTeddy Wing
We had been locking the `referentials` table on :create, but we also want to handle :update. Paired on this with Johan. When I used: referential_2.metadatas << metadata_2 the referential was saved. To add the metadata without automatically saving the referential + metadata, Johan suggested using the nested attribute method: referential_2.metadatas_attributes = [metadata_2.attributes] This allows us to add the metadata and still use the `#save` method to lock the table. Also change the callback from `before_validation` to `before_save` because before_validation :lock_table, on: [:create, :update] didn't work. That caused an error in our `expect`, as the `be_valid` triggered the lock callback. To enable the callback on both :create and :update, use a `before_save` instead. Refs #5024
2017-12-12Referential: Raise an error if the table lock times outTeddy Wing
Paired with Johan on this one. There's an internal timeout on our table lock. If it's reached, an `ActiveRecord::StatementInvalid<PG::LockNotAvailable>` error is raised. Use a custom error instead by "overriding" `#save` with a method that raises our custom error in that case instead. This will enable us to provide a custom user-facing error in the event this happens. Refs #5024
2017-12-11rails_helper.rb: Remove `use_transactional_fixtures = true`Teddy Wing
We want `DatabaseCleaner` to handle our database cleanup because sometimes we need to use a database truncation strategy instead of transactions. I need it to test the `Referential` table lock. This line gets removed instead of the config being set to `false` here because we defer to `spec_helper.rb` which already does that and does the `DatabaseCleaner` stuff through `spec/support/referential.rb`. Refs #5024
2017-12-11Refs: #5197@0.5h; Rebased on master; Empty spec removedRobert
2017-12-11Refs: #5197@0.25h; Minor ApprovementsRobert
2017-12-11Refs: #5197@0.5h; Passing specs addedRobert
2017-12-11Merge branch 'master' of github.com:af83/stif-boivRobert
2017-12-11Hotfix (Refs: #5209) Skip randomly failing specRobert
2017-12-11Merge pull request #144 from af83/4812-display_empty_compliance_control_blocksLuc Donnet
Refs 4812 UX changes to show empty compliance control blocks so the u…
2017-12-08Merge pull request #142 from af83/5198-workbench-view-spec-modal-action-boxteddywing
Refs: #5198@1.5h; Specing the presence of the Modal Action Box
2017-12-08Refs 4812 UX changes to show empty compliance control blocks so the user can ↵4812-display_empty_compliance_control_blockscedricnjanga
see them all
2017-12-08Merge branch 'master' into stagingLuc Donnet
2017-12-07Fix worbench_import status update when a netex_import has a warning status ↵Luc Donnet
and others successful Refs #5202
2017-12-07Refs: #5198@1.5h; Specing the presence of the Modal Action BoxRobert
- verifying the visibility of the action box - no dynamic behavior of the action box is verified (yet?) - would need javascript execution - refactoring suggestions --> https://projects.af83.io/issues/5206
2017-12-06Merge branch 'master' into stagingLuc Donnet
2017-12-06Merge remote-tracking branch 'origin/master' into ↵Teddy Wing
5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659
2017-12-06referential_lock spec: Don't create unnecessary referentialTeddy Wing
The factory for `referential_metadata` was creating an unnecessary `Referential` object since it has an association set up. This was causing the test to fail because that referential's schema wasn't getting cleaned in the `ensure` block. Don't create that referential to avoid the error. Refs #5024
2017-12-06spec_helper.rb: Enable `truncation` test; Disable `wip` testsTeddy Wing
I didn't notice this when I added the `truncation` filter to my `referentials` table lock test, but the way the specs are configured, it wouldn't be run by default with the rest of the tests. Luc did notice, and suggested we change the filter options. We will now always run tests with the `truncation: true` filter (removing the `filter_run_excluding` config makes them enabled), as these include JavaScript-dependent feature tests that we want to be sure to execute. Additionally, we exclude tests with the `wip: true` filter, as it doesn't really make sense to run these "work in progress" tests by default. Refs #5024
2017-12-06- Change inheritance naming in api/v1 controllers => it generated errorscedricnjanga
- add format: :json in controller specs
2017-12-05Add some changes according to PR reviewcedricnjanga
2017-12-05Merge remote-tracking branch 'origin/master' into ↵Teddy Wing
5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659 Conflicts: app/models/referential.rb A whitespace conflict in a place I don't even remember editing? Okaay.
2017-12-05Fixes: #5179@1h; Referential Creation Enforces objectid_format from ↵5179-ref_creation_enforces_objectid_formatRobert
associated Workbench - CR changes implemented
2017-12-05Refs: #5179@0.25h; Referential Creation Enforces objectid_format from ↵Robert
associated Workbench - Removed obsolete spec
2017-12-05Refs: #5179@1.25h; Referential Creation Enforces objectid_format from ↵Robert
associated Workbench - changed ObjectIdFormatterSupport as requested - respeced all defined cases - implemented respec Missing: What to do in `define_default_attributes` if ref has no workbench and no `objectid_format`?
2017-12-05Refs: #5179@1h; Referential Creation Enforces objectid_format from ↵Robert
associated Workbench [skip-ci] - speced the `define_default_attributes` part - speced the Reference.new_from part
2017-12-05referential_lock_during_creation_spec: Remove extra whitespaceTeddy Wing
Refs #5024
2017-12-05referential_spec: Move lock tests to a new file, small improvementsRobert
* Move these two tests to a new file to isolate them from the normal Referential model tests * Move the `workbench` to a `let` * Remove unnecessary schema deletions in transactional synchronous test * Add comments describing the lock mechanism and how we test it with threads & sleeps
2017-12-05spec_helper.rb: Use new Ruby hash syntaxTeddy Wing
Refs #5024
2017-12-05networks_spec.rb: Use new Ruby hash syntaxTeddy Wing
Refs #5024
2017-12-05lines_spec.rb: Use new Ruby hash syntaxTeddy Wing
Refs #5024
2017-11-30Merge branch 'master' into stagingLuc Donnet
2017-11-30Merge branch 'master' into 5093-fix_import_policyLuc Donnet
2017-11-30Fixes: #5130@0.5h; Added a quickfix for incorrect item_id type in versions5130-del_fk_compliance_ctrl_set_in_compliance_check_setsRobert
2017-11-30Fixes: #5130@0.5h; Spec added, migration addedRobert
2017-11-30Fix import policy to not authorize destroy and not be linked with ↵Luc Donnet
referential state (archived) Refs #5093
2017-11-30Merge branch 'master' into 4981_last_editorXinhui Xu
2017-11-29Fixes Company spec. Refs #4967Alban Peignier
2017-11-29Fixes LinePolicy spec. Refs #4824Alban Peignier
2017-11-29Fixes StopAreaPolicy spec. Refs #4825Alban Peignier
2017-11-29referential_spec(duplicate referential): Remove unnecessary associationTeddy Wing
When creating `ReferentialMetadata`s, I had written in associations with the `Referential`s built at the top of the tests. However, since those referentials weren't saved and had no IDs, these "associations" had no meaning. They can just be removed, and the association will be taken care of by the `referential_#.metadatas <<` lines. Thanks to Robert for pointing this out in pre-review. Refs #5024
2017-11-29spec/support/referential: Rename `:js` filter to `:truncation`Teddy Wing
This `before` hook allows tests to use the "truncation" database cleanup strategy. It doesn't do anything explicitly JavaScript-related. Rather, it was named JS because it was intended to be used for feature tests with JavaScript. However, now that I need to use it for a couple tests in `spec/models/referential_spec.rb`, the `:js` name doesn't make sense. Rename the filter to something that says what it does, not how it should be used. Refs #5024