Browse files

Specify blog post accessors

Once again, rather than fixing the acceptance error directly, we drop down to the model test level to reproduce the error. We specify that we want a `title` field--as well as a `body` field, since we know we'll need that and it feels safe to go ahead and add it. The behavior we want is that we want those fields to be `nil` for a new model instance.

Inner red: undefined method `title' for #<BlogPost id: nil>

With this specification, we've reproduced the error from the acceptance test.
  • Loading branch information...
CodingItWrong committed Jun 14, 2016
1 parent 0301d01 commit ebca7c3cebe62a3d225ef8aee012cfc2f294400b
Showing with 7 additions and 0 deletions.
  1. +7 −0 spec/models/blog_post_spec.rb
@@ -6,4 +6,11 @@
expect{ blog_post = }.not_to raise_error
it "defaults fields to nil" do
blog_post =
expect(blog_post.title).to be_nil
expect(blog_post.body).to be_nil

0 comments on commit ebca7c3

Please sign in to comment.