test/toto_test.rb in ceilingfish-toto-0.3.9 vs test/toto_test.rb in ceilingfish-toto-0.4.0

- old
+ new

@@ -10,41 +10,41 @@ Toto::Paths[:articles] = "test/articles" Toto::Paths[:pages] = "test/templates" Toto::Paths[:templates] = "test/templates" end - context "GET /" do - setup { @toto.get('/') } + # context "GET /" do + # setup { @toto.get('/') } + # + # asserts("returns a 200") { topic.status }.equals 200 + # asserts("body is not empty") { not topic.body.empty? } + # asserts("content type is set properly") { topic.content_type }.equals "text/html" + # should("include a couple of article") { topic.body }.includes_elements("#articles li", 3) + # should("include an archive") { topic.body }.includes_elements("#archives li", 2) + # + # context "with no articles" do + # setup { Rack::MockRequest.new(Toto::Server.new(@config.merge(:ext => 'oxo'))).get('/') } + # + # asserts("body is not empty") { not topic.body.empty? } + # asserts("returns a 200") { topic.status }.equals 200 + # end + # end + # + # context "GET /about" do + # setup { @toto.get('/about') } + # asserts("returns a 200") { topic.status }.equals 200 + # asserts("body is not empty") { not topic.body.empty? } + # should("have access to @articles") { topic.body }.includes_html("#count" => /5/) + # end + # + # context "GET a single article" do + # setup { @toto.get("/1900/05/17/the-wonderful-wizard-of-oz") } + # asserts("returns a 200") { topic.status }.equals 200 + # asserts("content type is set properly") { topic.content_type }.equals "text/html" + # should("contain the article") { topic.body }.includes_html("p" => /<em>Once upon a time<\/em>/) + # end - asserts("returns a 200") { topic.status }.equals 200 - asserts("body is not empty") { not topic.body.empty? } - asserts("content type is set properly") { topic.content_type }.equals "text/html" - should("include a couple of article") { topic.body }.includes_elements("#articles li", 3) - should("include an archive") { topic.body }.includes_elements("#archives li", 2) - - context "with no articles" do - setup { Rack::MockRequest.new(Toto::Server.new(@config.merge(:ext => 'oxo'))).get('/') } - - asserts("body is not empty") { not topic.body.empty? } - asserts("returns a 200") { topic.status }.equals 200 - end - end - - context "GET /about" do - setup { @toto.get('/about') } - asserts("returns a 200") { topic.status }.equals 200 - asserts("body is not empty") { not topic.body.empty? } - should("have access to @articles") { topic.body }.includes_html("#count" => /5/) - end - - context "GET a single article" do - setup { @toto.get("/1900/05/17/the-wonderful-wizard-of-oz") } - asserts("returns a 200") { topic.status }.equals 200 - asserts("content type is set properly") { topic.content_type }.equals "text/html" - should("contain the article") { topic.body }.includes_html("p" => /<em>Once upon a time<\/em>/) - end - context "GET to the archive" do context "through a year" do setup { @toto.get('/2009') } asserts("returns a 200") { topic.status }.equals 200 should("includes the entries for that year") { topic.body }.includes_elements("li.entry", 3) @@ -55,11 +55,11 @@ asserts("returns a 200") { topic.status }.equals 200 should("includes the entries for that month") { topic.body }.includes_elements("li.entry", 2) should("includes the year & month") { topic.body }.includes_html("h1" => /2009\/12/) end - context "through /archive" do - setup { @toto.get('/archive') } + context "through /archives" do + setup { @toto.get('/archives') } end end context "GET to an unknown route" do setup { @toto.get('/unknown') }