Open swt2public opened 3 years ago
Sorry, it's not working for me yet:
When a user visits the new author page Then it should have a text input field with the name 'author[last_name]'
Expected to find field "author[last_name]" that is not disabled but there were no matches
If you have problems solving this task, please don't hesitate to contact the teaching team!
Sorry, it's not working for me yet:
When a user visits the new author page Then it should have a text input field with the name 'author[homepage]'
Expected to find field "author[homepage]" that is not disabled but there were no matches
If you have problems solving this task, please don't hesitate to contact the teaching team!
Scenario
When a user visits the new author page Then it should have a text input field with the name 'author[first_name]'
Hints
The "new author" page (at
/authors/new
) is empty. Before adding input fields, create a test that checks for their presence.In the spec file (
spec/features/author/new_author_spec.rb
), create a newit
block with a descriptive name. Inside the block, after visiting the "new author" page, the test should check for input fields.RSpec uses matchers to check if a given object is present or valid. For example
have_field
checks if the HTML of the page contains aninput
form field with the given label, name or id. For more matchers, see this Cheat Sheet or the documentation.The following code snippet shows what your test could look like. You can copy&paste this code, but understand what every instruction does before moving on.
After committing the test, add the form fields for
first_name
,last_name
andhomepage
. It should look something like this. To create a form within theviews/authors/new.html.erb
view, you can use a form builder, which generates the required HTML. The primary form builder for Rails is provided by a helper method calledform_with
. See the Rails Guide.Don't worry if submitting the form causes an error at this point, that functionality will follow.
Error
2 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.