aboutsummaryrefslogtreecommitdiffstats
path: root/spec/helpers
AgeCommit message (Collapse)Author
2018-04-27Refs #6572; Fix specsZog
2018-03-14Refs #6146; Fix display in tablesZog
2018-03-01Merge pull request #302 from af83/5877-handle-nil-objects-in-tablebuilderhelperLuc Donnet
5877 Add a condition on TableBuilderHelper::Column
2018-02-20Refs #5863 @6h; Remove workbench id from the querystringZog
Infer it when possible, and use a nested otherwise
2018-02-12Refs #5877; Add a condition on TableBuilderHelper::Column5877-handle-nil-objects-in-tablebuilderhelperZog
2018-01-25Refs #5586 @2h; Fix specsZog
2018-01-11Add Referential#merged_at and make Referentials archived and merged. Refs #5559Alban Peignier
2018-01-10Rename archived_or_finalised? into referential_read_only?. Refs #54135413-read_only_policy_for_finalised_refsAlban Peignier
2018-01-08Fixes: #5413@1h; Specs implementedRobert
2017-12-29Replace CommonHelper.string_keys_to_symbols by Hash#symbolize_keysAlban Peignier
2017-12-20Merge pull request #151 from ↵Luc Donnet
af83/5281-workbench-import-structural-bug-reading-zip 5281 workbench import structural bug reading zip
2017-12-19Refs: #5291@1h; Update TableBuilderHelperZog
Update TableBuilderHelper to allow the `selectable` param to be a lambda, thus allowing us to have row-based granularity.
2017-12-19Refs #5287;Zog
Add specs for the view. Refactor to come
2017-12-15Fixes: #5281@1.2h; View specs and minor CR change from #50065281-workbench-import-structural-bug-reading-zipRobert
- CR change from #5006, severity of zip file messages :warning -> :error - View specs for showing import_messages
2017-12-15Refs: #5281@0.33h; Speced Common Helper's string_keys_to_symbolRobert
2017-12-11Refs: #5197@0.5h; Rebased on master; Empty spec removedRobert
2017-11-22Fix last spec and add short_id method to Netex Objectidcedricnjanga
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-08Merge pull request #110 from af83/4755-page_for_validate_referentialteddywing
4755 page for validate referential
2017-11-06fix specsGuillaume
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-09-14create base structure for compliance_control_setsGuillaume
2017-09-01TableBuilderHelper spec: Update with `Column#link_to` callsTeddy Wing
The `TableBuilderHelper` now requires you to specify a `link_to` attribute in a column you want to make a link out of instead of doing it automagically as before. Update the tests to do this and continue to output the right `<a>`s for links.
2017-09-01Revert "TableBuilderHelper::Column#link_to: Allow arbitrary number of arguments"Teddy Wing
This reverts commit 28db706443a912e8355e4c48488dc40c403e7f76. Turns out we didn't need to be able to pass an arbitrary number of arguments to the lambda after all. The URL helper objects necessary in addition to the first argument to the lambda can be retrieved from the view context directly instead of passing them into the block as parameters (which would actually make things more difficult, because the block is called in the `TableBuilderHelper`, thus outside the scope of the view).
2017-09-01TableBuilderHelper::Column#link_to: Allow arbitrary number of argumentsTeddy Wing
This enables us to pass multiple objects into the lambda, so that we can for example build a URL using a Rails helper using multiple objects. Example: column.link_to(referential, item) lambda do |referential, item| some_path(referential, item) end
2017-09-01TableBuilderHelper::Column: Add `#linkable?` methodTeddy Wing
This tells the markup assembler whether or not this column should be wrapped in a link (`<a>`). It intends to serve the same purpose as `TableBuilderHelper#column_is_linkable`, but at the column level. The idea is to remove that method when these links only operate by column and not by pre-defined values like before/now.
2017-09-01TableBuilderHelper::Column: Add `link_to` argumentTeddy Wing
This parameter will be used as the `href` to link the column value somewhere. We give it a lambda because this makes it easier to call any method on the row object. This means the accessor needs to take the object as an argument, like in the `#value` method, because we don't have a better way to handle that (it can't be done at initialisation time because at that point we don't have row objects, we have a collection).
2017-07-12CompanyDecorator#action_links: Rename `line_referential` context paramTeddy Wing
Rename this to `referential` to be more generic. This is because we could be passing both `Referential`s and `LineReferential`s into this parameter. In `CompaniesController`, we use a `LineReferential` while in `ReferentialCompaniesController` we use `Referential`. Refs #3479
2017-07-12CustomLinks: Pass referential directly when initialisingTeddy Wing
Instead of getting the referential to use when building the polymorphic URL from the `UserContext`, pass in a referential directly. The old code that used `user_context.context[:referential]` relied on the fact that `ApplicationController#pundit_user` was defined as follows: def pundit_user UserContext.new(current_user, referential: self.try(:current_referential)) end (We pass `pundit_user` into `CustomLinks` from `TableBuilderHelper#build_links`.) However, Robert's change 747d333ffbcc8ee0c9f1daf93ccca32799434e04 removes the `current_referential` call from `#pundit_user`. In `CustomLinks`, we actually always want to be using `current_referential`. For example, on `Companies#index` (/line_referentials/:id/companies), `CustomLinks` fails to build a correct #show link because `user_context.context[:referential]` is `nil`, when it should instead be a `LineReferential` object, that gets returned by the `#current_referential` helper method. Sure, `#current_referential` is hard to understand, so maybe we'll change that around in the future, but this at least allows us to use the current referential in `CustomLinks`. Refs #3479
2017-07-12CustomLinks spec: Update method name in spec describeTeddy Wing
The name of this method changed, but wasn't updated in the `describe` label.
2017-07-06Conflict resolvedRobert
2017-07-06TableBuilderHelper: Fix specs which mock `current_referential`Teddy Wing
These two specs were failing because of the line: current_referential ||= nil which would set `current_referential` to `nil` even after updating the object being stubbed to `helper`. Change the specs to stub the method on the correct object now that `TableBuilderHelper::URL` doesn't depend on `current_referential`. Update the faulty line in question to not clobber `current_referential`, but still give us the `nil` value we were looking for when the helper method isn't defined. Refs #3479
2017-07-06Refs:#3478@10h;Robert
Policy Refactoring and Policy Test Completion - All policies (and all permissions) under test. - Common patterns and potential problems identified... - ... and documented in DEVNOTES.md - some simply refactorings
2017-07-05Refs: #3478@1h;Robert
- All permissions tied to `!archived?` - Tests adapted - Policies refactored ? Is `create?` permission bound to `organisation_match?`
2017-07-04Refs: #3478@3h; Policy Cleanup and Providing Policy and permissions for all ↵Robert
models and actions - ApplicationPolicy nondestructive permission depend on model existance - ApplicationPolicy destructive permission default to `false` - Tied Policy permissions at ApplicationPolicy Level: edit? → update?, new? → create?, index? → show? - ApplicationPolicy convenience methods `delete?` & `authorizes_action?(action)` - Refactoring of `spec/helpers/table_builder_helper_spec.rb` accordingly - Stubbing scope in specs (cannot switch to referential with a `build_stubbed` instance)
2017-07-04Refs: #3478@1h removed boiv-read-offer and BoivPolicyRobert
2017-07-04Refs: #3478@0.5h; refactored table_builder_helper/custom_links.rb, according ↵Robert
to moving authoriation BL into policies
2017-07-04Refs: #3478@1h; adapted table builder spexRobert
2017-06-30Updating delete link on link helper (fix tests)jpl
2017-06-26spring stubs created (spring stop needed); Fixes: #3874@1hRobert
2017-06-19TableBuilder spec: Remove TODOTeddy Wing
We're how have a separate module for the box containing links to perform actions on selections of multiple objects in the table. I had put this in `MultipleSelectionToolboxHelper`. Refs #3479
2017-06-19TableBuilder spec: Fix hard-coded IDs in expected stringTeddy Wing
Remove the hard-coded IDs and replace them with the test referential's ID. I guess I had copied the output from the spec output, because the test then passed when I ran it individually, causing me to not catch the error. Only saw it when I ran the full test suite. Refs #3479
2017-06-15TableBuilder spec: Remove TODOsTeddy Wing
These are all finished. Refs #3479
2017-06-15TableBuilder spec: Use `UserContext`Teddy Wing
Instead of building our context with an `OpenStruct`, use the `UserContext` class that actually exists and represents the thing that we want to represent. I had copied the `OpenStruct` way of doing from "spec/support/pundit/policies.rb" this before I found out that `UserContext` existed. Refs #3479
2017-06-15TableBuilder spec: Update delete button confirmation textTeddy Wing
The delete button confirmation text has changed now that we're getting the delete link from `ReferentialDecorator`. Update the spec to reflect the new state of the code. Refs #3479
2017-06-15TableBuilder: Make table-level `sortable` workTeddy Wing
We need the ability to say that an entire table is not sortable. By default, all tables are sortable, and individual columns can have sorting deactivated. This blanket deactivates sorting for all columns. Take our `sortable` argument and pass it to `#thead`. Then `#build_column_header` takes that value into account when creating a header column value. The actual label used in the column header is determined by the old `#column_header_label` method. We've now moved it into the `TableBuilderHelper::Column` class because it makes more sense there. The method will now return the column's `:name` property if it was defined, and otherwise gets the translation for `:key` as before. Add a test on `TableBuilderHelper` that verifies that a table with `sortable: false` returns the correct HTML without sorting links. Refs #3479
2017-06-15TableBuilder spec: Decorate companies collectionTeddy Wing
In order to enable access to `CompanyDecorator#action_links`, wrap the companies collection passed to the table builder in the test in the decorator. Specify the class that `CompanyDecorator` decorates explicitly. Since `Chouette::Company` is namespaced, Draper can't infer the model from the decorator class name. Refs #3479
2017-06-15TableBuilder spec: Update `current_referential` mockTeddy Wing
We're now using the `current_referential` method in `TableBuilderHelper::URL` instead of in `TableBuilderHelper`. Thus it couldn't get `current_referential` and caused an error. Move the mock to `TableBuilderHelper::URL` to give it access to the method. Refs #3479
2017-06-15TableBuilder spec: Add extra links from `ReferentialDecorator`Teddy Wing
A couple more links should appear in the gear menu thanks to the inclusion of the `ReferentialDecorator#action_links`'s links in the menu. The test still fails, though, because the destroy link that comes out of the decorator isn't formatted correctly (it looks like all the other links instead of having a special icon). Refs #3479
2017-06-15TableBuilder spec: Remove table actions duplicated by decoratorTeddy Wing
The `ReferentialDecorator` duplicates the [:archive, :unarchive, :delete] actions, so we should remove these from our test like we did previously in the "workbenches/show.html.slim" template. Refs #3479