This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# suite ["shooter", "acceptance"], -> ... | |
# is equivalent to: | |
# describe "shooter", -> | |
# describe "acceptance", -> ... | |
window.suite = (names, block) -> | |
name = names.shift() | |
if names.length > 0 | |
describe(name, -> suite(names, block)) | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jasmine.Spy.prototype.andReturnDeferred = -> | |
@deferreds = [] | |
@resolve = => | |
unless @deferreds.length > 0 | |
throw "Cannot resolve, #{@identity} was not called" | |
dfr = @deferreds.shift() | |
dfr.resolve() | |
@reject = => | |
unless @deferreds.length > 0 | |
throw "Cannot reject, #{@identity} was not called" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Session | |
# some kind of delegator is needed here | |
# delegate everything to @session | |
def initialize(options) | |
@session = Capybara::Session.new(options[:driver], Bbq.app) | |
end | |
def kill | |
page.driver.quit if page.driver.browser? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Countdown | |
constructor: (@clock, @seconds) -> | |
$.extend(this, new Observable) | |
@finished = false | |
start: => | |
fn = => | |
this.trigger("updated", @seconds) | |
@seconds-- | |
if @seconds >= 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
git "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestUser | |
def wait(seconds) | |
sleep seconds.to_i | |
end | |
def wait_for_server(timeout = 10.seconds) | |
page.wait_until(timeout.to_i) do | |
page.evaluate_script 'jQuery.active == 0' | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + "/../test_helper" | |
class PlayingGameTest < Bbq::TestCase | |
include Bbq::SessionPool | |
background do | |
@admin = session_pool.create_user(TestUser, :driver => :selenium) | |
@admin.roles(:admin) | |
@admin.prepare_game_data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gtk2' | |
require 'rubygems' | |
require 'dbi' | |
class Person | |
DB_FILE = 'db.sqlite' | |
@@db = nil | |
@@instances = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A few thoughts on testing rich-client applications | |
# Jan Dudek, Arkency | |
# We've created a game that has some animations, uses Facebook API. Almost no rendering on the server. Client-server communication through JSON REST API. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test = (suite) -> | |
self = {} | |
steps = [] | |
last = null | |
run = (suite, steps) -> | |
return if steps.length == 0 | |
[step, msg, fn] = steps.shift() | |
if step == describe | |
describe.call suite, msg, -> |