aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/model_attribute_spec.rb
AgeCommit message (Collapse)Author
2018-03-18Refs #6210 Remove status value attribue from Chouette::VehicleJourney and ↵6210-remove-attributes-from-modelscedricnjanga
section status fron Chouette::JourneyPattern
2018-03-08Refs #6028 small changes in model attribute for CC6028-compliance-controls-model-attributescedricnjanga
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