swt2-intro-exercise / rails-exercise-19-Jasperhino

rails-exercise-19-Jasperhino created by GitHub Classroom
MIT License
0 stars 0 forks source link

Author should have first name, last name, and homepage #3

Closed swt2public closed 5 years ago

swt2public commented 5 years ago

Scenario

When an author is created with first name 'Alan', last name 'Turing', and homepage 'http://wikipedia.org/Alan_Turing' Then an instance of Author should be created

Hints

The author model should have a first_name, last_name and homepage, which are all strings. It should furthermore have a method name which returns the full name of an author (the first name followed by the last name), e.g. 'Alan Turing'.

Test this model behavior in a model test. Create spec/models/author_spec.rb and in the describe block, specify type: :model. In a model test, behavior is tested directly on the model object, e.g.

author = Author.new(...)
expect(author.first_name).to eq(...)

The eq matcher tests for object equivalence. See this reference for more matchers.

To pass your test a Rails model for authors must be created. Rails has generators which make creating things easier. You can answer 'no' when Rails asks if you want to overwrite files, then your edited files stay the way they are. Here is the relevant section of the guide.

Additional of model methods are specified in the model's file, e.g. app/models/author.rb using standard Ruby syntax.

Error

Got NameError: uninitialized constant Author

4/44 exercise tests have passed