Skip to content

Commit

Permalink
random link works
Browse files Browse the repository at this point in the history
  • Loading branch information
apeckham committed Aug 25, 2010
1 parent 592ad68 commit 175fbf4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 5 additions & 1 deletion javascript/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Urban.Random = Class.create({
},

clicked: function() {
window.blah = 100;
new Ajax.Request("/rules/1183626.js", {method: "GET", onSuccess: function(transport) {
var tickets = JSON.parse(transport.responseText);
var ticket = tickets[Math.floor(Math.random() * tickets.length)];
window.location = "/tickets/" + ticket.nice_id;
}});
}
});
5 changes: 0 additions & 5 deletions spec/RandomSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ describe("Random widget", function() {
new Urban.Random(element);
expect(element.down("a")).toBeTruthy();
});

it("should do something when you click on the link", function() {
new Urban.Random(element).clicked();
expect(window.blah).toEqual(100);
});
});

0 comments on commit 175fbf4

Please sign in to comment.