aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
AgeCommit message (Collapse)Author
2017-12-19Refs #5325@0.5h; Use policies for calendar sharingZog
Use policies to determine if a user is allowed to share a calendar, instead of a hardcoded string
2017-12-19Refs #5333@1.5h; Use permissions to sync StopAreas and LinesZog
- add missing policies - update permissions translator - update views to check for the permission - update views helper to check for the permission - uipdate controllers to check for the permission
2017-12-15Refs: #5006@0.7h; CR changes from #5006 & staring error_messages in imports/showRobert
- Renaming as requested STIF::NetexFile::Frame.get_line_object_id -> get_sgort_id - working on error_messages for imports#show
2017-12-14Refs: #5006@12h;Robert
Implementing allowed vs foreign line lookup for the zip service - Adapting `lib/stif/netex_file.rb` to expose the already implemented matching - `app/services/zip_service.rb` augmented to check for allowed lines and returning forbidden lines - Specs with fixtures and using the beforementioned new zip support in the specs - Fixture directories for the new specs
2017-12-13Fix compliance control block#edit view pageheadercedricnjanga
2017-11-06Refs #4849 change compliance control clone speccedricnjanga
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-10-17Fixes: #4727@0.1h; Added organisation to clone for and rebased master4727-clone-compliance-control-setRobert
2017-10-17Refs: #4727@2h; Debugged test setup to comply to new validationRobert
2017-10-17Refs: #4727@3h; Specing and implementing lib function to clone ↵Robert
ComplianceControlSet
2017-10-16Fix test spec/lib/compliance_control_set_copier_spec.rb due to uniqueness of ↵Luc Donnet
compliance_control code Refs #4731
2017-10-12Refs: #4709@0.75h;Robert
DONE: - Copied all node atts for ComplianceChecks - Migration of CompliancCheck#criticity int -> string TODO: - Check what to do with attribute ComplianceCheck#type
2017-10-12Refs: #4709@1h; Preparing tests for correctly copy of data and migrationRobert
2017-10-12Refs: #4709@0.15h; Need to merge 4707 with fixed specsRobert
2017-10-10Fixes: #4707@1.5h;Robert
2017-10-09Refs: #4629@1h; Implementing CR + missing worker specRobert
2017-10-09Fixes: #4629@4.5h; Implemented copyRobert
2017-09-25ModelAttribute spec: Move `#instance_variable_set` to `before` block4401-compliance-control-ModelAttribute--address-Robert,s-commentsTeddy Wing
Recommendation from Robert. The `@__all__` is an implementation detail. It's more fragile to use `#instance_variable_set` in each test. Instead, put that part in a `before` block so that if we decide to change it, we only have to do so in one place. Now each test can blithely assume that `ModelAttribute.all` starts out as an empty list. Refs #4401
2017-09-22ModelAttribute: Add `#from_code` methodTeddy Wing
Enables finding a `ModelAttribute` by a string code combining klass and name. Refs #4401
2017-09-22ModelAttribute: Add `.group_by_class` methodTeddy Wing
This returns all defined `ModelAttribute`s as a hash of class keys containing lists of the attributes they contain. Refs #4401
2017-09-22ModelAttribute: Add `.classes` methodTeddy Wing
This allows people to get a list of the classes defined in `ModelAttribute`. The classes are turned into constant-cased strings. Not sure if that's useful, but this is how it was described in the ticket. Refs #4401
2017-09-22ModelAttribute: Add `.methods_by_class_and_type` methodTeddy Wing
This enables filtering by class like `.methods_by_class` and additionally only selecting attributes matching a certain data type. Refs #4401
2017-09-22ModelAttribute spec: Rename `@@all`Teddy Wing
In c9a997f337c9b45f62b50629de96fa95f20c1a7f, we changed the storage mechanism of `all` and made it not a class method. Update the spec description to reflect this. Refs #4401
2017-09-19ModelAttribute.methods_by_class: Take symbol parameter instead of stringTeddy Wing
Didn't like how `#initialize` takes a different type for `klass` than `.methods_by_class`. Make these types and values uniform. If we need to change it, we should make a separate mechanism to do so. I think. Refs #4401
2017-09-19ModelAttribute: Add `.methods_by_class` methodTeddy Wing
Allows us to get all `ModelAttribute`s given a certain class name. Needed an `#==` method to be able to test object equality more easily so I added one in. I don't like that the `klass` is a lowercase symbol and the `klass` attribute to `.methods_by_class` is a constantized string. Want to correct that and make them uniform. Only did it this way because that's how it was suggested in the ticket. Refs #4401
2017-09-19ModelAttribute: Add `#code` methodTeddy Wing
A method that returns a string representation of the attribute, in the form `:class#:name". This will be used to store a reference to the attribute in the database. For example, a validation will reference a `ModelAttribute` in a database column using this `#code` string. Refs #4401
2017-09-19ModelAttribute spec: Allow test to handle existing elements in `@@all`Teddy Wing
When `ModelAttribute` instances are added to `@@all` directly in the class, the test breaks. Make it a little more robust by checking change in array size instead of total size. Refs #4401
2017-09-19Add `ModelAttribute`Teddy Wing
This new class will allow us to generate a list of all editable fields in all our models including the type of each field. We need this for Compliance Control, in order to get a list of fields or models & fields that can be selected to validate a given model validation check. The crucial bits here are the models, fields, and the types of those fields. These need to be defined (manually at least to begin with), accessible, and filterable. Refs #4401
2017-09-19Merge pull request #69 from af83/4431-permission-renamingLuc Donnet
Fixes: #4431@0.16666666666666666h;
2017-09-14Fixes: #4442@0.5h;4442-api_keys-permissions-spexRobert
2017-09-14Fixes: #4431@0.16666666666666666h;4431-permission-renamingRobert
2017-09-13Uses match_array in permission_translatorspec. Refs #4019Alban Peignier
2017-08-27Create STIF::NetexFile to read zip content and create ReferentialMetadata ↵Alban Peignier
from real data. Refs #4273
2017-08-01Merge pull request #46 from af83/3507_1726_impl_workbench_importteddywing
3507 1726 impl workbench import
2017-07-31Refs: #3507_1726@6h Code ReviewRobert
2017-07-24Refs: #4019@1h; Adds spec for Permission Translation and implements it in ↵Robert
lib/stif/permission_translator
2017-07-10hotfixRobert
2017-06-09refs 3604 @12h all tests passRobert
2017-06-08Refs: #3604 @2h checking sequences as defaultsRobert
2017-06-06Refs: #3604; rewriting schema cloner in RubyRobert
2017-06-06Refs: #3604; added tests for cloning with data ⇒ ✓Robert
2017-05-31Revert "Revert "time_duration_spec.rb: Make old test style uniform with new ↵Teddy Wing
tests"" This reverts commit b0e6bc3ffd02146fd999f12975f269dac94a0994. Reinstate the updated `TimeDuration` spec code. Seems like this was reverted by accident. Robert was doing a complicated merge/rebase and somehow in the mix this commit ended up being unintentionally reverted. > 16:23:26 +0200 < robert> @teddy merge idiosynchrasy I did not touch these specs deliberately but must have pulled in the old version by error sorry > 16:24:19 +0200 < robert> I had some strange conflicts and rebased twice, hmmm, strange though I just did not touch these specs for months > ... > 16:25:10 +0200 < robert> anywyay feelfree to undo my undoing :blush:
2017-05-29Revert "time_duration_spec.rb: Make old test style uniform with new tests"Robert
This reverts commit 52d2c968cac7e901b8e6fa3d1be115239b7c5937.
2017-05-29time_duration_spec.rb: Make old test style uniform with new testsTeddy Wing
Change the variable names to `earlier` and `later`, and use explicit `true` and `false` values to be consistent with the newer tests in this file. The new variable names in particular should be a little quicker to understand. Refs #870
2017-05-29TimeDuration.exceeds_gap?: Fix duration > 24 hours behaviourTeddy Wing
Previously, the `#exceeds_gap?` method would modulo the `later - earlier` duration against 24 hours such that no duration exceeded 24 hours, and the resulting duration being compared was adjusted to fit inside a single day. When we removed the numbers from `exceeds_gap?`, we also removed the modulo operation. I had a feeling that would potentially cause problems, and it turns out it did. Though it still took too much investigation time to realise that the most obvious answer was in fact the correct one. Blame the confusing test failures if I will: Failures: 1) Chouette::VehicleJourney state_update should return errors when validation failed Failure/Error: expect(state['errors'][:vehicle_journey_at_stops].size).to eq 1 NoMethodError: undefined method `[]' for nil:NilClass # ./spec/models/chouette/vehicle_journey_spec.rb:148:in `block (3 levels) in <top (required)>' 2) Chouette::VehicleJourney state_update vehicle_journey_at_stops should return errors when validation failed Failure/Error: expect(item['errors'][:arrival_time].size).to eq 1 NoMethodError: undefined method `[]' for nil:NilClass # ./spec/models/chouette/vehicle_journey_spec.rb:189:in `block (4 levels) in <top (required)>' 3) VehicleJourneyImport.save should not import vehicle_journeys and not create objects when vehicle journey at stops are not in ascendant order Failure/Error: expect(VehicleJourneyImport.new(:route => route, :file => invalid_file_on_vjas_object).save).to be_falsey expected: falsey value got: true # ./spec/models/vehicle_journey_import_spec.rb:90:in `block (3 levels) in <top (required)>' Finished in 4 minutes 20.7 seconds (files took 14.47 seconds to load) 1089 examples, 3 failures, 23 pending Failed examples: rspec ./spec/models/chouette/vehicle_journey_spec.rb:137 # Chouette::VehicleJourney state_update should return errors when validation failed rspec ./spec/models/chouette/vehicle_journey_spec.rb:183 # Chouette::VehicleJourney state_update vehicle_journey_at_stops should return errors when validation failed rspec ./spec/models/vehicle_journey_import_spec.rb:89 # VehicleJourneyImport.save should not import vehicle_journeys and not create objects when vehicle journey at stops are not in ascendant order These three tests failed with my version of `exceeds_gap?`. To correct the failures, add back in the 24-hour adjustment. Put it in a named method that is hopefully clear enough to understand. The second test failure ("vehicle_journey_at_stops should return errors when validation failed") used two times that were the same. I decided to add a test for this because it seemed like an interesting edge case. The test I added didn't fail even for the previous version of `.exceeds_gap?`, but I figure it seems like a useful test anyway. Refs #870
2017-05-29time_duration_spec.rb: Remove unnecessary `let!` & `subject`Teddy Wing
These are holdovers from when these specs were copied from `vehicle_journey_at_stop_spec.rb`. They're not used in our specs now so get rid of them. Refs #870
2017-05-29TimeDuration: Move `.exceeds_gap?` specs into the module's spec fileTeddy Wing
Take the specs out of the `IncreasingTimeOrderValidator` spec and move them into `TimeDuration`. This is part of the consolidation and complete move of the `exceeds_gap?` method into `TimeDuration`. Add a context to the two test blocks that specifies the duration at a 4 hour gap. Currently the implementation doesn't do anything with that argument, but this makes it clearer that we're using a four hour duration. Refs #870
2017-05-02more duplicates of Range#intersection removed and range_ext required insteadRobert
2017-05-02removed forgotten bkptRobert
2017-05-02duplicate code from models/calendar removed; coherent naming in ↵Robert
Range#intersection