Open swt2public opened 2 years ago
Sorry, it's not working for me yet:
Given a paper When a user visits the paper's edit page Then it should show paper authors as selected
Expected to find css "option[selected][value='1']" 1 time but there were no matches
If you have problems solving this task, please don't hesitate to contact the teaching team!
Scenario
Given a paper When a user visits the paper's edit page Then it should have a single multiple select box
Hints
Make sure the n:m relation of papers and authors works in your automated tests, i.e. models are annotated with
has_and_belongs_to_many
and a db migration for the new join table was created and run.On a paper's edit page, it should be possible to add multiple authors. An HTML multiple select element allows this. Rails' select helper in combination with the 'options_from_collection_for_select' helper can be used to create the required HTML element:
Notice the usage of
author_ids
in the code snippet. These are the ids transmitted by the form to the server.The paper controller must be able to deal with the additional author information that is passed by the new select element to save the changes. Make sure that you have "permitted" the parameters for passing the author ids to the paper controller (function
paper_params
) using:author_ids => []
.Error
40 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.