Debian Codegraph @

extra/haxelib_src/test/website/controller/RSSControllerTest.hx

raw
1 package website.controller;
2
3 import website.controller.*;
4 import ufront.web.result.*;
5 import website.Server;
6
7 // These imports are common for our various test-suite tools.
8 import buddy.*;
9 import mockatoo.Mockatoo.*;
10 import ufront.test.TestUtils.NaturalLanguageTests.*;
11 import utest.Assert;
12 using buddy.Should;
13 using ufront.test.TestUtils;
14 using mockatoo.Mockatoo;
15
16 class RSSControllerTest extends BuddySuite {
17 public function new() {
18
19 var haxelibSite = WebsiteTests.getTestApp();
20
21 describe("When I try to view the RSS feed", {
22 it("Should give me some valid XML with the latest updates", function (done) {
23 whenIVisit( "/rss" )
24 .onTheApp( haxelibSite )
25 .itShouldLoad( RSSController, "rss", [{number:null}] )
26 .itShouldReturn( ContentResult, function (result) {
27 result.contentType.should.be( "text/xml" );
28 var rss = Xml.parse( result.content );
29 })
30 .andFinishWith( done );
31 });
32 it("Should let me set the number of entries to include", function (done) {
33 whenIVisit( "/rss" )
34 .withTheQueryParams([ "number"=>"3" ])
35 .onTheApp( haxelibSite )
36 .itShouldLoad( RSSController, "rss", [{number:3}] )
37 .itShouldReturn( ContentResult, function (result) {
38 result.contentType.should.be( "text/xml" );
39 var rss = Xml.parse( result.content );
40 // TODO: check that 3 results were loaded.
41 })
42 .andFinishWith( done );
43 });
44 });
45 }
46 }