aboutsummaryrefslogtreecommitdiffstats
path: root/spec
AgeCommit message (Collapse)Author
2017-11-29referential_spec(duplicate referential): Check that lock gets releasedTeddy Wing
Add an extra referential to the test and check that it gets saved to confirm that the table lock gets released at the end of the transaction. Not sure if this is actually necessary to verify, but wanted to make sure before I had gone and read the Postgres docs (https://www.postgresql.org/docs/9.4/static/explicit-locking.html#ADVISORY-LOCKS). Refs #5024
2017-11-29referential_spec: Add threaded version of duplicate referential specTeddy Wing
This replicates the synchronous test and adds threads and sleeps to save the two referentials asynchronously. This version fails, which is consistent with the current behaviour of the application. Refs #5024
2017-11-29referential_spec: Clean up duplicate referential specTeddy Wing
Remove old commented code that no longer relates. The thread code will be moved to a new test. This test now validates the existing behaviour synchronously. Update the test descriptions accordingly. Refs #5024
2017-11-29referential_spec(duplicate referential): Validate existing behaviourTeddy Wing
Change bits of the test to validate that when saving duplicate `Referential`s synchronously, the second one fails to be saved. A few things needed to be changed since the last commit in order to get this test working: * Most crucially: The `metadata_1.save` lines needed to be removed. The metadata is indended to be saved at the same time as the `Referential`s. Otherwise, the validation doesn't work the way it should. * `create` the workbench in order to be able to associate it with the new referentials. * Explicitly set the referential organisation to the workbench organisation to pass validation that they both refer to the same organisation. * Explicitly make the `has_many` association of the metadata objects to referentials. * Since the second referential doesn't get saved when the spec passes, no schema is created for it. Thus our previous `Apartment` `drop` call failed for the second schema. To cover our bases for when the test both fails and passes, check if the referentials were persisted as a way of knowing whether the schema exists before trying to remove it. Refs #5024
2017-11-29referential_spec: Duplicate Referential spec not workingTeddy Wing
I removed the threads to try to test this synchronously. What should happen is, the second referential should not be created. But it does get created. So I'm thinking I made a mistake in setting up the data, and the validation for 'same referentials' isn't run: Failures: 1) Referential when two identical Referentials are created at the same time only creates one Referential Failure/Error: expect(referential_2).not_to be_persisted expected `#<Referential id: 3, name: "Test 1", slug: "test_1_different", created_at: "2017-11-28 15:41:04", upd...t: nil, created_from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex">.persisted?` to return false, got true # ./spec/models/referential_spec.rb:174:in `block (3 levels) in <top (required)>' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call' # -e:1:in `<main>' Finished in 8.46 seconds (files took 0.82295 seconds to load) 1 example, 1 failure Just committing this to have it around since I spent a long time fiddling with it. Next, planning to replace the factories with actual imports to see if I can get the right result. Edit: just realised that actually I can't try it with actual imports because that's handled by Java. Refs #5024
2017-11-28Refs #4824, #4825 fix views tests to new layoutGuillaume
2017-11-28Remove page title test on views specXinhui
2017-11-28Refactoring move render pageheader into layoutXinhui
2017-11-28Add has_paper_trail on modelsXinhui
2017-11-28Referential spec: Add spec that two similar Referentials being persistedTeddy Wing
Here we formalise a bug whereby two "identical" `Referential`s are able to be saved even though Rails validation would normally prevent this. It can happen when two `Referential`s are functionally identical (but have different `slug`s, as this would trigger a Postgres error). In practise, this happens when multiple imports of the same data are launched at similar times. We'll want to make this test pass by not allowing the identical `Referential` to be created. This will be accomplished as agreed with the team by a database table lock. The threads and sleeps (in particular) are unfortunate necessities needed to get the two `Referential`s to be saved at the same time. TODO: Need to check this again with the threads & sleeps turned off to confirm that this passes in that case (actually it doesn't), so this test needs some modification in order to be correct. Refs #5024
2017-11-27referential_spec: Remove obsolete commented testTeddy Wing
This test was commented in October 2016, over a year ago (6acac72115b2e575fb1698d74958356fe4d542f8). Seems like a good time to get rid of it. Refs #5024
2017-11-27Merge branch 'master' of github.com:af83/stif-boivcedricnjanga
2017-11-27Refs #4941 Fix objectid short version Display on viewscedricnjanga
2017-11-27Merge branch '4941-refactoring_object_id'cedricnjanga
2017-11-27Refs #5030 Fix missing translation for UnactivatedStopPoint ComplianceControlcedricnjanga
2017-11-27Skip API key features test when STIF::Dashboard isn't used. Refs #4655Alban Peignier
2017-11-27Test Devise::CasSessionsController flash message with more specific messageAlban Peignier
2017-11-24Add specs for Objectid modelscedricnjanga
2017-11-24Remove specs we dont need anymorecedricnjanga
2017-11-24Take into account code reviewcedricnjanga
2017-11-23Add spec for stif_netex objectid_formatcedricnjanga
2017-11-23Merge branch 'master' into stagingLuc Donnet
2017-11-22Rebase master and resolve conflictscedricnjanga
2017-11-22Fix last spec and add short_id method to Netex Objectidcedricnjanga
2017-11-22Change the way we name classescedricnjanga
We now always use modules for namespaces => same structure for models, decorators, policies...
2017-11-22Change the use of namespace and remove modulescedricnjanga
2017-11-22Add some changes to the objectid constructioncedricnjanga
2017-11-22Add 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-22Merge branch 'master' into 4941-refactoring_object_idcedricnjanga
2017-11-22Merge branch 'master' into 4941-refactoring_object_idcedricnjanga
2017-11-22Fix the delation of the hacking of Chouette::ActiveRecord#model_name to ↵cedricnjanga
remove the Chouette namespace off of the construction of link in the app and in other places. Added a small change in the reflex sync to set the stop_area_referential in the initialization of the object to be in sync with the work on the objectids (need a objectid_formatter)
2017-11-21Change the way we name classescedricnjanga
We now always use modules for namespaces => same structure for models, decorators, policies...
2017-11-20Rearrange policies and decorators folders to include them after renaming ↵cedricnjanga
class names on several models
2017-11-20Change the use of namespace and remove modulescedricnjanga
2017-11-17Add some changes to the objectid constructioncedricnjanga
2017-11-17NetexImport: Don't destroy non-existent ReferentialsTeddy Wing
Luc discovered this error in my method that destroys associated non-ready `Referential`s: > WorkbenchImport.destroy_all WorkbenchImport Load (3.0ms) SELECT "public"."imports".* FROM "public"."imports" WHERE "public"."imports"."type" IN ('WorkbenchImport') (1.5ms) BEGIN ImportMessage Load (2.7ms) SELECT "public"."import_messages".* FROM "public"."import_messages" WHERE "public"."import_messages"."import_id" = $1 [["import_id", 58]] ImportResource Load (1.9ms) SELECT "public"."import_resources".* FROM "public"."import_resources" WHERE "public"."import_resources"."import_id" = $1 [["import_id", 58]] Import Load (0.3ms) SELECT "public"."imports".* FROM "public"."imports" WHERE "public"."imports"."parent_id" = $1 [["parent_id", 58]] ImportMessage Load (0.5ms) SELECT "public"."import_messages".* FROM "public"."import_messages" WHERE "public"."import_messages"."import_id" = $1 [["import_id", 59]] ImportResource Load (4.8ms) SELECT "public"."import_resources".* FROM "public"."import_resources" WHERE "public"."import_resources"."import_id" = $1 [["import_id", 59]] SQL (1.3ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 636]] SQL (0.3ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 635]] SQL (0.2ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 634]] SQL (0.2ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 633]] SQL (0.2ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 632]] SQL (0.2ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 631]] SQL (0.2ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 630]] SQL (0.1ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 629]] SQL (0.2ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 628]] SQL (0.1ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 627]] SQL (0.1ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 626]] SQL (0.3ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 625]] SQL (0.3ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 624]] SQL (0.2ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 623]] SQL (0.2ms) DELETE FROM "public"."import_resources" WHERE "public"."import_resources"."id" = $1 [["id", 622]] Import Load (0.3ms) SELECT "public"."imports".* FROM "public"."imports" WHERE "public"."imports"."parent_id" = $1 [["parent_id", 59]] Referential Load (0.6ms) SELECT "public"."referentials".* FROM "public"."referentials" WHERE "public"."referentials"."id" = $1 LIMIT 1 [["id", 18]] (0.2ms) ROLLBACK NoMethodError: undefined method `ready' for nil:NilClass from .../stif-boiv/app/models/netex_import.rb:20:in `destroy_non_ready_referential' Since `referential` is not a required attribute, it can be nil. That was causing this to break because I tried to destroy a `Referential` that doesn't exist. Check that there's an associated `Referential` before trying to destroy it. Refs #4991
2017-11-17Merge pull request #113 from af83/4823-compliance_check_showteddywing
4823 compliance check show
2017-11-17Refs: #4823@0.2h; Code Review Part IIRobert
2017-11-17Fixes: #4823@0.5h; Fixed regression in Ransack button "Effacer" implicit ↵Robert
path does not work anymore
2017-11-17Refs: #4823@2h; Chasing and fixing regressions in feature specsRobert
2017-11-17Refs: #4823@0.5h; Translations changedRobert
2017-11-17Refs: #4823@1.7h; CodeReview #show -> #executedRobert
2017-11-17Fixes #4823@1h;Robert
- I18n.t explicit in helper so that it can be used in specs. - Typo in spec db setup fixed and setup of blocks put into create instead of later update.
2017-11-17Refs: #4823@4h; Fixed Transport(Sub)mode validation bugRobert
2017-11-17Refs: #4283@16h;Robert
- Implements the view Missing: - Spex failing (xpath navigation inside the display blocks is still faulty) - Links to compliance_checks#show do not work (actually not this page's problem)
2017-11-17Refs: #4823@1h; scaffolding feature spec, but blocked by #4826 [amend me] ↵Robert
[skip-ci]
2017-11-17Refs: #4461@0.75h; Fixing netex_import after_create callback to ↵Robert
after_commit on: :create
2017-11-17Refs: #4461@1h; CodeReviewRobert
- using webmock instead of mocking Net::HTTP therefore removing the connascence between the spec and the HTTP lib used in the implementation, thank you Teddy
2017-11-17Fixes: #4461@2h; Specing and ImplementingRobert
2017-11-17Refs: #4461@1.5h; Repaired netex_import factory, adapted spec/models/import_specRobert