require File.expand_path('../test_helper', __FILE__) describe "Blog example" do before { @app = blog_app } it "should respond to GET /" do get('/') assert_equal 200, response.status assert_equal "

No posts


Title

", response.body end it "should allow a POST to /" do post('/', :title => 'my title', :contents => 'hey hey hey') assert_equal 201, response.status get('/') assert_equal 200, response.status assert_equal "

Title: my title
hey hey hey


Title

", response.body end it "should allow a PUT to /" do post('/', :title => 'my title', :contents => 'hey hey hey') put('/1', :title => 'my real title', :contents => 'hey hey hey') assert_equal 200, response.status get('/') assert_equal 200, response.status assert_equal "

Title: my real title
hey hey hey


Title

", response.body end it "should allow a DELETE to /" do post('/', :title => 'my title', :contents => 'hey hey hey') assert_equal 201, response.status get('/.json') assert_equal 200, response.status assert_equal "[{\"contents\":\"hey hey hey\"}]", response.body delete('/1') assert_equal 200, response.status get('/.json') assert_equal 200, response.status assert_equal "[]", response.body end end