Slide 37
Slide 37 text
TQFDDPOUSPMMFSTDPNNFOUT@DPOUSPMMFS@TQFDSC
RSpec.describe "Comments", :type => :request do
describe "POST /posts/xxx/comments" do
subject { post "/posts/1/comments", :comment => comment_params }
!
let(:comment_params) { {:author => "John Appleseed", :content => "Good article. I like it." } }
!
context "a post that is published" do
before { the_post.publish! }
!
it "creates a new comment" do
expect { subject }.to change { the_post.comments.count }.by(1)
ennnnd
request tests always
tagged as request
describe is usually written as HTTP request syntax
subject is defined as
"executing a http request"
matching against database changes (will write to DB)