Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Dudek jdudek

View GitHub Profile
@jdudek
jdudek / testing-rich-client-v2-pub.coffee
Created Nov 24, 2011
A few thoughts on testing rich-client applications (meet.js)
View testing-rich-client-v2-pub.coffee
# 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.
View zad1.rb
require 'gtk2'
require 'rubygems'
require 'dbi'
class Person
DB_FILE = 'db.sqlite'
@@db = nil
@@instances = []
View playing_game_test.rb
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
@jdudek
jdudek / gist:1485824
Created Dec 16, 2011
wait_for_server in Bbq
View gist:1485824
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
@jdudek
jdudek / gist:1539919
Created Dec 30, 2011
Clock in JS tests
View gist:1539919
class Countdown
constructor: (@clock, @seconds) ->
$.extend(this, new Observable)
@finished = false
start: =>
fn = =>
this.trigger("updated", @seconds)
@seconds--
if @seconds >= 0
@jdudek
jdudek / bbq_java.rb
Created Feb 8, 2012 — forked from paneq/bbq_java.rb
bbq factories
View bbq_java.rb
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?
View return-deferred.coffee
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"
@jdudek
jdudek / gist:2136360
Created Mar 20, 2012
Jasmine: suite [] instead of nested describe
View gist:2136360
# 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
View avl.c
#include <stdio.h>
#include <stdlib.h>
#define AVL_AS_LIST
typedef int AvlKey;
struct AvlNode {
AvlKey key;
char balance;
You can’t perform that action at this time.